diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 86c7ead3..0ea288c3 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - jdk: ['8', '11', '17'] + jdk: ['11', '17'] steps: - uses: actions/checkout@v4 diff --git a/README.md b/README.md index 59c95b31..4bebb2d3 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ The v4 SDK provides a modern, immutable client with enhanced type safety and imp #### Gradle (Kotlin DSL) ```kotlin dependencies { - implementation("com.chargebee:chargebee-java:4.0.0") + implementation("com.chargebee:chargebee-java:4.0.0-beta.3") } ``` @@ -56,7 +56,7 @@ dependencies { com.chargebee chargebee-java - 4.0.0 + 4.0.0-beta.3 ``` @@ -221,23 +221,29 @@ The library provides a comprehensive exception hierarchy with **strongly-typed e #### Exception Hierarchy -All Chargebee exceptions extend from `TransportException`, which is a checked exception: +All Chargebee exceptions extend from `ChargebeeException`, which is an unchecked exception: ``` -TransportException (checked) - └── HttpException (HTTP status code errors: 4xx, 5xx) - ├── ClientErrorException (4xx errors) - ├── ServerErrorException (5xx errors) - └── APIException (Chargebee API errors) - ├── InvalidRequestException (validation errors) - ├── PaymentException (payment-related errors) - ├── OperationFailedException (business logic errors) - ├── BatchAPIException (batch operation errors) - └── UbbBatchIngestionInvalidRequestException (batch ingestion errors) +ChargebeeException (unchecked - extends RuntimeException) +├── ConfigurationException (setup/config errors) +└── TransportException (runtime API errors) + ├── NetworkException (DNS failures, connection refused) + ├── TimeoutException (connect/read timeouts) + └── HttpException (HTTP status code errors: 4xx, 5xx) + ├── ClientErrorException (4xx errors) + ├── ServerErrorException (5xx errors) + └── APIException (Chargebee API errors) + ├── InvalidRequestException (validation errors) + ├── PaymentException (payment-related errors) + ├── OperationFailedException (business logic errors) + ├── BatchAPIException (batch operation errors) + └── UbbBatchIngestionInvalidRequestException (batch ingestion errors) ``` #### Exception Types +- **`ChargebeeException`**: Base exception for all SDK errors - catch-all for any Chargebee SDK error +- **`ConfigurationException`**: Thrown when SDK configuration is invalid (missing API key, invalid URL, etc.) - **`TransportException`**: Base exception for all transport-layer failures (network issues, timeouts, etc.) - **`HttpException`**: Thrown for HTTP error status codes (4xx, 5xx) - contains status code and response - **`ClientErrorException`**: HTTP 4xx client errors (bad request, unauthorized, not found, etc.) diff --git a/build.gradle.kts b/build.gradle.kts index 70f6085a..320f4f89 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "com.chargebee" -version = "4.0.0" +version = "4.0.0-beta.3" description = "Next-gen Java client library for ChargeBee API" // Project metadata @@ -30,8 +30,8 @@ extra["projectLicenseUrl"] = projectLicenseUrl extra["teamMembers"] = teamMembers java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 withSourcesJar() withJavadocJar() } diff --git a/dist/chargebee-java-4.0.0-beta.3-javadoc.jar b/dist/chargebee-java-4.0.0-beta.3-javadoc.jar new file mode 100644 index 00000000..5c05ee79 Binary files /dev/null and b/dist/chargebee-java-4.0.0-beta.3-javadoc.jar differ diff --git a/dist/chargebee-java-4.0.0-beta.3-sources.jar b/dist/chargebee-java-4.0.0-beta.3-sources.jar new file mode 100644 index 00000000..eb31cdb9 Binary files /dev/null and b/dist/chargebee-java-4.0.0-beta.3-sources.jar differ diff --git a/dist/chargebee-java-4.0.0-beta.3.jar b/dist/chargebee-java-4.0.0-beta.3.jar new file mode 100644 index 00000000..3fcd16e7 Binary files /dev/null and b/dist/chargebee-java-4.0.0-beta.3.jar differ diff --git a/dist/chargebee-java-4.0.0-javadoc.jar b/dist/chargebee-java-4.0.0-javadoc.jar deleted file mode 100644 index 59936db5..00000000 Binary files a/dist/chargebee-java-4.0.0-javadoc.jar and /dev/null differ diff --git a/dist/chargebee-java-4.0.0-sources.jar b/dist/chargebee-java-4.0.0-sources.jar deleted file mode 100644 index 30293d52..00000000 Binary files a/dist/chargebee-java-4.0.0-sources.jar and /dev/null differ diff --git a/dist/chargebee-java-4.0.0.jar b/dist/chargebee-java-4.0.0.jar deleted file mode 100644 index fbe07643..00000000 Binary files a/dist/chargebee-java-4.0.0.jar and /dev/null differ diff --git a/docs/MIGRATION_GUIDE.md b/docs/MIGRATION_GUIDE.md index eb2d03d8..d3fc11e5 100644 --- a/docs/MIGRATION_GUIDE.md +++ b/docs/MIGRATION_GUIDE.md @@ -34,7 +34,7 @@ The v4 SDK provides a modern, immutable client with enhanced type safety and imp com.chargebee chargebee-java - 4.0.0 + 4.0.0-beta.3 ``` diff --git a/src/main/java/com/chargebee/v4/client/ChargebeeClient.java b/src/main/java/com/chargebee/v4/client/ChargebeeClient.java index 0de6c4ab..a5ec524e 100644 --- a/src/main/java/com/chargebee/v4/client/ChargebeeClient.java +++ b/src/main/java/com/chargebee/v4/client/ChargebeeClient.java @@ -3,6 +3,7 @@ import com.chargebee.v4.client.request.RequestContext; import com.chargebee.v4.client.request.RequestInterceptor; import com.chargebee.v4.client.request.RequestWrap; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.exceptions.ConfigurationException; import com.chargebee.v4.exceptions.NetworkException; import com.chargebee.v4.exceptions.TimeoutException; @@ -109,9 +110,9 @@ public String getBaseUrl() { * @param path the API path (e.g., "/customers") * @param queryParams optional query parameters * @return the HTTP response - * @throws Exception for network, timeout, configuration failures, or interceptor errors + * @throws ChargebeeException for network, timeout, configuration failures, or interceptor errors */ - public Response get(String path, Map> queryParams) throws Exception { + public Response get(String path, Map> queryParams) throws ChargebeeException { Map objectParams = new HashMap<>(queryParams); String fullUrl = UrlBuilder.buildUrl(getBaseUrl(), path, objectParams); Request.Builder builder = Request.builder() @@ -130,9 +131,9 @@ public Response get(String path, Map> queryParams) throws E * * @param path the API path (e.g., "/customers") * @return the HTTP response - * @throws Exception for network, timeout, configuration failures, or interceptor errors + * @throws ChargebeeException for network, timeout, configuration failures, or interceptor errors */ - public Response get(String path) throws Exception { + public Response get(String path) throws ChargebeeException { return get(path, Collections.emptyMap()); } @@ -173,9 +174,9 @@ public CompletableFuture getAsync(String path) { * @param path the API path (e.g., "/customers") * @param formData the form data to send * @return the HTTP response - * @throws Exception for network, timeout, configuration failures, or interceptor errors + * @throws ChargebeeException for network, timeout, configuration failures, or interceptor errors */ - public Response post(String path, Map formData) throws Exception { + public Response post(String path, Map formData) throws ChargebeeException { String fullUrl = UrlBuilder.buildUrl(getBaseUrl(), path, null); Request.Builder builder = Request.builder() .method("POST") @@ -195,9 +196,9 @@ public Response post(String path, Map formData) throws Exception * @param path the API path (e.g., "/customers") * @param jsonData the JSON data to send * @return the HTTP response - * @throws Exception for network, timeout, configuration failures, or interceptor errors + * @throws ChargebeeException for network, timeout, configuration failures, or interceptor errors */ - public Response postJson(String path, String jsonData) throws Exception { + public Response postJson(String path, String jsonData) throws ChargebeeException { String fullUrl = UrlBuilder.buildUrl(getBaseUrl(), path, null); Request.Builder builder = Request.builder() .method("POST") @@ -256,7 +257,7 @@ public CompletableFuture postJsonAsync(String path, String jsonData) { /** * Execute a request with optional interceptor. */ - public Response executeWithInterceptor(Request request) throws Exception { + public Response executeWithInterceptor(Request request) throws ChargebeeException { if (requestInterceptor != null) { RequestWrap requestWrap = new RequestWrap(this, request); return requestInterceptor.handleRequest(requestWrap); @@ -280,7 +281,7 @@ public CompletableFuture executeWithInterceptorAsync(Request request) /** * Send a request with retry logic based on the configured RetryConfig. */ - public Response sendWithRetry(Request request) throws TransportException { + public Response sendWithRetry(Request request) { Request enrichedRequest = addDefaultHeaders(request); Integer overrideRetries = enrichedRequest.getMaxNetworkRetriesOverride(); diff --git a/src/main/java/com/chargebee/v4/client/request/RequestInterceptor.java b/src/main/java/com/chargebee/v4/client/request/RequestInterceptor.java index 6db6dfb3..67f2e451 100644 --- a/src/main/java/com/chargebee/v4/client/request/RequestInterceptor.java +++ b/src/main/java/com/chargebee/v4/client/request/RequestInterceptor.java @@ -1,5 +1,6 @@ package com.chargebee.v4.client.request; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Request; import com.chargebee.v4.transport.Response; import java.util.concurrent.CompletableFuture; @@ -51,9 +52,9 @@ public interface RequestInterceptor { * * @param requestWrap wrapper containing the transport request and execution context * @return the transport response, either from proceeding or custom implementation - * @throws Exception if request processing fails + * @throws ChargebeeException if request processing fails */ - Response handleRequest(RequestWrap requestWrap) throws Exception; + Response handleRequest(RequestWrap requestWrap) throws ChargebeeException; /** * Handle the intercepted request asynchronously. diff --git a/src/main/java/com/chargebee/v4/client/request/RequestWrap.java b/src/main/java/com/chargebee/v4/client/request/RequestWrap.java index be0b75e5..183da7e6 100644 --- a/src/main/java/com/chargebee/v4/client/request/RequestWrap.java +++ b/src/main/java/com/chargebee/v4/client/request/RequestWrap.java @@ -1,6 +1,7 @@ package com.chargebee.v4.client.request; import com.chargebee.v4.client.ChargebeeClient; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Request; import com.chargebee.v4.transport.Response; import java.util.concurrent.Callable; @@ -95,9 +96,9 @@ public ChargebeeClient getClient() { * standard request processing after any modifications.

* * @return the transport response from normal execution - * @throws Exception if request execution fails + * @throws ChargebeeException if request execution fails */ - public Response proceed() throws Exception { + public Response proceed() throws ChargebeeException { return call(); } @@ -120,10 +121,10 @@ public CompletableFuture proceedAsync() { * and transport layer.

* * @return the transport response - * @throws Exception if request execution fails + * @throws ChargebeeException if request execution fails */ @Override - public Response call() throws Exception { + public Response call() throws ChargebeeException { return client.sendWithRetry(request); } } \ No newline at end of file diff --git a/src/main/java/com/chargebee/v4/exceptions/APIException.java b/src/main/java/com/chargebee/v4/exceptions/APIException.java index ab17870c..7793ef97 100644 --- a/src/main/java/com/chargebee/v4/exceptions/APIException.java +++ b/src/main/java/com/chargebee/v4/exceptions/APIException.java @@ -252,11 +252,12 @@ private String extractErrorCauseId(String jsonResponse) { /** * API errors are generally not retryable as they indicate business logic issues. - * + * *

Exceptions that may warrant retry: + * *

    - *
  • 429 Too Many Requests - Rate limiting
  • - *
  • 5xx Server errors - Temporary server issues
  • + *
  • 429 Too Many Requests - Rate limiting + *
  • 5xx Server errors - Temporary server issues *
* * @return true only for 429 or 5xx status codes diff --git a/src/main/java/com/chargebee/v4/exceptions/ChargebeeException.java b/src/main/java/com/chargebee/v4/exceptions/ChargebeeException.java new file mode 100644 index 00000000..00ba4acb --- /dev/null +++ b/src/main/java/com/chargebee/v4/exceptions/ChargebeeException.java @@ -0,0 +1,95 @@ +package com.chargebee.v4.exceptions; + +/** + * The root exception class for all errors originating from the Chargebee SDK. + * + *

{@code ChargebeeException} serves as the unified base for the SDK's exception hierarchy, + * enabling developers to catch all Chargebee-related errors with a single exception type + * while still allowing fine-grained handling of specific error categories.

+ * + *

Exception Hierarchy

+ *
+ * ChargebeeException
+ * ├── {@link ConfigurationException}     — Invalid SDK configuration (missing API key, malformed URL)
+ * └── {@link TransportException}         — Runtime communication errors
+ *     ├── {@link NetworkException}       — Connection failures, DNS resolution errors
+ *     ├── {@link TimeoutException}       — Connect or read timeout exceeded
+ *     └── {@link HttpException}          — HTTP-level errors (4xx, 5xx responses)
+ *         ├── {@link ClientErrorException}   — Client errors (400-499)
+ *         ├── {@link ServerErrorException}   — Server errors (500-599)
+ *         └── {@link APIException}           — Chargebee API errors with structured details
+ * 
+ * + *

Usage Patterns

+ * + *

Catch-all handling

+ *
{@code
+ * try {
+ *     client.subscriptions().create(params);
+ * } catch (ChargebeeException e) {
+ *     log.error("Chargebee operation failed: {}", e.getMessage());
+ *     if (e.isRetryable()) {
+ *         // Schedule retry
+ *     }
+ * }
+ * }
+ * + *

Granular error handling

+ *
{@code
+ * try {
+ *     client.subscriptions().create(params);
+ * } catch (InvalidRequestException e) {
+ *     // Handle validation errors - check e.getParams() for invalid fields
+ * } catch (PaymentException e) {
+ *     // Handle payment failures - check e.getErrorCauseId() for gateway details
+ * } catch (NetworkException | TimeoutException e) {
+ *     // Handle transient failures - safe to retry
+ * } catch (ChargebeeException e) {
+ *     // Fallback for unexpected SDK errors
+ * }
+ * }
+ * + * @see TransportException + * @see ConfigurationException + * @see APIException + */ +public class ChargebeeException extends RuntimeException { + + /** + * Constructs a new exception with the specified detail message. + * + * @param message the detail message describing the error condition + */ + public ChargebeeException(String message) { + super(message); + } + + /** + * Constructs a new exception with the specified detail message and cause. + * + * @param message the detail message describing the error condition + * @param cause the underlying exception that triggered this error + */ + public ChargebeeException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Indicates whether retrying the failed operation might succeed. + * + *

Subclasses override this method to provide accurate retry guidance:

+ *
    + *
  • {@link NetworkException} — returns {@code true} (transient connectivity issues)
  • + *
  • {@link TimeoutException} — returns {@code true} (temporary overload)
  • + *
  • {@link ServerErrorException} — returns {@code true} for 5xx except 501
  • + *
  • {@link ClientErrorException} — returns {@code true} only for 429 (rate limited)
  • + *
  • {@link ConfigurationException} — returns {@code false} (requires code fix)
  • + *
+ * + * @return {@code true} if the operation may succeed on retry; {@code false} otherwise + */ + public boolean isRetryable() { + return false; + } +} + diff --git a/src/main/java/com/chargebee/v4/exceptions/ConfigurationException.java b/src/main/java/com/chargebee/v4/exceptions/ConfigurationException.java index 0356b59a..4a75e378 100644 --- a/src/main/java/com/chargebee/v4/exceptions/ConfigurationException.java +++ b/src/main/java/com/chargebee/v4/exceptions/ConfigurationException.java @@ -3,7 +3,7 @@ /** * Exception thrown when there's an issue with SDK configuration. * - *

This is a runtime exception (unchecked) to allow fluent builder usage + *

This extends {@link ChargebeeException} to allow fluent builder usage * without requiring try-catch blocks during client setup. * *

Common causes: @@ -28,7 +28,7 @@ *

Note: This exception is NOT retryable as it indicates a programming error * that must be fixed in the code. */ -public class ConfigurationException extends RuntimeException { +public class ConfigurationException extends ChargebeeException { /** * Creates a ConfigurationException with a message. diff --git a/src/main/java/com/chargebee/v4/exceptions/TransportException.java b/src/main/java/com/chargebee/v4/exceptions/TransportException.java index 5273e539..644e05be 100644 --- a/src/main/java/com/chargebee/v4/exceptions/TransportException.java +++ b/src/main/java/com/chargebee/v4/exceptions/TransportException.java @@ -19,16 +19,17 @@ * *

Exception hierarchy: *

- * TransportException
- * ├── NetworkException      (DNS failures, connection refused, I/O errors)
- * ├── TimeoutException      (connect/read timeouts)
- * └── HttpException         (HTTP status code errors: 4xx, 5xx)
- *     ├── ClientErrorException (4xx)
- *     ├── ServerErrorException (5xx)
- *     └── APIException         (Chargebee API errors with structured response)
+ * ChargebeeException
+ * └── TransportException
+ *     ├── NetworkException      (DNS failures, connection refused, I/O errors)
+ *     ├── TimeoutException      (connect/read timeouts)
+ *     └── HttpException         (HTTP status code errors: 4xx, 5xx)
+ *         ├── ClientErrorException (4xx)
+ *         ├── ServerErrorException (5xx)
+ *         └── APIException         (Chargebee API errors with structured response)
  * 
*/ -public class TransportException extends Exception { +public class TransportException extends ChargebeeException { private final Request request; diff --git a/src/main/java/com/chargebee/v4/internal/JsonUtil.java b/src/main/java/com/chargebee/v4/internal/JsonUtil.java index f8b46a98..45db5ada 100644 --- a/src/main/java/com/chargebee/v4/internal/JsonUtil.java +++ b/src/main/java/com/chargebee/v4/internal/JsonUtil.java @@ -120,26 +120,114 @@ public static String getObject(String json, String key) { if (json == null || key == null) { return null; } - Pattern pattern = Pattern.compile("\"" + Pattern.quote(key) + "\"\\s*:\\s*(\\{[^}]*\\})"); + // Find the key position + String keyPattern = "\"" + Pattern.quote(key) + "\"\\s*:"; + Pattern pattern = Pattern.compile(keyPattern); Matcher matcher = pattern.matcher(json); - if (matcher.find()) { - return matcher.group(1); + if (!matcher.find()) { + return null; + } + + // Find the start of the object value (skip whitespace after colon) + int start = matcher.end(); + while (start < json.length() && Character.isWhitespace(json.charAt(start))) { + start++; + } + + if (start >= json.length() || json.charAt(start) != '{') { + return null; + } + + // Extract the object by tracking brace depth + int depth = 0; + boolean inString = false; + boolean escaped = false; + int objectStart = start; + + for (int i = start; i < json.length(); i++) { + char c = json.charAt(i); + + if (escaped) { + escaped = false; + continue; + } + + if (c == '\\' && inString) { + escaped = true; + continue; + } + + if (c == '"' && !escaped) { + inString = !inString; + continue; + } + + if (!inString) { + if (c == '{') { + depth++; + } else if (c == '}') { + depth--; + if (depth == 0) { + return json.substring(objectStart, i + 1); + } + } + } } + return null; } /** * Extract array as JSON string for a given key. + * Handles nested arrays and objects by tracking bracket depth. */ public static String getArray(String json, String key) { if (json == null || key == null) { return null; } - String pattern = "\"" + Pattern.quote(key) + "\"\\s*:\\s*(\\[.*?\\])"; - Pattern p = Pattern.compile(pattern, Pattern.DOTALL); + + // Find the key position + String keyPattern = "\"" + Pattern.quote(key) + "\"\\s*:\\s*\\["; + Pattern p = Pattern.compile(keyPattern); Matcher matcher = p.matcher(json); - if (matcher.find()) { - return matcher.group(1); + if (!matcher.find()) { + return null; + } + + // Start from the opening bracket + int start = matcher.end() - 1; // Position of '[' + int depth = 0; + boolean inString = false; + boolean escaped = false; + + for (int i = start; i < json.length(); i++) { + char c = json.charAt(i); + + if (escaped) { + escaped = false; + continue; + } + + if (c == '\\' && inString) { + escaped = true; + continue; + } + + if (c == '"' && !escaped) { + inString = !inString; + continue; + } + + if (!inString) { + if (c == '[') { + depth++; + } else if (c == ']') { + depth--; + if (depth == 0) { + return json.substring(start, i + 1); + } + } + } } return null; } @@ -200,8 +288,17 @@ public static List parseObjectArray(String arrayJson) { * Check if a key exists and has non-null value. */ public static boolean hasValue(String json, String key) { - Pattern pattern = Pattern.compile("\"" + Pattern.quote(key) + "\"\\s*:\\s*(?!null\\b)"); - return pattern.matcher(json).find(); + if (json == null || key == null) { + return false; + } + // First check if the key exists with null value + Pattern nullPattern = Pattern.compile("\"" + Pattern.quote(key) + "\"\\s*:\\s*null\\b"); + if (nullPattern.matcher(json).find()) { + return false; + } + // Then check if the key exists at all + Pattern keyPattern = Pattern.compile("\"" + Pattern.quote(key) + "\"\\s*:"); + return keyPattern.matcher(json).find(); } /** @@ -329,19 +426,15 @@ public static List parseArrayOfBigDecimal(String arrayJson } /** - * Parse timestamp from JSON string. + * Parse timestamp from JSON (Unix epoch seconds). */ public static Timestamp getTimestamp(String json, String key) { - Pattern pattern = Pattern.compile("\"" + Pattern.quote(key) + "\"\\s*:\\s*(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z)"); - Matcher matcher = pattern.matcher(json); - if (matcher.find()) { - return Timestamp.valueOf(matcher.group(1)); - } - return null; + Long epochSeconds = getLong(json, key); + return epochSeconds != null ? new Timestamp(epochSeconds * 1000) : null; } /** - * Parse a JSON object into a Map. + * Parse a JSON object into a Map<String, Object>. * Values are kept as their raw types (String, Long, Double, Boolean, or nested JSON strings). */ public static java.util.Map parseJsonObjectToMap(String json) { @@ -539,18 +632,26 @@ else if (c == ']') { /** * Unescape JSON string. + * Processes escape sequences correctly by handling \\\\ last to avoid + * incorrectly interpreting sequences like \\t as tab. */ private static String unescapeJsonString(String escaped) { if (escaped == null) return null; + + // Use a placeholder for \\ to avoid interference with other escapes + // e.g., \\t should become \t (backslash + t), not a tab character + String placeholder = "\u0000BACKSLASH\u0000"; + return escaped + .replace("\\\\", placeholder) // Temporarily replace \\ with placeholder .replace("\\\"", "\"") - .replace("\\\\", "\\") .replace("\\/", "/") .replace("\\b", "\b") .replace("\\f", "\f") .replace("\\n", "\n") .replace("\\r", "\r") - .replace("\\t", "\t"); + .replace("\\t", "\t") + .replace(placeholder, "\\"); // Replace placeholder with actual backslash } /** diff --git a/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/params/AdditionalBillingLogiqExecuteParams.java b/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/params/AdditionalBillingLogiqExecuteParams.java deleted file mode 100644 index 8ed1d1d0..00000000 --- a/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/params/AdditionalBillingLogiqExecuteParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.additionalBillingLogiq.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AdditionalBillingLogiqExecuteParams { - - private final Map queryParams; - - private AdditionalBillingLogiqExecuteParams(AdditionalBillingLogiqExecuteBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public AdditionalBillingLogiqExecuteBuilder toBuilder() { - AdditionalBillingLogiqExecuteBuilder builder = new AdditionalBillingLogiqExecuteBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for AdditionalBillingLogiqExecuteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AdditionalBillingLogiqExecuteBuilder builder() { - return new AdditionalBillingLogiqExecuteBuilder(); - } - - public static final class AdditionalBillingLogiqExecuteBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private AdditionalBillingLogiqExecuteBuilder() {} - - public AdditionalBillingLogiqExecuteParams build() { - return new AdditionalBillingLogiqExecuteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/params/AdditionalBillingLogiqRetrieveParams.java b/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/params/AdditionalBillingLogiqRetrieveParams.java new file mode 100644 index 00000000..5c268182 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/params/AdditionalBillingLogiqRetrieveParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.additionalBillingLogiq.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class AdditionalBillingLogiqRetrieveParams { + + private final Map queryParams; + + private AdditionalBillingLogiqRetrieveParams(AdditionalBillingLogiqRetrieveBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public AdditionalBillingLogiqRetrieveBuilder toBuilder() { + AdditionalBillingLogiqRetrieveBuilder builder = new AdditionalBillingLogiqRetrieveBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for AdditionalBillingLogiqRetrieveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AdditionalBillingLogiqRetrieveBuilder builder() { + return new AdditionalBillingLogiqRetrieveBuilder(); + } + + public static final class AdditionalBillingLogiqRetrieveBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private AdditionalBillingLogiqRetrieveBuilder() {} + + public AdditionalBillingLogiqRetrieveParams build() { + return new AdditionalBillingLogiqRetrieveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/responses/AdditionalBillingLogiqExecuteResponse.java b/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/responses/AdditionalBillingLogiqExecuteResponse.java deleted file mode 100644 index 777d462f..00000000 --- a/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/responses/AdditionalBillingLogiqExecuteResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.chargebee.v4.models.additionalBillingLogiq.responses; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AdditionalBillingLogiqExecute operation. Contains the response data - * from a single resource get operation. - */ -public final class AdditionalBillingLogiqExecuteResponse extends BaseResponse { - private final Object additionalBillingLogiq; - - private AdditionalBillingLogiqExecuteResponse(Builder builder) { - super(builder.httpResponse); - - this.additionalBillingLogiq = builder.additionalBillingLogiq; - } - - /** Parse JSON response into AdditionalBillingLogiqExecuteResponse object. */ - public static AdditionalBillingLogiqExecuteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AdditionalBillingLogiqExecuteResponse object with HTTP response. */ - public static AdditionalBillingLogiqExecuteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.additionalBillingLogiq(JsonUtil.getObject(json, "additional_billing_logiq")); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse AdditionalBillingLogiqExecuteResponse from JSON", e); - } - } - - /** Create a new builder for AdditionalBillingLogiqExecuteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AdditionalBillingLogiqExecuteResponse. */ - public static class Builder { - - private Object additionalBillingLogiq; - - private Response httpResponse; - - private Builder() {} - - public Builder additionalBillingLogiq(Object additionalBillingLogiq) { - this.additionalBillingLogiq = additionalBillingLogiq; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AdditionalBillingLogiqExecuteResponse build() { - return new AdditionalBillingLogiqExecuteResponse(this); - } - } - - /** Get the additionalBillingLogiq from the response. */ - public Object getAdditionalBillingLogiq() { - return additionalBillingLogiq; - } -} diff --git a/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/responses/AdditionalBillingLogiqRetrieveResponse.java b/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/responses/AdditionalBillingLogiqRetrieveResponse.java new file mode 100644 index 00000000..960b1ffa --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/additionalBillingLogiq/responses/AdditionalBillingLogiqRetrieveResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.additionalBillingLogiq.responses; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for AdditionalBillingLogiqRetrieve operation. Contains the response + * data from a single resource get operation. + */ +public final class AdditionalBillingLogiqRetrieveResponse extends BaseResponse { + private final Object additionalBillingLogiq; + + private AdditionalBillingLogiqRetrieveResponse(Builder builder) { + super(builder.httpResponse); + + this.additionalBillingLogiq = builder.additionalBillingLogiq; + } + + /** Parse JSON response into AdditionalBillingLogiqRetrieveResponse object. */ + public static AdditionalBillingLogiqRetrieveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into AdditionalBillingLogiqRetrieveResponse object with HTTP response. */ + public static AdditionalBillingLogiqRetrieveResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.additionalBillingLogiq(JsonUtil.getObject(json, "additional_billing_logiq")); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse AdditionalBillingLogiqRetrieveResponse from JSON", e); + } + } + + /** Create a new builder for AdditionalBillingLogiqRetrieveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for AdditionalBillingLogiqRetrieveResponse. */ + public static class Builder { + + private Object additionalBillingLogiq; + + private Response httpResponse; + + private Builder() {} + + public Builder additionalBillingLogiq(Object additionalBillingLogiq) { + this.additionalBillingLogiq = additionalBillingLogiq; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public AdditionalBillingLogiqRetrieveResponse build() { + return new AdditionalBillingLogiqRetrieveResponse(this); + } + } + + /** Get the additionalBillingLogiq from the response. */ + public Object getAdditionalBillingLogiq() { + return additionalBillingLogiq; + } +} diff --git a/src/main/java/com/chargebee/v4/models/addon/params/AddonDeleteParams.java b/src/main/java/com/chargebee/v4/models/addon/params/AddonDeleteParams.java new file mode 100644 index 00000000..f22b1f5b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/addon/params/AddonDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.addon.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class AddonDeleteParams { + + private AddonDeleteParams(AddonDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for AddonDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddonDeleteBuilder builder() { + return new AddonDeleteBuilder(); + } + + public static final class AddonDeleteBuilder { + + private AddonDeleteBuilder() {} + + public AddonDeleteParams build() { + return new AddonDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/addon/params/AddonUnarchiveParams.java b/src/main/java/com/chargebee/v4/models/addon/params/AddonUnarchiveParams.java new file mode 100644 index 00000000..a402d94b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/addon/params/AddonUnarchiveParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.addon.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class AddonUnarchiveParams { + + private AddonUnarchiveParams(AddonUnarchiveBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for AddonUnarchiveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddonUnarchiveBuilder builder() { + return new AddonUnarchiveBuilder(); + } + + public static final class AddonUnarchiveBuilder { + + private AddonUnarchiveBuilder() {} + + public AddonUnarchiveParams build() { + return new AddonUnarchiveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/addon/params/DeleteAddonParams.java b/src/main/java/com/chargebee/v4/models/addon/params/DeleteAddonParams.java deleted file mode 100644 index 289c5e9e..00000000 --- a/src/main/java/com/chargebee/v4/models/addon/params/DeleteAddonParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.addon.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteAddonParams { - - private DeleteAddonParams(DeleteAddonBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteAddonParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteAddonBuilder builder() { - return new DeleteAddonBuilder(); - } - - public static final class DeleteAddonBuilder { - - private DeleteAddonBuilder() {} - - public DeleteAddonParams build() { - return new DeleteAddonParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/addon/params/UnarchiveForAddonParams.java b/src/main/java/com/chargebee/v4/models/addon/params/UnarchiveForAddonParams.java deleted file mode 100644 index 2ae97a2a..00000000 --- a/src/main/java/com/chargebee/v4/models/addon/params/UnarchiveForAddonParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.addon.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UnarchiveForAddonParams { - - private UnarchiveForAddonParams(UnarchiveForAddonBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for UnarchiveForAddonParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UnarchiveForAddonBuilder builder() { - return new UnarchiveForAddonBuilder(); - } - - public static final class UnarchiveForAddonBuilder { - - private UnarchiveForAddonBuilder() {} - - public UnarchiveForAddonParams build() { - return new UnarchiveForAddonParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/addon/responses/AddonDeleteResponse.java b/src/main/java/com/chargebee/v4/models/addon/responses/AddonDeleteResponse.java new file mode 100644 index 00000000..9cfb740a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/addon/responses/AddonDeleteResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.addon.responses; + +import com.chargebee.v4.models.addon.Addon; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for AddonDelete operation. Contains the response data from the API. */ +public final class AddonDeleteResponse extends BaseResponse { + private final Addon addon; + + private AddonDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.addon = builder.addon; + } + + /** Parse JSON response into AddonDeleteResponse object. */ + public static AddonDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into AddonDeleteResponse object with HTTP response. */ + public static AddonDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __addonJson = JsonUtil.getObject(json, "addon"); + if (__addonJson != null) { + builder.addon(Addon.fromJson(__addonJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse AddonDeleteResponse from JSON", e); + } + } + + /** Create a new builder for AddonDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for AddonDeleteResponse. */ + public static class Builder { + + private Addon addon; + + private Response httpResponse; + + private Builder() {} + + public Builder addon(Addon addon) { + this.addon = addon; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public AddonDeleteResponse build() { + return new AddonDeleteResponse(this); + } + } + + /** Get the addon from the response. */ + public Addon getAddon() { + return addon; + } +} diff --git a/src/main/java/com/chargebee/v4/models/addon/responses/AddonListResponse.java b/src/main/java/com/chargebee/v4/models/addon/responses/AddonListResponse.java index 2fe17599..8274e03d 100644 --- a/src/main/java/com/chargebee/v4/models/addon/responses/AddonListResponse.java +++ b/src/main/java/com/chargebee/v4/models/addon/responses/AddonListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.addon.Addon; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.AddonService; @@ -95,9 +96,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public AddonListResponse nextPage() throws Exception { + public AddonListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/addon/responses/AddonUnarchiveResponse.java b/src/main/java/com/chargebee/v4/models/addon/responses/AddonUnarchiveResponse.java new file mode 100644 index 00000000..9437a21f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/addon/responses/AddonUnarchiveResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.addon.responses; + +import com.chargebee.v4.models.addon.Addon; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for AddonUnarchive operation. Contains the response data from the API. + */ +public final class AddonUnarchiveResponse extends BaseResponse { + private final Addon addon; + + private AddonUnarchiveResponse(Builder builder) { + super(builder.httpResponse); + + this.addon = builder.addon; + } + + /** Parse JSON response into AddonUnarchiveResponse object. */ + public static AddonUnarchiveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into AddonUnarchiveResponse object with HTTP response. */ + public static AddonUnarchiveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __addonJson = JsonUtil.getObject(json, "addon"); + if (__addonJson != null) { + builder.addon(Addon.fromJson(__addonJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse AddonUnarchiveResponse from JSON", e); + } + } + + /** Create a new builder for AddonUnarchiveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for AddonUnarchiveResponse. */ + public static class Builder { + + private Addon addon; + + private Response httpResponse; + + private Builder() {} + + public Builder addon(Addon addon) { + this.addon = addon; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public AddonUnarchiveResponse build() { + return new AddonUnarchiveResponse(this); + } + } + + /** Get the addon from the response. */ + public Addon getAddon() { + return addon; + } +} diff --git a/src/main/java/com/chargebee/v4/models/addon/responses/DeleteAddonResponse.java b/src/main/java/com/chargebee/v4/models/addon/responses/DeleteAddonResponse.java deleted file mode 100644 index 7db533d5..00000000 --- a/src/main/java/com/chargebee/v4/models/addon/responses/DeleteAddonResponse.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.chargebee.v4.models.addon.responses; - -import com.chargebee.v4.models.addon.Addon; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** Immutable response object for DeleteAddon operation. Contains the response data from the API. */ -public final class DeleteAddonResponse extends BaseResponse { - private final Addon addon; - - private DeleteAddonResponse(Builder builder) { - super(builder.httpResponse); - - this.addon = builder.addon; - } - - /** Parse JSON response into DeleteAddonResponse object. */ - public static DeleteAddonResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteAddonResponse object with HTTP response. */ - public static DeleteAddonResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __addonJson = JsonUtil.getObject(json, "addon"); - if (__addonJson != null) { - builder.addon(Addon.fromJson(__addonJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteAddonResponse from JSON", e); - } - } - - /** Create a new builder for DeleteAddonResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteAddonResponse. */ - public static class Builder { - - private Addon addon; - - private Response httpResponse; - - private Builder() {} - - public Builder addon(Addon addon) { - this.addon = addon; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteAddonResponse build() { - return new DeleteAddonResponse(this); - } - } - - /** Get the addon from the response. */ - public Addon getAddon() { - return addon; - } -} diff --git a/src/main/java/com/chargebee/v4/models/addon/responses/UnarchiveForAddonResponse.java b/src/main/java/com/chargebee/v4/models/addon/responses/UnarchiveForAddonResponse.java deleted file mode 100644 index 0e99256d..00000000 --- a/src/main/java/com/chargebee/v4/models/addon/responses/UnarchiveForAddonResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.addon.responses; - -import com.chargebee.v4.models.addon.Addon; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UnarchiveForAddon operation. Contains the response data from the - * API. - */ -public final class UnarchiveForAddonResponse extends BaseResponse { - private final Addon addon; - - private UnarchiveForAddonResponse(Builder builder) { - super(builder.httpResponse); - - this.addon = builder.addon; - } - - /** Parse JSON response into UnarchiveForAddonResponse object. */ - public static UnarchiveForAddonResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UnarchiveForAddonResponse object with HTTP response. */ - public static UnarchiveForAddonResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __addonJson = JsonUtil.getObject(json, "addon"); - if (__addonJson != null) { - builder.addon(Addon.fromJson(__addonJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UnarchiveForAddonResponse from JSON", e); - } - } - - /** Create a new builder for UnarchiveForAddonResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UnarchiveForAddonResponse. */ - public static class Builder { - - private Addon addon; - - private Response httpResponse; - - private Builder() {} - - public Builder addon(Addon addon) { - this.addon = addon; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UnarchiveForAddonResponse build() { - return new UnarchiveForAddonResponse(this); - } - } - - /** Get the addon from the response. */ - public Addon getAddon() { - return addon; - } -} diff --git a/src/main/java/com/chargebee/v4/models/address/params/AddressCreateParams.java b/src/main/java/com/chargebee/v4/models/address/params/AddressCreateParams.java deleted file mode 100644 index d87c316b..00000000 --- a/src/main/java/com/chargebee/v4/models/address/params/AddressCreateParams.java +++ /dev/null @@ -1,392 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.address.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AddressCreateParams { - - private final String subscriptionId; - - private final String label; - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String addr; - - private final String extendedAddr; - - private final String extendedAddr2; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private AddressCreateParams(AddressCreateBuilder builder) { - - this.subscriptionId = builder.subscriptionId; - - this.label = builder.label; - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.addr = builder.addr; - - this.extendedAddr = builder.extendedAddr; - - this.extendedAddr2 = builder.extendedAddr2; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getSubscriptionId() { - return subscriptionId; - } - - public String getLabel() { - return label; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getAddr() { - return addr; - } - - public String getExtendedAddr() { - return extendedAddr; - } - - public String getExtendedAddr2() { - return extendedAddr2; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.subscriptionId != null) { - - formData.put("subscription_id", this.subscriptionId); - } - - if (this.label != null) { - - formData.put("label", this.label); - } - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.addr != null) { - - formData.put("addr", this.addr); - } - - if (this.extendedAddr != null) { - - formData.put("extended_addr", this.extendedAddr); - } - - if (this.extendedAddr2 != null) { - - formData.put("extended_addr2", this.extendedAddr2); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for AddressCreateParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddressCreateBuilder builder() { - return new AddressCreateBuilder(); - } - - public static final class AddressCreateBuilder { - - private String subscriptionId; - - private String label; - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String addr; - - private String extendedAddr; - - private String extendedAddr2; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private AddressCreateBuilder() {} - - public AddressCreateBuilder subscriptionId(String value) { - this.subscriptionId = value; - return this; - } - - public AddressCreateBuilder label(String value) { - this.label = value; - return this; - } - - public AddressCreateBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public AddressCreateBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public AddressCreateBuilder email(String value) { - this.email = value; - return this; - } - - public AddressCreateBuilder company(String value) { - this.company = value; - return this; - } - - public AddressCreateBuilder phone(String value) { - this.phone = value; - return this; - } - - public AddressCreateBuilder addr(String value) { - this.addr = value; - return this; - } - - public AddressCreateBuilder extendedAddr(String value) { - this.extendedAddr = value; - return this; - } - - public AddressCreateBuilder extendedAddr2(String value) { - this.extendedAddr2 = value; - return this; - } - - public AddressCreateBuilder city(String value) { - this.city = value; - return this; - } - - public AddressCreateBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public AddressCreateBuilder state(String value) { - this.state = value; - return this; - } - - public AddressCreateBuilder zip(String value) { - this.zip = value; - return this; - } - - public AddressCreateBuilder country(String value) { - this.country = value; - return this; - } - - public AddressCreateBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public AddressCreateParams build() { - return new AddressCreateParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/address/params/AddressExecuteParams.java b/src/main/java/com/chargebee/v4/models/address/params/AddressExecuteParams.java deleted file mode 100644 index efea228c..00000000 --- a/src/main/java/com/chargebee/v4/models/address/params/AddressExecuteParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.address.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AddressExecuteParams { - - private final Map queryParams; - - private AddressExecuteParams(AddressExecuteBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public AddressExecuteBuilder toBuilder() { - AddressExecuteBuilder builder = new AddressExecuteBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for AddressExecuteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddressExecuteBuilder builder() { - return new AddressExecuteBuilder(); - } - - public static final class AddressExecuteBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private AddressExecuteBuilder() {} - - public AddressExecuteBuilder subscriptionId(String value) { - queryParams.put("subscription_id", value); - return this; - } - - public AddressExecuteBuilder label(String value) { - queryParams.put("label", value); - return this; - } - - public AddressExecuteParams build() { - return new AddressExecuteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/address/params/AddressRetrieveParams.java b/src/main/java/com/chargebee/v4/models/address/params/AddressRetrieveParams.java new file mode 100644 index 00000000..f4bd43bf --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/address/params/AddressRetrieveParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.address.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class AddressRetrieveParams { + + private final Map queryParams; + + private AddressRetrieveParams(AddressRetrieveBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public AddressRetrieveBuilder toBuilder() { + AddressRetrieveBuilder builder = new AddressRetrieveBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for AddressRetrieveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddressRetrieveBuilder builder() { + return new AddressRetrieveBuilder(); + } + + public static final class AddressRetrieveBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private AddressRetrieveBuilder() {} + + public AddressRetrieveBuilder subscriptionId(String value) { + queryParams.put("subscription_id", value); + return this; + } + + public AddressRetrieveBuilder label(String value) { + queryParams.put("label", value); + return this; + } + + public AddressRetrieveParams build() { + return new AddressRetrieveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/address/params/AddressUpdateParams.java b/src/main/java/com/chargebee/v4/models/address/params/AddressUpdateParams.java new file mode 100644 index 00000000..0401d0b7 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/address/params/AddressUpdateParams.java @@ -0,0 +1,392 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.address.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class AddressUpdateParams { + + private final String subscriptionId; + + private final String label; + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String addr; + + private final String extendedAddr; + + private final String extendedAddr2; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private AddressUpdateParams(AddressUpdateBuilder builder) { + + this.subscriptionId = builder.subscriptionId; + + this.label = builder.label; + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.addr = builder.addr; + + this.extendedAddr = builder.extendedAddr; + + this.extendedAddr2 = builder.extendedAddr2; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getSubscriptionId() { + return subscriptionId; + } + + public String getLabel() { + return label; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getAddr() { + return addr; + } + + public String getExtendedAddr() { + return extendedAddr; + } + + public String getExtendedAddr2() { + return extendedAddr2; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.subscriptionId != null) { + + formData.put("subscription_id", this.subscriptionId); + } + + if (this.label != null) { + + formData.put("label", this.label); + } + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.addr != null) { + + formData.put("addr", this.addr); + } + + if (this.extendedAddr != null) { + + formData.put("extended_addr", this.extendedAddr); + } + + if (this.extendedAddr2 != null) { + + formData.put("extended_addr2", this.extendedAddr2); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for AddressUpdateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddressUpdateBuilder builder() { + return new AddressUpdateBuilder(); + } + + public static final class AddressUpdateBuilder { + + private String subscriptionId; + + private String label; + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String addr; + + private String extendedAddr; + + private String extendedAddr2; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private AddressUpdateBuilder() {} + + public AddressUpdateBuilder subscriptionId(String value) { + this.subscriptionId = value; + return this; + } + + public AddressUpdateBuilder label(String value) { + this.label = value; + return this; + } + + public AddressUpdateBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public AddressUpdateBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public AddressUpdateBuilder email(String value) { + this.email = value; + return this; + } + + public AddressUpdateBuilder company(String value) { + this.company = value; + return this; + } + + public AddressUpdateBuilder phone(String value) { + this.phone = value; + return this; + } + + public AddressUpdateBuilder addr(String value) { + this.addr = value; + return this; + } + + public AddressUpdateBuilder extendedAddr(String value) { + this.extendedAddr = value; + return this; + } + + public AddressUpdateBuilder extendedAddr2(String value) { + this.extendedAddr2 = value; + return this; + } + + public AddressUpdateBuilder city(String value) { + this.city = value; + return this; + } + + public AddressUpdateBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public AddressUpdateBuilder state(String value) { + this.state = value; + return this; + } + + public AddressUpdateBuilder zip(String value) { + this.zip = value; + return this; + } + + public AddressUpdateBuilder country(String value) { + this.country = value; + return this; + } + + public AddressUpdateBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public AddressUpdateParams build() { + return new AddressUpdateParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/address/responses/AddressCreateResponse.java b/src/main/java/com/chargebee/v4/models/address/responses/AddressCreateResponse.java deleted file mode 100644 index 1a653bb0..00000000 --- a/src/main/java/com/chargebee/v4/models/address/responses/AddressCreateResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.address.responses; - -import com.chargebee.v4.models.address.Address; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddressCreate operation. Contains the response data from the API. - */ -public final class AddressCreateResponse extends BaseResponse { - private final Address address; - - private AddressCreateResponse(Builder builder) { - super(builder.httpResponse); - - this.address = builder.address; - } - - /** Parse JSON response into AddressCreateResponse object. */ - public static AddressCreateResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddressCreateResponse object with HTTP response. */ - public static AddressCreateResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __addressJson = JsonUtil.getObject(json, "address"); - if (__addressJson != null) { - builder.address(Address.fromJson(__addressJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddressCreateResponse from JSON", e); - } - } - - /** Create a new builder for AddressCreateResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddressCreateResponse. */ - public static class Builder { - - private Address address; - - private Response httpResponse; - - private Builder() {} - - public Builder address(Address address) { - this.address = address; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddressCreateResponse build() { - return new AddressCreateResponse(this); - } - } - - /** Get the address from the response. */ - public Address getAddress() { - return address; - } -} diff --git a/src/main/java/com/chargebee/v4/models/address/responses/AddressExecuteResponse.java b/src/main/java/com/chargebee/v4/models/address/responses/AddressExecuteResponse.java deleted file mode 100644 index 55cafcf7..00000000 --- a/src/main/java/com/chargebee/v4/models/address/responses/AddressExecuteResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.address.responses; - -import com.chargebee.v4.models.address.Address; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddressExecute operation. Contains the response data from a single - * resource get operation. - */ -public final class AddressExecuteResponse extends BaseResponse { - private final Address address; - - private AddressExecuteResponse(Builder builder) { - super(builder.httpResponse); - - this.address = builder.address; - } - - /** Parse JSON response into AddressExecuteResponse object. */ - public static AddressExecuteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddressExecuteResponse object with HTTP response. */ - public static AddressExecuteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __addressJson = JsonUtil.getObject(json, "address"); - if (__addressJson != null) { - builder.address(Address.fromJson(__addressJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddressExecuteResponse from JSON", e); - } - } - - /** Create a new builder for AddressExecuteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddressExecuteResponse. */ - public static class Builder { - - private Address address; - - private Response httpResponse; - - private Builder() {} - - public Builder address(Address address) { - this.address = address; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddressExecuteResponse build() { - return new AddressExecuteResponse(this); - } - } - - /** Get the address from the response. */ - public Address getAddress() { - return address; - } -} diff --git a/src/main/java/com/chargebee/v4/models/address/responses/AddressRetrieveResponse.java b/src/main/java/com/chargebee/v4/models/address/responses/AddressRetrieveResponse.java new file mode 100644 index 00000000..e945c6a9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/address/responses/AddressRetrieveResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.address.responses; + +import com.chargebee.v4.models.address.Address; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for AddressRetrieve operation. Contains the response data from a single + * resource get operation. + */ +public final class AddressRetrieveResponse extends BaseResponse { + private final Address address; + + private AddressRetrieveResponse(Builder builder) { + super(builder.httpResponse); + + this.address = builder.address; + } + + /** Parse JSON response into AddressRetrieveResponse object. */ + public static AddressRetrieveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into AddressRetrieveResponse object with HTTP response. */ + public static AddressRetrieveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __addressJson = JsonUtil.getObject(json, "address"); + if (__addressJson != null) { + builder.address(Address.fromJson(__addressJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse AddressRetrieveResponse from JSON", e); + } + } + + /** Create a new builder for AddressRetrieveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for AddressRetrieveResponse. */ + public static class Builder { + + private Address address; + + private Response httpResponse; + + private Builder() {} + + public Builder address(Address address) { + this.address = address; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public AddressRetrieveResponse build() { + return new AddressRetrieveResponse(this); + } + } + + /** Get the address from the response. */ + public Address getAddress() { + return address; + } +} diff --git a/src/main/java/com/chargebee/v4/models/address/responses/AddressUpdateResponse.java b/src/main/java/com/chargebee/v4/models/address/responses/AddressUpdateResponse.java new file mode 100644 index 00000000..e4dc4635 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/address/responses/AddressUpdateResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.address.responses; + +import com.chargebee.v4.models.address.Address; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for AddressUpdate operation. Contains the response data from the API. + */ +public final class AddressUpdateResponse extends BaseResponse { + private final Address address; + + private AddressUpdateResponse(Builder builder) { + super(builder.httpResponse); + + this.address = builder.address; + } + + /** Parse JSON response into AddressUpdateResponse object. */ + public static AddressUpdateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into AddressUpdateResponse object with HTTP response. */ + public static AddressUpdateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __addressJson = JsonUtil.getObject(json, "address"); + if (__addressJson != null) { + builder.address(Address.fromJson(__addressJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse AddressUpdateResponse from JSON", e); + } + } + + /** Create a new builder for AddressUpdateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for AddressUpdateResponse. */ + public static class Builder { + + private Address address; + + private Response httpResponse; + + private Builder() {} + + public Builder address(Address address) { + this.address = address; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public AddressUpdateResponse build() { + return new AddressUpdateResponse(this); + } + } + + /** Get the address from the response. */ + public Address getAddress() { + return address; + } +} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/params/AddAttachedItemForItemParams.java b/src/main/java/com/chargebee/v4/models/attachedItem/params/AddAttachedItemForItemParams.java deleted file mode 100644 index 46ae0dc7..00000000 --- a/src/main/java/com/chargebee/v4/models/attachedItem/params/AddAttachedItemForItemParams.java +++ /dev/null @@ -1,266 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.attachedItem.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AddAttachedItemForItemParams { - - private final String itemId; - - private final Type type; - - private final Integer billingCycles; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final String businessEntityId; - - private AddAttachedItemForItemParams(AddAttachedItemForItemBuilder builder) { - - this.itemId = builder.itemId; - - this.type = builder.type; - - this.billingCycles = builder.billingCycles; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.businessEntityId = builder.businessEntityId; - } - - public String getItemId() { - return itemId; - } - - public Type getType() { - return type; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public String getBusinessEntityId() { - return businessEntityId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemId != null) { - - formData.put("item_id", this.itemId); - } - - if (this.type != null) { - - formData.put("type", this.type); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.businessEntityId != null) { - - formData.put("business_entity_id", this.businessEntityId); - } - - return formData; - } - - /** Create a new builder for AddAttachedItemForItemParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddAttachedItemForItemBuilder builder() { - return new AddAttachedItemForItemBuilder(); - } - - public static final class AddAttachedItemForItemBuilder { - - private String itemId; - - private Type type; - - private Integer billingCycles; - - private Integer quantity; - - private String quantityInDecimal; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private String businessEntityId; - - private AddAttachedItemForItemBuilder() {} - - public AddAttachedItemForItemBuilder itemId(String value) { - this.itemId = value; - return this; - } - - public AddAttachedItemForItemBuilder type(Type value) { - this.type = value; - return this; - } - - public AddAttachedItemForItemBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public AddAttachedItemForItemBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public AddAttachedItemForItemBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public AddAttachedItemForItemBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public AddAttachedItemForItemBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public AddAttachedItemForItemBuilder businessEntityId(String value) { - this.businessEntityId = value; - return this; - } - - public AddAttachedItemForItemParams build() { - return new AddAttachedItemForItemParams(this); - } - } - - public enum Type { - RECOMMENDED("recommended"), - - MANDATORY("mandatory"), - - OPTIONAL("optional"), - - /** An enum member indicating that Type was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Type(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Type fromString(String value) { - if (value == null) return _UNKNOWN; - for (Type enumValue : Type.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - ON_DEMAND("on_demand"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemCreateParams.java b/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemCreateParams.java new file mode 100644 index 00000000..4ac02431 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemCreateParams.java @@ -0,0 +1,266 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.attachedItem.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class AttachedItemCreateParams { + + private final String itemId; + + private final Type type; + + private final Integer billingCycles; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final String businessEntityId; + + private AttachedItemCreateParams(AttachedItemCreateBuilder builder) { + + this.itemId = builder.itemId; + + this.type = builder.type; + + this.billingCycles = builder.billingCycles; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.businessEntityId = builder.businessEntityId; + } + + public String getItemId() { + return itemId; + } + + public Type getType() { + return type; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public String getBusinessEntityId() { + return businessEntityId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemId != null) { + + formData.put("item_id", this.itemId); + } + + if (this.type != null) { + + formData.put("type", this.type); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.businessEntityId != null) { + + formData.put("business_entity_id", this.businessEntityId); + } + + return formData; + } + + /** Create a new builder for AttachedItemCreateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AttachedItemCreateBuilder builder() { + return new AttachedItemCreateBuilder(); + } + + public static final class AttachedItemCreateBuilder { + + private String itemId; + + private Type type; + + private Integer billingCycles; + + private Integer quantity; + + private String quantityInDecimal; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private String businessEntityId; + + private AttachedItemCreateBuilder() {} + + public AttachedItemCreateBuilder itemId(String value) { + this.itemId = value; + return this; + } + + public AttachedItemCreateBuilder type(Type value) { + this.type = value; + return this; + } + + public AttachedItemCreateBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public AttachedItemCreateBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public AttachedItemCreateBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public AttachedItemCreateBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public AttachedItemCreateBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public AttachedItemCreateBuilder businessEntityId(String value) { + this.businessEntityId = value; + return this; + } + + public AttachedItemCreateParams build() { + return new AttachedItemCreateParams(this); + } + } + + public enum Type { + RECOMMENDED("recommended"), + + MANDATORY("mandatory"), + + OPTIONAL("optional"), + + /** An enum member indicating that Type was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Type(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Type fromString(String value) { + if (value == null) return _UNKNOWN; + for (Type enumValue : Type.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + ON_DEMAND("on_demand"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemDeleteParams.java b/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemDeleteParams.java new file mode 100644 index 00000000..95906225 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemDeleteParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.attachedItem.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class AttachedItemDeleteParams { + + private final String parentItemId; + + private AttachedItemDeleteParams(AttachedItemDeleteBuilder builder) { + + this.parentItemId = builder.parentItemId; + } + + public String getParentItemId() { + return parentItemId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.parentItemId != null) { + + formData.put("parent_item_id", this.parentItemId); + } + + return formData; + } + + /** Create a new builder for AttachedItemDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AttachedItemDeleteBuilder builder() { + return new AttachedItemDeleteBuilder(); + } + + public static final class AttachedItemDeleteBuilder { + + private String parentItemId; + + private AttachedItemDeleteBuilder() {} + + public AttachedItemDeleteBuilder parentItemId(String value) { + this.parentItemId = value; + return this; + } + + public AttachedItemDeleteParams build() { + return new AttachedItemDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemListParams.java b/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemListParams.java new file mode 100644 index 00000000..e2cbd5b2 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemListParams.java @@ -0,0 +1,469 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.attachedItem.params; + +import com.chargebee.v4.internal.Recommended; + +import java.sql.Timestamp; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class AttachedItemListParams { + + private final Map queryParams; + + private AttachedItemListParams(AttachedItemListBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public AttachedItemListBuilder toBuilder() { + AttachedItemListBuilder builder = new AttachedItemListBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for AttachedItemListParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AttachedItemListBuilder builder() { + return new AttachedItemListBuilder(); + } + + public static final class AttachedItemListBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private AttachedItemListBuilder() {} + + public AttachedItemListBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public AttachedItemListBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + public IdFilter id() { + return new IdFilter("id", this); + } + + public ItemIdFilter itemId() { + return new ItemIdFilter("item_id", this); + } + + public TypeFilter type() { + return new TypeFilter("type", this); + } + + public ItemTypeFilter itemType() { + return new ItemTypeFilter("item_type", this); + } + + public ChargeOnEventFilter chargeOnEvent() { + return new ChargeOnEventFilter("charge_on_event", this); + } + + public UpdatedAtFilter updatedAt() { + return new UpdatedAtFilter("updated_at", this); + } + + public AttachedItemListParams build() { + return new AttachedItemListParams(this); + } + + public static final class IdFilter { + private final String fieldName; + private final AttachedItemListBuilder builder; + + IdFilter(String fieldName, AttachedItemListBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public AttachedItemListBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + + public AttachedItemListBuilder isNot(String value) { + builder.queryParams.put(fieldName + "[is_not]", value); + return builder; + } + + public AttachedItemListBuilder startsWith(String value) { + builder.queryParams.put(fieldName + "[starts_with]", value); + return builder; + } + + public AttachedItemListBuilder in(String... values) { + builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); + return builder; + } + + public AttachedItemListBuilder notIn(String... values) { + builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); + return builder; + } + } + + public static final class ItemIdFilter { + private final String fieldName; + private final AttachedItemListBuilder builder; + + ItemIdFilter(String fieldName, AttachedItemListBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public AttachedItemListBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + + public AttachedItemListBuilder isNot(String value) { + builder.queryParams.put(fieldName + "[is_not]", value); + return builder; + } + + public AttachedItemListBuilder startsWith(String value) { + builder.queryParams.put(fieldName + "[starts_with]", value); + return builder; + } + + public AttachedItemListBuilder in(String... values) { + builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); + return builder; + } + + public AttachedItemListBuilder notIn(String... values) { + builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); + return builder; + } + } + + public static final class TypeFilter { + private final String fieldName; + private final AttachedItemListBuilder builder; + + TypeFilter(String fieldName, AttachedItemListBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public AttachedItemListBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + + public AttachedItemListBuilder isNot(String value) { + builder.queryParams.put(fieldName + "[is_not]", value); + return builder; + } + + public AttachedItemListBuilder in(String... values) { + builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); + return builder; + } + + public AttachedItemListBuilder notIn(String... values) { + builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); + return builder; + } + } + + public static final class ItemTypeFilter { + private final String fieldName; + private final AttachedItemListBuilder builder; + + ItemTypeFilter(String fieldName, AttachedItemListBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public AttachedItemListBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + + public AttachedItemListBuilder isNot(String value) { + builder.queryParams.put(fieldName + "[is_not]", value); + return builder; + } + + public AttachedItemListBuilder in(String... values) { + builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); + return builder; + } + + public AttachedItemListBuilder notIn(String... values) { + builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); + return builder; + } + } + + public static final class ChargeOnEventFilter { + private final String fieldName; + private final AttachedItemListBuilder builder; + + ChargeOnEventFilter(String fieldName, AttachedItemListBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public AttachedItemListBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + + public AttachedItemListBuilder isNot(String value) { + builder.queryParams.put(fieldName + "[is_not]", value); + return builder; + } + + public AttachedItemListBuilder in(String... values) { + builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); + return builder; + } + + public AttachedItemListBuilder notIn(String... values) { + builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); + return builder; + } + } + + public static final class UpdatedAtFilter { + private final String fieldName; + private final AttachedItemListBuilder builder; + + UpdatedAtFilter(String fieldName, AttachedItemListBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public AttachedItemListBuilder after(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[after]", timestamp.getTime() / 1000); + return builder; + } + + public AttachedItemListBuilder before(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[before]", timestamp.getTime() / 1000); + return builder; + } + + public AttachedItemListBuilder on(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[on]", timestamp.getTime() / 1000); + return builder; + } + + public AttachedItemListBuilder between(Timestamp start, Timestamp end) { + builder.queryParams.put( + fieldName + "[between]", + "[" + (start.getTime() / 1000) + "," + (end.getTime() / 1000) + "]"); + return builder; + } + } + } + + public enum TypeIs { + RECOMMENDED("recommended"), + + MANDATORY("mandatory"), + + OPTIONAL("optional"), + + /** An enum member indicating that TypeIs was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + TypeIs(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static TypeIs fromString(String value) { + if (value == null) return _UNKNOWN; + for (TypeIs enumValue : TypeIs.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum TypeIsNot { + RECOMMENDED("recommended"), + + MANDATORY("mandatory"), + + OPTIONAL("optional"), + + /** An enum member indicating that TypeIsNot was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + TypeIsNot(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static TypeIsNot fromString(String value) { + if (value == null) return _UNKNOWN; + for (TypeIsNot enumValue : TypeIsNot.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ItemTypeIs { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemTypeIs was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemTypeIs(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemTypeIs fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemTypeIs enumValue : ItemTypeIs.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ItemTypeIsNot { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemTypeIsNot was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemTypeIsNot(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemTypeIsNot fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemTypeIsNot enumValue : ItemTypeIsNot.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnEventIs { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + ON_DEMAND("on_demand"), + + /** An enum member indicating that ChargeOnEventIs was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEventIs(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEventIs fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEventIs enumValue : ChargeOnEventIs.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnEventIsNot { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + ON_DEMAND("on_demand"), + + /** An enum member indicating that ChargeOnEventIsNot was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEventIsNot(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEventIsNot fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEventIsNot enumValue : ChargeOnEventIsNot.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemsForItemParams.java b/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemsForItemParams.java deleted file mode 100644 index 8b57564e..00000000 --- a/src/main/java/com/chargebee/v4/models/attachedItem/params/AttachedItemsForItemParams.java +++ /dev/null @@ -1,469 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.attachedItem.params; - -import com.chargebee.v4.internal.Recommended; - -import java.sql.Timestamp; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AttachedItemsForItemParams { - - private final Map queryParams; - - private AttachedItemsForItemParams(AttachedItemsForItemBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public AttachedItemsForItemBuilder toBuilder() { - AttachedItemsForItemBuilder builder = new AttachedItemsForItemBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for AttachedItemsForItemParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AttachedItemsForItemBuilder builder() { - return new AttachedItemsForItemBuilder(); - } - - public static final class AttachedItemsForItemBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private AttachedItemsForItemBuilder() {} - - public AttachedItemsForItemBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public AttachedItemsForItemBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - public IdFilter id() { - return new IdFilter("id", this); - } - - public ItemIdFilter itemId() { - return new ItemIdFilter("item_id", this); - } - - public TypeFilter type() { - return new TypeFilter("type", this); - } - - public ItemTypeFilter itemType() { - return new ItemTypeFilter("item_type", this); - } - - public ChargeOnEventFilter chargeOnEvent() { - return new ChargeOnEventFilter("charge_on_event", this); - } - - public UpdatedAtFilter updatedAt() { - return new UpdatedAtFilter("updated_at", this); - } - - public AttachedItemsForItemParams build() { - return new AttachedItemsForItemParams(this); - } - - public static final class IdFilter { - private final String fieldName; - private final AttachedItemsForItemBuilder builder; - - IdFilter(String fieldName, AttachedItemsForItemBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public AttachedItemsForItemBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - - public AttachedItemsForItemBuilder isNot(String value) { - builder.queryParams.put(fieldName + "[is_not]", value); - return builder; - } - - public AttachedItemsForItemBuilder startsWith(String value) { - builder.queryParams.put(fieldName + "[starts_with]", value); - return builder; - } - - public AttachedItemsForItemBuilder in(String... values) { - builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); - return builder; - } - - public AttachedItemsForItemBuilder notIn(String... values) { - builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); - return builder; - } - } - - public static final class ItemIdFilter { - private final String fieldName; - private final AttachedItemsForItemBuilder builder; - - ItemIdFilter(String fieldName, AttachedItemsForItemBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public AttachedItemsForItemBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - - public AttachedItemsForItemBuilder isNot(String value) { - builder.queryParams.put(fieldName + "[is_not]", value); - return builder; - } - - public AttachedItemsForItemBuilder startsWith(String value) { - builder.queryParams.put(fieldName + "[starts_with]", value); - return builder; - } - - public AttachedItemsForItemBuilder in(String... values) { - builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); - return builder; - } - - public AttachedItemsForItemBuilder notIn(String... values) { - builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); - return builder; - } - } - - public static final class TypeFilter { - private final String fieldName; - private final AttachedItemsForItemBuilder builder; - - TypeFilter(String fieldName, AttachedItemsForItemBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public AttachedItemsForItemBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - - public AttachedItemsForItemBuilder isNot(String value) { - builder.queryParams.put(fieldName + "[is_not]", value); - return builder; - } - - public AttachedItemsForItemBuilder in(String... values) { - builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); - return builder; - } - - public AttachedItemsForItemBuilder notIn(String... values) { - builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); - return builder; - } - } - - public static final class ItemTypeFilter { - private final String fieldName; - private final AttachedItemsForItemBuilder builder; - - ItemTypeFilter(String fieldName, AttachedItemsForItemBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public AttachedItemsForItemBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - - public AttachedItemsForItemBuilder isNot(String value) { - builder.queryParams.put(fieldName + "[is_not]", value); - return builder; - } - - public AttachedItemsForItemBuilder in(String... values) { - builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); - return builder; - } - - public AttachedItemsForItemBuilder notIn(String... values) { - builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); - return builder; - } - } - - public static final class ChargeOnEventFilter { - private final String fieldName; - private final AttachedItemsForItemBuilder builder; - - ChargeOnEventFilter(String fieldName, AttachedItemsForItemBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public AttachedItemsForItemBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - - public AttachedItemsForItemBuilder isNot(String value) { - builder.queryParams.put(fieldName + "[is_not]", value); - return builder; - } - - public AttachedItemsForItemBuilder in(String... values) { - builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); - return builder; - } - - public AttachedItemsForItemBuilder notIn(String... values) { - builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); - return builder; - } - } - - public static final class UpdatedAtFilter { - private final String fieldName; - private final AttachedItemsForItemBuilder builder; - - UpdatedAtFilter(String fieldName, AttachedItemsForItemBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public AttachedItemsForItemBuilder after(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[after]", timestamp.getTime() / 1000); - return builder; - } - - public AttachedItemsForItemBuilder before(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[before]", timestamp.getTime() / 1000); - return builder; - } - - public AttachedItemsForItemBuilder on(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[on]", timestamp.getTime() / 1000); - return builder; - } - - public AttachedItemsForItemBuilder between(Timestamp start, Timestamp end) { - builder.queryParams.put( - fieldName + "[between]", - "[" + (start.getTime() / 1000) + "," + (end.getTime() / 1000) + "]"); - return builder; - } - } - } - - public enum TypeIs { - RECOMMENDED("recommended"), - - MANDATORY("mandatory"), - - OPTIONAL("optional"), - - /** An enum member indicating that TypeIs was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - TypeIs(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static TypeIs fromString(String value) { - if (value == null) return _UNKNOWN; - for (TypeIs enumValue : TypeIs.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum TypeIsNot { - RECOMMENDED("recommended"), - - MANDATORY("mandatory"), - - OPTIONAL("optional"), - - /** An enum member indicating that TypeIsNot was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - TypeIsNot(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static TypeIsNot fromString(String value) { - if (value == null) return _UNKNOWN; - for (TypeIsNot enumValue : TypeIsNot.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ItemTypeIs { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemTypeIs was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemTypeIs(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemTypeIs fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemTypeIs enumValue : ItemTypeIs.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ItemTypeIsNot { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemTypeIsNot was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemTypeIsNot(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemTypeIsNot fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemTypeIsNot enumValue : ItemTypeIsNot.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnEventIs { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - ON_DEMAND("on_demand"), - - /** An enum member indicating that ChargeOnEventIs was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEventIs(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEventIs fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEventIs enumValue : ChargeOnEventIs.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnEventIsNot { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - ON_DEMAND("on_demand"), - - /** An enum member indicating that ChargeOnEventIsNot was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEventIsNot(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEventIsNot fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEventIsNot enumValue : ChargeOnEventIsNot.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/params/DeleteAttachedItemParams.java b/src/main/java/com/chargebee/v4/models/attachedItem/params/DeleteAttachedItemParams.java deleted file mode 100644 index fdf6eaab..00000000 --- a/src/main/java/com/chargebee/v4/models/attachedItem/params/DeleteAttachedItemParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.attachedItem.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteAttachedItemParams { - - private final String parentItemId; - - private DeleteAttachedItemParams(DeleteAttachedItemBuilder builder) { - - this.parentItemId = builder.parentItemId; - } - - public String getParentItemId() { - return parentItemId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.parentItemId != null) { - - formData.put("parent_item_id", this.parentItemId); - } - - return formData; - } - - /** Create a new builder for DeleteAttachedItemParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteAttachedItemBuilder builder() { - return new DeleteAttachedItemBuilder(); - } - - public static final class DeleteAttachedItemBuilder { - - private String parentItemId; - - private DeleteAttachedItemBuilder() {} - - public DeleteAttachedItemBuilder parentItemId(String value) { - this.parentItemId = value; - return this; - } - - public DeleteAttachedItemParams build() { - return new DeleteAttachedItemParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/responses/AddAttachedItemForItemResponse.java b/src/main/java/com/chargebee/v4/models/attachedItem/responses/AddAttachedItemForItemResponse.java deleted file mode 100644 index d062d11c..00000000 --- a/src/main/java/com/chargebee/v4/models/attachedItem/responses/AddAttachedItemForItemResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.attachedItem.responses; - -import com.chargebee.v4.models.attachedItem.AttachedItem; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddAttachedItemForItem operation. Contains the response data from - * the API. - */ -public final class AddAttachedItemForItemResponse extends BaseResponse { - private final AttachedItem attachedItem; - - private AddAttachedItemForItemResponse(Builder builder) { - super(builder.httpResponse); - - this.attachedItem = builder.attachedItem; - } - - /** Parse JSON response into AddAttachedItemForItemResponse object. */ - public static AddAttachedItemForItemResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddAttachedItemForItemResponse object with HTTP response. */ - public static AddAttachedItemForItemResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __attachedItemJson = JsonUtil.getObject(json, "attached_item"); - if (__attachedItemJson != null) { - builder.attachedItem(AttachedItem.fromJson(__attachedItemJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddAttachedItemForItemResponse from JSON", e); - } - } - - /** Create a new builder for AddAttachedItemForItemResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddAttachedItemForItemResponse. */ - public static class Builder { - - private AttachedItem attachedItem; - - private Response httpResponse; - - private Builder() {} - - public Builder attachedItem(AttachedItem attachedItem) { - this.attachedItem = attachedItem; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddAttachedItemForItemResponse build() { - return new AddAttachedItemForItemResponse(this); - } - } - - /** Get the attachedItem from the response. */ - public AttachedItem getAttachedItem() { - return attachedItem; - } -} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemCreateResponse.java b/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemCreateResponse.java new file mode 100644 index 00000000..917e8274 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemCreateResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.attachedItem.responses; + +import com.chargebee.v4.models.attachedItem.AttachedItem; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for AttachedItemCreate operation. Contains the response data from the + * API. + */ +public final class AttachedItemCreateResponse extends BaseResponse { + private final AttachedItem attachedItem; + + private AttachedItemCreateResponse(Builder builder) { + super(builder.httpResponse); + + this.attachedItem = builder.attachedItem; + } + + /** Parse JSON response into AttachedItemCreateResponse object. */ + public static AttachedItemCreateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into AttachedItemCreateResponse object with HTTP response. */ + public static AttachedItemCreateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __attachedItemJson = JsonUtil.getObject(json, "attached_item"); + if (__attachedItemJson != null) { + builder.attachedItem(AttachedItem.fromJson(__attachedItemJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse AttachedItemCreateResponse from JSON", e); + } + } + + /** Create a new builder for AttachedItemCreateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for AttachedItemCreateResponse. */ + public static class Builder { + + private AttachedItem attachedItem; + + private Response httpResponse; + + private Builder() {} + + public Builder attachedItem(AttachedItem attachedItem) { + this.attachedItem = attachedItem; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public AttachedItemCreateResponse build() { + return new AttachedItemCreateResponse(this); + } + } + + /** Get the attachedItem from the response. */ + public AttachedItem getAttachedItem() { + return attachedItem; + } +} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemDeleteResponse.java b/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemDeleteResponse.java new file mode 100644 index 00000000..7b3c9e64 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemDeleteResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.attachedItem.responses; + +import com.chargebee.v4.models.attachedItem.AttachedItem; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for AttachedItemDelete operation. Contains the response data from the + * API. + */ +public final class AttachedItemDeleteResponse extends BaseResponse { + private final AttachedItem attachedItem; + + private AttachedItemDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.attachedItem = builder.attachedItem; + } + + /** Parse JSON response into AttachedItemDeleteResponse object. */ + public static AttachedItemDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into AttachedItemDeleteResponse object with HTTP response. */ + public static AttachedItemDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __attachedItemJson = JsonUtil.getObject(json, "attached_item"); + if (__attachedItemJson != null) { + builder.attachedItem(AttachedItem.fromJson(__attachedItemJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse AttachedItemDeleteResponse from JSON", e); + } + } + + /** Create a new builder for AttachedItemDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for AttachedItemDeleteResponse. */ + public static class Builder { + + private AttachedItem attachedItem; + + private Response httpResponse; + + private Builder() {} + + public Builder attachedItem(AttachedItem attachedItem) { + this.attachedItem = attachedItem; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public AttachedItemDeleteResponse build() { + return new AttachedItemDeleteResponse(this); + } + } + + /** Get the attachedItem from the response. */ + public AttachedItem getAttachedItem() { + return attachedItem; + } +} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemListResponse.java b/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemListResponse.java new file mode 100644 index 00000000..fd34422a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemListResponse.java @@ -0,0 +1,172 @@ +package com.chargebee.v4.models.attachedItem.responses; + +import java.util.List; + +import com.chargebee.v4.models.attachedItem.AttachedItem; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.AttachedItemService; +import com.chargebee.v4.models.attachedItem.params.AttachedItemListParams; + +/** Immutable response object for AttachedItemList operation. Contains paginated list data. */ +public final class AttachedItemListResponse { + + private final List list; + + private final String nextOffset; + + private final String itemId; + + private final AttachedItemService service; + private final AttachedItemListParams originalParams; + private final Response httpResponse; + + private AttachedItemListResponse( + List list, + String nextOffset, + String itemId, + AttachedItemService service, + AttachedItemListParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.itemId = itemId; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into AttachedItemListResponse object (no service context). Use this when + * you only need to read a single page (no nextPage()). + */ + public static AttachedItemListResponse fromJson(String json) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(AttachedItemListItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new AttachedItemListResponse(list, nextOffset, null, null, null, null); + } catch (Exception e) { + throw new RuntimeException("Failed to parse AttachedItemListResponse from JSON", e); + } + } + + /** + * Parse JSON response into AttachedItemListResponse object with service context for pagination + * (enables nextPage()). + */ + public static AttachedItemListResponse fromJson( + String json, + AttachedItemService service, + AttachedItemListParams originalParams, + String itemId, + Response httpResponse) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(AttachedItemListItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new AttachedItemListResponse( + list, nextOffset, itemId, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException("Failed to parse AttachedItemListResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public AttachedItemListResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + AttachedItemListParams nextParams = + (originalParams != null ? originalParams.toBuilder() : AttachedItemListParams.builder()) + .offset(nextOffset) + .build(); + + return service.list(itemId, nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + public static class AttachedItemListItem { + + private AttachedItem attachedItem; + + public AttachedItem getAttachedItem() { + return attachedItem; + } + + public static AttachedItemListItem fromJson(String json) { + AttachedItemListItem item = new AttachedItemListItem(); + + String __attachedItemJson = JsonUtil.getObject(json, "attached_item"); + if (__attachedItemJson != null) { + item.attachedItem = AttachedItem.fromJson(__attachedItemJson); + } + + return item; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemsForItemResponse.java b/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemsForItemResponse.java deleted file mode 100644 index f46b0bfc..00000000 --- a/src/main/java/com/chargebee/v4/models/attachedItem/responses/AttachedItemsForItemResponse.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.chargebee.v4.models.attachedItem.responses; - -import java.util.List; - -import com.chargebee.v4.models.attachedItem.AttachedItem; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.AttachedItemService; -import com.chargebee.v4.models.attachedItem.params.AttachedItemsForItemParams; - -/** Immutable response object for AttachedItemsForItem operation. Contains paginated list data. */ -public final class AttachedItemsForItemResponse { - - private final List list; - - private final String nextOffset; - - private final String itemId; - - private final AttachedItemService service; - private final AttachedItemsForItemParams originalParams; - private final Response httpResponse; - - private AttachedItemsForItemResponse( - List list, - String nextOffset, - String itemId, - AttachedItemService service, - AttachedItemsForItemParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.itemId = itemId; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into AttachedItemsForItemResponse object (no service context). Use this - * when you only need to read a single page (no nextPage()). - */ - public static AttachedItemsForItemResponse fromJson(String json) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(AttachedItemAttachedItemsForItemItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new AttachedItemsForItemResponse(list, nextOffset, null, null, null, null); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AttachedItemsForItemResponse from JSON", e); - } - } - - /** - * Parse JSON response into AttachedItemsForItemResponse object with service context for - * pagination (enables nextPage()). - */ - public static AttachedItemsForItemResponse fromJson( - String json, - AttachedItemService service, - AttachedItemsForItemParams originalParams, - String itemId, - Response httpResponse) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(AttachedItemAttachedItemsForItemItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new AttachedItemsForItemResponse( - list, nextOffset, itemId, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AttachedItemsForItemResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public AttachedItemsForItemResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - AttachedItemsForItemParams nextParams = - (originalParams != null ? originalParams.toBuilder() : AttachedItemsForItemParams.builder()) - .offset(nextOffset) - .build(); - - return service.attachedItemsForItem(itemId, nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } - - public static class AttachedItemAttachedItemsForItemItem { - - private AttachedItem attachedItem; - - public AttachedItem getAttachedItem() { - return attachedItem; - } - - public static AttachedItemAttachedItemsForItemItem fromJson(String json) { - AttachedItemAttachedItemsForItemItem item = new AttachedItemAttachedItemsForItemItem(); - - String __attachedItemJson = JsonUtil.getObject(json, "attached_item"); - if (__attachedItemJson != null) { - item.attachedItem = AttachedItem.fromJson(__attachedItemJson); - } - - return item; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/attachedItem/responses/DeleteAttachedItemResponse.java b/src/main/java/com/chargebee/v4/models/attachedItem/responses/DeleteAttachedItemResponse.java deleted file mode 100644 index d8d835dc..00000000 --- a/src/main/java/com/chargebee/v4/models/attachedItem/responses/DeleteAttachedItemResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.attachedItem.responses; - -import com.chargebee.v4.models.attachedItem.AttachedItem; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteAttachedItem operation. Contains the response data from the - * API. - */ -public final class DeleteAttachedItemResponse extends BaseResponse { - private final AttachedItem attachedItem; - - private DeleteAttachedItemResponse(Builder builder) { - super(builder.httpResponse); - - this.attachedItem = builder.attachedItem; - } - - /** Parse JSON response into DeleteAttachedItemResponse object. */ - public static DeleteAttachedItemResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteAttachedItemResponse object with HTTP response. */ - public static DeleteAttachedItemResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __attachedItemJson = JsonUtil.getObject(json, "attached_item"); - if (__attachedItemJson != null) { - builder.attachedItem(AttachedItem.fromJson(__attachedItemJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteAttachedItemResponse from JSON", e); - } - } - - /** Create a new builder for DeleteAttachedItemResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteAttachedItemResponse. */ - public static class Builder { - - private AttachedItem attachedItem; - - private Response httpResponse; - - private Builder() {} - - public Builder attachedItem(AttachedItem attachedItem) { - this.attachedItem = attachedItem; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteAttachedItemResponse build() { - return new DeleteAttachedItemResponse(this); - } - } - - /** Get the attachedItem from the response. */ - public AttachedItem getAttachedItem() { - return attachedItem; - } -} diff --git a/src/main/java/com/chargebee/v4/models/brandConfiguration/params/BrandConfigurationExecuteParams.java b/src/main/java/com/chargebee/v4/models/brandConfiguration/params/BrandConfigurationExecuteParams.java deleted file mode 100644 index 26bd3a4d..00000000 --- a/src/main/java/com/chargebee/v4/models/brandConfiguration/params/BrandConfigurationExecuteParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.brandConfiguration.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class BrandConfigurationExecuteParams { - - private final Map queryParams; - - private BrandConfigurationExecuteParams(BrandConfigurationExecuteBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public BrandConfigurationExecuteBuilder toBuilder() { - BrandConfigurationExecuteBuilder builder = new BrandConfigurationExecuteBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for BrandConfigurationExecuteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BrandConfigurationExecuteBuilder builder() { - return new BrandConfigurationExecuteBuilder(); - } - - public static final class BrandConfigurationExecuteBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private BrandConfigurationExecuteBuilder() {} - - public BrandConfigurationExecuteParams build() { - return new BrandConfigurationExecuteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/brandConfiguration/params/BrandConfigurationRetrieveParams.java b/src/main/java/com/chargebee/v4/models/brandConfiguration/params/BrandConfigurationRetrieveParams.java new file mode 100644 index 00000000..dfeeec97 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/brandConfiguration/params/BrandConfigurationRetrieveParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.brandConfiguration.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class BrandConfigurationRetrieveParams { + + private final Map queryParams; + + private BrandConfigurationRetrieveParams(BrandConfigurationRetrieveBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public BrandConfigurationRetrieveBuilder toBuilder() { + BrandConfigurationRetrieveBuilder builder = new BrandConfigurationRetrieveBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for BrandConfigurationRetrieveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BrandConfigurationRetrieveBuilder builder() { + return new BrandConfigurationRetrieveBuilder(); + } + + public static final class BrandConfigurationRetrieveBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private BrandConfigurationRetrieveBuilder() {} + + public BrandConfigurationRetrieveParams build() { + return new BrandConfigurationRetrieveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/brandConfiguration/responses/BrandConfigurationExecuteResponse.java b/src/main/java/com/chargebee/v4/models/brandConfiguration/responses/BrandConfigurationExecuteResponse.java deleted file mode 100644 index 30336cb1..00000000 --- a/src/main/java/com/chargebee/v4/models/brandConfiguration/responses/BrandConfigurationExecuteResponse.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.chargebee.v4.models.brandConfiguration.responses; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for BrandConfigurationExecute operation. Contains the response data - * from a single resource get operation. - */ -public final class BrandConfigurationExecuteResponse extends BaseResponse { - private final Object brandConfiguration; - - private BrandConfigurationExecuteResponse(Builder builder) { - super(builder.httpResponse); - - this.brandConfiguration = builder.brandConfiguration; - } - - /** Parse JSON response into BrandConfigurationExecuteResponse object. */ - public static BrandConfigurationExecuteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into BrandConfigurationExecuteResponse object with HTTP response. */ - public static BrandConfigurationExecuteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.brandConfiguration(JsonUtil.getObject(json, "brand_configuration")); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse BrandConfigurationExecuteResponse from JSON", e); - } - } - - /** Create a new builder for BrandConfigurationExecuteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for BrandConfigurationExecuteResponse. */ - public static class Builder { - - private Object brandConfiguration; - - private Response httpResponse; - - private Builder() {} - - public Builder brandConfiguration(Object brandConfiguration) { - this.brandConfiguration = brandConfiguration; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public BrandConfigurationExecuteResponse build() { - return new BrandConfigurationExecuteResponse(this); - } - } - - /** Get the brandConfiguration from the response. */ - public Object getBrandConfiguration() { - return brandConfiguration; - } -} diff --git a/src/main/java/com/chargebee/v4/models/brandConfiguration/responses/BrandConfigurationRetrieveResponse.java b/src/main/java/com/chargebee/v4/models/brandConfiguration/responses/BrandConfigurationRetrieveResponse.java new file mode 100644 index 00000000..3fd5d880 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/brandConfiguration/responses/BrandConfigurationRetrieveResponse.java @@ -0,0 +1,72 @@ +package com.chargebee.v4.models.brandConfiguration.responses; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for BrandConfigurationRetrieve operation. Contains the response data + * from a single resource get operation. + */ +public final class BrandConfigurationRetrieveResponse extends BaseResponse { + private final Object brandConfiguration; + + private BrandConfigurationRetrieveResponse(Builder builder) { + super(builder.httpResponse); + + this.brandConfiguration = builder.brandConfiguration; + } + + /** Parse JSON response into BrandConfigurationRetrieveResponse object. */ + public static BrandConfigurationRetrieveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into BrandConfigurationRetrieveResponse object with HTTP response. */ + public static BrandConfigurationRetrieveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.brandConfiguration(JsonUtil.getObject(json, "brand_configuration")); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse BrandConfigurationRetrieveResponse from JSON", e); + } + } + + /** Create a new builder for BrandConfigurationRetrieveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for BrandConfigurationRetrieveResponse. */ + public static class Builder { + + private Object brandConfiguration; + + private Response httpResponse; + + private Builder() {} + + public Builder brandConfiguration(Object brandConfiguration) { + this.brandConfiguration = brandConfiguration; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public BrandConfigurationRetrieveResponse build() { + return new BrandConfigurationRetrieveResponse(this); + } + } + + /** Get the brandConfiguration from the response. */ + public Object getBrandConfiguration() { + return brandConfiguration; + } +} diff --git a/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityCreateTransfersParams.java b/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityCreateTransfersParams.java new file mode 100644 index 00000000..21ccbaa2 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityCreateTransfersParams.java @@ -0,0 +1,143 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.businessEntity.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class BusinessEntityCreateTransfersParams { + + private final List activeResourceIds; + + private final List destinationBusinessEntityIds; + + private final List sourceBusinessEntityIds; + + private final List resourceTypes; + + private final List reasonCodes; + + private BusinessEntityCreateTransfersParams(BusinessEntityCreateTransfersBuilder builder) { + + this.activeResourceIds = builder.activeResourceIds; + + this.destinationBusinessEntityIds = builder.destinationBusinessEntityIds; + + this.sourceBusinessEntityIds = builder.sourceBusinessEntityIds; + + this.resourceTypes = builder.resourceTypes; + + this.reasonCodes = builder.reasonCodes; + } + + public List getActiveResourceIds() { + return activeResourceIds; + } + + public List getDestinationBusinessEntityIds() { + return destinationBusinessEntityIds; + } + + public List getSourceBusinessEntityIds() { + return sourceBusinessEntityIds; + } + + public List getResourceTypes() { + return resourceTypes; + } + + public List getReasonCodes() { + return reasonCodes; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.activeResourceIds != null) { + + formData.put("active_resource_ids", this.activeResourceIds); + } + + if (this.destinationBusinessEntityIds != null) { + + formData.put("destination_business_entity_ids", this.destinationBusinessEntityIds); + } + + if (this.sourceBusinessEntityIds != null) { + + formData.put("source_business_entity_ids", this.sourceBusinessEntityIds); + } + + if (this.resourceTypes != null) { + + formData.put("resource_types", this.resourceTypes); + } + + if (this.reasonCodes != null) { + + formData.put("reason_codes", this.reasonCodes); + } + + return formData; + } + + /** Create a new builder for BusinessEntityCreateTransfersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BusinessEntityCreateTransfersBuilder builder() { + return new BusinessEntityCreateTransfersBuilder(); + } + + public static final class BusinessEntityCreateTransfersBuilder { + + private List activeResourceIds; + + private List destinationBusinessEntityIds; + + private List sourceBusinessEntityIds; + + private List resourceTypes; + + private List reasonCodes; + + private BusinessEntityCreateTransfersBuilder() {} + + public BusinessEntityCreateTransfersBuilder activeResourceIds(List value) { + this.activeResourceIds = value; + return this; + } + + public BusinessEntityCreateTransfersBuilder destinationBusinessEntityIds(List value) { + this.destinationBusinessEntityIds = value; + return this; + } + + @Deprecated + public BusinessEntityCreateTransfersBuilder sourceBusinessEntityIds(List value) { + this.sourceBusinessEntityIds = value; + return this; + } + + @Deprecated + public BusinessEntityCreateTransfersBuilder resourceTypes(List value) { + this.resourceTypes = value; + return this; + } + + public BusinessEntityCreateTransfersBuilder reasonCodes(List value) { + this.reasonCodes = value; + return this; + } + + public BusinessEntityCreateTransfersParams build() { + return new BusinessEntityCreateTransfersParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityGetTransfersParams.java b/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityGetTransfersParams.java new file mode 100644 index 00000000..7d0fad79 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityGetTransfersParams.java @@ -0,0 +1,247 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.businessEntity.params; + +import com.chargebee.v4.internal.Recommended; + +import java.sql.Timestamp; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class BusinessEntityGetTransfersParams { + + private final Map queryParams; + + private BusinessEntityGetTransfersParams(BusinessEntityGetTransfersBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public BusinessEntityGetTransfersBuilder toBuilder() { + BusinessEntityGetTransfersBuilder builder = new BusinessEntityGetTransfersBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for BusinessEntityGetTransfersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BusinessEntityGetTransfersBuilder builder() { + return new BusinessEntityGetTransfersBuilder(); + } + + public static final class BusinessEntityGetTransfersBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private BusinessEntityGetTransfersBuilder() {} + + public BusinessEntityGetTransfersBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public BusinessEntityGetTransfersBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + public ResourceTypeFilter resourceType() { + return new ResourceTypeFilter("resource_type", this); + } + + public ResourceIdFilter resourceId() { + return new ResourceIdFilter("resource_id", this); + } + + public ActiveResourceIdFilter activeResourceId() { + return new ActiveResourceIdFilter("active_resource_id", this); + } + + public CreatedAtFilter createdAt() { + return new CreatedAtFilter("created_at", this); + } + + public SortBySortBuilder sortBy() { + return new SortBySortBuilder("sort_by", this); + } + + public BusinessEntityGetTransfersParams build() { + return new BusinessEntityGetTransfersParams(this); + } + + public static final class ResourceTypeFilter { + private final String fieldName; + private final BusinessEntityGetTransfersBuilder builder; + + ResourceTypeFilter(String fieldName, BusinessEntityGetTransfersBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public BusinessEntityGetTransfersBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + } + + public static final class ResourceIdFilter { + private final String fieldName; + private final BusinessEntityGetTransfersBuilder builder; + + ResourceIdFilter(String fieldName, BusinessEntityGetTransfersBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public BusinessEntityGetTransfersBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + } + + public static final class ActiveResourceIdFilter { + private final String fieldName; + private final BusinessEntityGetTransfersBuilder builder; + + ActiveResourceIdFilter(String fieldName, BusinessEntityGetTransfersBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public BusinessEntityGetTransfersBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + } + + public static final class CreatedAtFilter { + private final String fieldName; + private final BusinessEntityGetTransfersBuilder builder; + + CreatedAtFilter(String fieldName, BusinessEntityGetTransfersBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public BusinessEntityGetTransfersBuilder after(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[after]", timestamp.getTime() / 1000); + return builder; + } + + public BusinessEntityGetTransfersBuilder before(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[before]", timestamp.getTime() / 1000); + return builder; + } + + public BusinessEntityGetTransfersBuilder on(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[on]", timestamp.getTime() / 1000); + return builder; + } + + public BusinessEntityGetTransfersBuilder between(Timestamp start, Timestamp end) { + builder.queryParams.put( + fieldName + "[between]", + "[" + (start.getTime() / 1000) + "," + (end.getTime() / 1000) + "]"); + return builder; + } + } + + public static final class SortBySortBuilder { + private final String fieldName; + private final BusinessEntityGetTransfersBuilder builder; + + SortBySortBuilder(String fieldName, BusinessEntityGetTransfersBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public SortDirection created_at() { + return new SortDirection(fieldName, "created_at", builder); + } + } + + public static final class SortDirection { + private final String fieldName; + private final String selectedField; + private final BusinessEntityGetTransfersBuilder builder; + + SortDirection( + String fieldName, String selectedField, BusinessEntityGetTransfersBuilder builder) { + this.fieldName = fieldName; + this.selectedField = selectedField; + this.builder = builder; + } + + public BusinessEntityGetTransfersBuilder asc() { + builder.queryParams.put(fieldName + "[asc]", selectedField); + return builder; + } + + public BusinessEntityGetTransfersBuilder desc() { + builder.queryParams.put(fieldName + "[desc]", selectedField); + return builder; + } + } + } + + public enum SortByAsc { + CREATED_AT("created_at"), + + /** An enum member indicating that SortByAsc was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + SortByAsc(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SortByAsc fromString(String value) { + if (value == null) return _UNKNOWN; + for (SortByAsc enumValue : SortByAsc.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum SortByDesc { + CREATED_AT("created_at"), + + /** An enum member indicating that SortByDesc was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + SortByDesc(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SortByDesc fromString(String value) { + if (value == null) return _UNKNOWN; + for (SortByDesc enumValue : SortByDesc.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityListTransfersParams.java b/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityListTransfersParams.java deleted file mode 100644 index 00a799b8..00000000 --- a/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityListTransfersParams.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.businessEntity.params; - -import com.chargebee.v4.internal.Recommended; - -import java.sql.Timestamp; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class BusinessEntityListTransfersParams { - - private final Map queryParams; - - private BusinessEntityListTransfersParams(BusinessEntityListTransfersBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public BusinessEntityListTransfersBuilder toBuilder() { - BusinessEntityListTransfersBuilder builder = new BusinessEntityListTransfersBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for BusinessEntityListTransfersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BusinessEntityListTransfersBuilder builder() { - return new BusinessEntityListTransfersBuilder(); - } - - public static final class BusinessEntityListTransfersBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private BusinessEntityListTransfersBuilder() {} - - public BusinessEntityListTransfersBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public BusinessEntityListTransfersBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - public ResourceTypeFilter resourceType() { - return new ResourceTypeFilter("resource_type", this); - } - - public ResourceIdFilter resourceId() { - return new ResourceIdFilter("resource_id", this); - } - - public ActiveResourceIdFilter activeResourceId() { - return new ActiveResourceIdFilter("active_resource_id", this); - } - - public CreatedAtFilter createdAt() { - return new CreatedAtFilter("created_at", this); - } - - public SortBySortBuilder sortBy() { - return new SortBySortBuilder("sort_by", this); - } - - public BusinessEntityListTransfersParams build() { - return new BusinessEntityListTransfersParams(this); - } - - public static final class ResourceTypeFilter { - private final String fieldName; - private final BusinessEntityListTransfersBuilder builder; - - ResourceTypeFilter(String fieldName, BusinessEntityListTransfersBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public BusinessEntityListTransfersBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - } - - public static final class ResourceIdFilter { - private final String fieldName; - private final BusinessEntityListTransfersBuilder builder; - - ResourceIdFilter(String fieldName, BusinessEntityListTransfersBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public BusinessEntityListTransfersBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - } - - public static final class ActiveResourceIdFilter { - private final String fieldName; - private final BusinessEntityListTransfersBuilder builder; - - ActiveResourceIdFilter(String fieldName, BusinessEntityListTransfersBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public BusinessEntityListTransfersBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - } - - public static final class CreatedAtFilter { - private final String fieldName; - private final BusinessEntityListTransfersBuilder builder; - - CreatedAtFilter(String fieldName, BusinessEntityListTransfersBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public BusinessEntityListTransfersBuilder after(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[after]", timestamp.getTime() / 1000); - return builder; - } - - public BusinessEntityListTransfersBuilder before(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[before]", timestamp.getTime() / 1000); - return builder; - } - - public BusinessEntityListTransfersBuilder on(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[on]", timestamp.getTime() / 1000); - return builder; - } - - public BusinessEntityListTransfersBuilder between(Timestamp start, Timestamp end) { - builder.queryParams.put( - fieldName + "[between]", - "[" + (start.getTime() / 1000) + "," + (end.getTime() / 1000) + "]"); - return builder; - } - } - - public static final class SortBySortBuilder { - private final String fieldName; - private final BusinessEntityListTransfersBuilder builder; - - SortBySortBuilder(String fieldName, BusinessEntityListTransfersBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public SortDirection created_at() { - return new SortDirection(fieldName, "created_at", builder); - } - } - - public static final class SortDirection { - private final String fieldName; - private final String selectedField; - private final BusinessEntityListTransfersBuilder builder; - - SortDirection( - String fieldName, String selectedField, BusinessEntityListTransfersBuilder builder) { - this.fieldName = fieldName; - this.selectedField = selectedField; - this.builder = builder; - } - - public BusinessEntityListTransfersBuilder asc() { - builder.queryParams.put(fieldName + "[asc]", selectedField); - return builder; - } - - public BusinessEntityListTransfersBuilder desc() { - builder.queryParams.put(fieldName + "[desc]", selectedField); - return builder; - } - } - } - - public enum SortByAsc { - CREATED_AT("created_at"), - - /** An enum member indicating that SortByAsc was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - SortByAsc(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static SortByAsc fromString(String value) { - if (value == null) return _UNKNOWN; - for (SortByAsc enumValue : SortByAsc.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum SortByDesc { - CREATED_AT("created_at"), - - /** An enum member indicating that SortByDesc was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - SortByDesc(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static SortByDesc fromString(String value) { - if (value == null) return _UNKNOWN; - for (SortByDesc enumValue : SortByDesc.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityTransfersParams.java b/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityTransfersParams.java deleted file mode 100644 index 8536aeb4..00000000 --- a/src/main/java/com/chargebee/v4/models/businessEntity/params/BusinessEntityTransfersParams.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.businessEntity.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class BusinessEntityTransfersParams { - - private final List activeResourceIds; - - private final List destinationBusinessEntityIds; - - private final List sourceBusinessEntityIds; - - private final List resourceTypes; - - private final List reasonCodes; - - private BusinessEntityTransfersParams(BusinessEntityTransfersBuilder builder) { - - this.activeResourceIds = builder.activeResourceIds; - - this.destinationBusinessEntityIds = builder.destinationBusinessEntityIds; - - this.sourceBusinessEntityIds = builder.sourceBusinessEntityIds; - - this.resourceTypes = builder.resourceTypes; - - this.reasonCodes = builder.reasonCodes; - } - - public List getActiveResourceIds() { - return activeResourceIds; - } - - public List getDestinationBusinessEntityIds() { - return destinationBusinessEntityIds; - } - - public List getSourceBusinessEntityIds() { - return sourceBusinessEntityIds; - } - - public List getResourceTypes() { - return resourceTypes; - } - - public List getReasonCodes() { - return reasonCodes; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.activeResourceIds != null) { - - formData.put("active_resource_ids", this.activeResourceIds); - } - - if (this.destinationBusinessEntityIds != null) { - - formData.put("destination_business_entity_ids", this.destinationBusinessEntityIds); - } - - if (this.sourceBusinessEntityIds != null) { - - formData.put("source_business_entity_ids", this.sourceBusinessEntityIds); - } - - if (this.resourceTypes != null) { - - formData.put("resource_types", this.resourceTypes); - } - - if (this.reasonCodes != null) { - - formData.put("reason_codes", this.reasonCodes); - } - - return formData; - } - - /** Create a new builder for BusinessEntityTransfersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BusinessEntityTransfersBuilder builder() { - return new BusinessEntityTransfersBuilder(); - } - - public static final class BusinessEntityTransfersBuilder { - - private List activeResourceIds; - - private List destinationBusinessEntityIds; - - private List sourceBusinessEntityIds; - - private List resourceTypes; - - private List reasonCodes; - - private BusinessEntityTransfersBuilder() {} - - public BusinessEntityTransfersBuilder activeResourceIds(List value) { - this.activeResourceIds = value; - return this; - } - - public BusinessEntityTransfersBuilder destinationBusinessEntityIds(List value) { - this.destinationBusinessEntityIds = value; - return this; - } - - @Deprecated - public BusinessEntityTransfersBuilder sourceBusinessEntityIds(List value) { - this.sourceBusinessEntityIds = value; - return this; - } - - @Deprecated - public BusinessEntityTransfersBuilder resourceTypes(List value) { - this.resourceTypes = value; - return this; - } - - public BusinessEntityTransfersBuilder reasonCodes(List value) { - this.reasonCodes = value; - return this; - } - - public BusinessEntityTransfersParams build() { - return new BusinessEntityTransfersParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityCreateTransfersResponse.java b/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityCreateTransfersResponse.java new file mode 100644 index 00000000..470bc95d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityCreateTransfersResponse.java @@ -0,0 +1,79 @@ +package com.chargebee.v4.models.businessEntity.responses; + +import com.chargebee.v4.models.businessEntityTransfer.BusinessEntityTransfer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for BusinessEntityCreateTransfers operation. Contains the response data + * from the API. + */ +public final class BusinessEntityCreateTransfersResponse extends BaseResponse { + private final BusinessEntityTransfer businessEntityTransfer; + + private BusinessEntityCreateTransfersResponse(Builder builder) { + super(builder.httpResponse); + + this.businessEntityTransfer = builder.businessEntityTransfer; + } + + /** Parse JSON response into BusinessEntityCreateTransfersResponse object. */ + public static BusinessEntityCreateTransfersResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into BusinessEntityCreateTransfersResponse object with HTTP response. */ + public static BusinessEntityCreateTransfersResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __businessEntityTransferJson = JsonUtil.getObject(json, "business_entity_transfer"); + if (__businessEntityTransferJson != null) { + builder.businessEntityTransfer( + BusinessEntityTransfer.fromJson(__businessEntityTransferJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse BusinessEntityCreateTransfersResponse from JSON", e); + } + } + + /** Create a new builder for BusinessEntityCreateTransfersResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for BusinessEntityCreateTransfersResponse. */ + public static class Builder { + + private BusinessEntityTransfer businessEntityTransfer; + + private Response httpResponse; + + private Builder() {} + + public Builder businessEntityTransfer(BusinessEntityTransfer businessEntityTransfer) { + this.businessEntityTransfer = businessEntityTransfer; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public BusinessEntityCreateTransfersResponse build() { + return new BusinessEntityCreateTransfersResponse(this); + } + } + + /** Get the businessEntityTransfer from the response. */ + public BusinessEntityTransfer getBusinessEntityTransfer() { + return businessEntityTransfer; + } +} diff --git a/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityGetTransfersResponse.java b/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityGetTransfersResponse.java new file mode 100644 index 00000000..7a748ecc --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityGetTransfersResponse.java @@ -0,0 +1,170 @@ +package com.chargebee.v4.models.businessEntity.responses; + +import java.util.List; + +import com.chargebee.v4.models.businessEntityTransfer.BusinessEntityTransfer; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.BusinessEntityService; +import com.chargebee.v4.models.businessEntity.params.BusinessEntityGetTransfersParams; + +/** + * Immutable response object for BusinessEntityGetTransfers operation. Contains paginated list data. + */ +public final class BusinessEntityGetTransfersResponse { + + private final List list; + + private final String nextOffset; + + private final BusinessEntityService service; + private final BusinessEntityGetTransfersParams originalParams; + private final Response httpResponse; + + private BusinessEntityGetTransfersResponse( + List list, + String nextOffset, + BusinessEntityService service, + BusinessEntityGetTransfersParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into BusinessEntityGetTransfersResponse object (no service context). Use + * this when you only need to read a single page (no nextPage()). + */ + public static BusinessEntityGetTransfersResponse fromJson(String json) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(BusinessEntityGetTransfersItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new BusinessEntityGetTransfersResponse(list, nextOffset, null, null, null); + } catch (Exception e) { + throw new RuntimeException("Failed to parse BusinessEntityGetTransfersResponse from JSON", e); + } + } + + /** + * Parse JSON response into BusinessEntityGetTransfersResponse object with service context for + * pagination (enables nextPage()). + */ + public static BusinessEntityGetTransfersResponse fromJson( + String json, + BusinessEntityService service, + BusinessEntityGetTransfersParams originalParams, + Response httpResponse) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(BusinessEntityGetTransfersItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new BusinessEntityGetTransfersResponse( + list, nextOffset, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException("Failed to parse BusinessEntityGetTransfersResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public BusinessEntityGetTransfersResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + BusinessEntityGetTransfersParams nextParams = + (originalParams != null + ? originalParams.toBuilder() + : BusinessEntityGetTransfersParams.builder()) + .offset(nextOffset) + .build(); + + return service.getTransfers(nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + public static class BusinessEntityGetTransfersItem { + + private BusinessEntityTransfer businessEntityTransfer; + + public BusinessEntityTransfer getBusinessEntityTransfer() { + return businessEntityTransfer; + } + + public static BusinessEntityGetTransfersItem fromJson(String json) { + BusinessEntityGetTransfersItem item = new BusinessEntityGetTransfersItem(); + + String __businessEntityTransferJson = JsonUtil.getObject(json, "business_entity_transfer"); + if (__businessEntityTransferJson != null) { + item.businessEntityTransfer = BusinessEntityTransfer.fromJson(__businessEntityTransferJson); + } + + return item; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityListTransfersResponse.java b/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityListTransfersResponse.java deleted file mode 100644 index f1fb6fcc..00000000 --- a/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityListTransfersResponse.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.chargebee.v4.models.businessEntity.responses; - -import java.util.List; - -import com.chargebee.v4.models.businessEntityTransfer.BusinessEntityTransfer; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.BusinessEntityService; -import com.chargebee.v4.models.businessEntity.params.BusinessEntityListTransfersParams; - -/** - * Immutable response object for BusinessEntityListTransfers operation. Contains paginated list - * data. - */ -public final class BusinessEntityListTransfersResponse { - - private final List list; - - private final String nextOffset; - - private final BusinessEntityService service; - private final BusinessEntityListTransfersParams originalParams; - private final Response httpResponse; - - private BusinessEntityListTransfersResponse( - List list, - String nextOffset, - BusinessEntityService service, - BusinessEntityListTransfersParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into BusinessEntityListTransfersResponse object (no service context). Use - * this when you only need to read a single page (no nextPage()). - */ - public static BusinessEntityListTransfersResponse fromJson(String json) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(BusinessEntityListTransfersItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new BusinessEntityListTransfersResponse(list, nextOffset, null, null, null); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse BusinessEntityListTransfersResponse from JSON", e); - } - } - - /** - * Parse JSON response into BusinessEntityListTransfersResponse object with service context for - * pagination (enables nextPage()). - */ - public static BusinessEntityListTransfersResponse fromJson( - String json, - BusinessEntityService service, - BusinessEntityListTransfersParams originalParams, - Response httpResponse) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(BusinessEntityListTransfersItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new BusinessEntityListTransfersResponse( - list, nextOffset, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse BusinessEntityListTransfersResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public BusinessEntityListTransfersResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - BusinessEntityListTransfersParams nextParams = - (originalParams != null - ? originalParams.toBuilder() - : BusinessEntityListTransfersParams.builder()) - .offset(nextOffset) - .build(); - - return service.listTransfers(nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } - - public static class BusinessEntityListTransfersItem { - - private BusinessEntityTransfer businessEntityTransfer; - - public BusinessEntityTransfer getBusinessEntityTransfer() { - return businessEntityTransfer; - } - - public static BusinessEntityListTransfersItem fromJson(String json) { - BusinessEntityListTransfersItem item = new BusinessEntityListTransfersItem(); - - String __businessEntityTransferJson = JsonUtil.getObject(json, "business_entity_transfer"); - if (__businessEntityTransferJson != null) { - item.businessEntityTransfer = BusinessEntityTransfer.fromJson(__businessEntityTransferJson); - } - - return item; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityTransfersResponse.java b/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityTransfersResponse.java deleted file mode 100644 index ea4c85fd..00000000 --- a/src/main/java/com/chargebee/v4/models/businessEntity/responses/BusinessEntityTransfersResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.businessEntity.responses; - -import com.chargebee.v4.models.businessEntityTransfer.BusinessEntityTransfer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for BusinessEntityTransfers operation. Contains the response data from - * the API. - */ -public final class BusinessEntityTransfersResponse extends BaseResponse { - private final BusinessEntityTransfer businessEntityTransfer; - - private BusinessEntityTransfersResponse(Builder builder) { - super(builder.httpResponse); - - this.businessEntityTransfer = builder.businessEntityTransfer; - } - - /** Parse JSON response into BusinessEntityTransfersResponse object. */ - public static BusinessEntityTransfersResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into BusinessEntityTransfersResponse object with HTTP response. */ - public static BusinessEntityTransfersResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __businessEntityTransferJson = JsonUtil.getObject(json, "business_entity_transfer"); - if (__businessEntityTransferJson != null) { - builder.businessEntityTransfer( - BusinessEntityTransfer.fromJson(__businessEntityTransferJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse BusinessEntityTransfersResponse from JSON", e); - } - } - - /** Create a new builder for BusinessEntityTransfersResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for BusinessEntityTransfersResponse. */ - public static class Builder { - - private BusinessEntityTransfer businessEntityTransfer; - - private Response httpResponse; - - private Builder() {} - - public Builder businessEntityTransfer(BusinessEntityTransfer businessEntityTransfer) { - this.businessEntityTransfer = businessEntityTransfer; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public BusinessEntityTransfersResponse build() { - return new BusinessEntityTransfersResponse(this); - } - } - - /** Get the businessEntityTransfer from the response. */ - public BusinessEntityTransfer getBusinessEntityTransfer() { - return businessEntityTransfer; - } -} diff --git a/src/main/java/com/chargebee/v4/models/businessEntityChange/BusinessEntityChange.java b/src/main/java/com/chargebee/v4/models/businessEntityChange/BusinessEntityChange.java deleted file mode 100644 index 71bff604..00000000 --- a/src/main/java/com/chargebee/v4/models/businessEntityChange/BusinessEntityChange.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.businessEntityChange; - -import com.chargebee.v4.internal.JsonUtil; -import java.sql.Timestamp; - -public class BusinessEntityChange { - - private String id; - private String businessEntityId; - private Reason reason; - private Timestamp activeFrom; - private Timestamp activeTo; - private ResourceType resourceType; - private Timestamp modifiedAt; - private String resourceId; - private String activeResourceId; - - public String getId() { - return id; - } - - public String getBusinessEntityId() { - return businessEntityId; - } - - public Reason getReason() { - return reason; - } - - public Timestamp getActiveFrom() { - return activeFrom; - } - - public Timestamp getActiveTo() { - return activeTo; - } - - public ResourceType getResourceType() { - return resourceType; - } - - public Timestamp getModifiedAt() { - return modifiedAt; - } - - public String getResourceId() { - return resourceId; - } - - public String getActiveResourceId() { - return activeResourceId; - } - - public enum Reason { - CORRECTION("correction"), - - /** An enum member indicating that Reason was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Reason(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Reason fromString(String value) { - if (value == null) return _UNKNOWN; - for (Reason enumValue : Reason.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ResourceType { - CUSTOMER("customer"), - - SUBSCRIPTION("subscription"), - - /** An enum member indicating that ResourceType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ResourceType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ResourceType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ResourceType enumValue : ResourceType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static BusinessEntityChange fromJson(String json) { - BusinessEntityChange obj = new BusinessEntityChange(); - - obj.id = JsonUtil.getString(json, "id"); - - obj.businessEntityId = JsonUtil.getString(json, "business_entity_id"); - - obj.reason = Reason.fromString(JsonUtil.getString(json, "reason")); - - obj.activeFrom = JsonUtil.getTimestamp(json, "active_from"); - - obj.activeTo = JsonUtil.getTimestamp(json, "active_to"); - - obj.resourceType = ResourceType.fromString(JsonUtil.getString(json, "resource_type")); - - obj.modifiedAt = JsonUtil.getTimestamp(json, "modified_at"); - - obj.resourceId = JsonUtil.getString(json, "resource_id"); - - obj.activeResourceId = JsonUtil.getString(json, "active_resource_id"); - - return obj; - } -} diff --git a/src/main/java/com/chargebee/v4/models/businessProfile/params/BusinessProfileExecuteParams.java b/src/main/java/com/chargebee/v4/models/businessProfile/params/BusinessProfileExecuteParams.java deleted file mode 100644 index f9aa06d8..00000000 --- a/src/main/java/com/chargebee/v4/models/businessProfile/params/BusinessProfileExecuteParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.businessProfile.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class BusinessProfileExecuteParams { - - private final Map queryParams; - - private BusinessProfileExecuteParams(BusinessProfileExecuteBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public BusinessProfileExecuteBuilder toBuilder() { - BusinessProfileExecuteBuilder builder = new BusinessProfileExecuteBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for BusinessProfileExecuteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BusinessProfileExecuteBuilder builder() { - return new BusinessProfileExecuteBuilder(); - } - - public static final class BusinessProfileExecuteBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private BusinessProfileExecuteBuilder() {} - - public BusinessProfileExecuteParams build() { - return new BusinessProfileExecuteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/businessProfile/params/BusinessProfileRetrieveParams.java b/src/main/java/com/chargebee/v4/models/businessProfile/params/BusinessProfileRetrieveParams.java new file mode 100644 index 00000000..2b576bdb --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/businessProfile/params/BusinessProfileRetrieveParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.businessProfile.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class BusinessProfileRetrieveParams { + + private final Map queryParams; + + private BusinessProfileRetrieveParams(BusinessProfileRetrieveBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public BusinessProfileRetrieveBuilder toBuilder() { + BusinessProfileRetrieveBuilder builder = new BusinessProfileRetrieveBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for BusinessProfileRetrieveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BusinessProfileRetrieveBuilder builder() { + return new BusinessProfileRetrieveBuilder(); + } + + public static final class BusinessProfileRetrieveBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private BusinessProfileRetrieveBuilder() {} + + public BusinessProfileRetrieveParams build() { + return new BusinessProfileRetrieveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/businessProfile/responses/BusinessProfileExecuteResponse.java b/src/main/java/com/chargebee/v4/models/businessProfile/responses/BusinessProfileExecuteResponse.java deleted file mode 100644 index 81789c4e..00000000 --- a/src/main/java/com/chargebee/v4/models/businessProfile/responses/BusinessProfileExecuteResponse.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.chargebee.v4.models.businessProfile.responses; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for BusinessProfileExecute operation. Contains the response data from a - * single resource get operation. - */ -public final class BusinessProfileExecuteResponse extends BaseResponse { - private final Object businessProfile; - - private BusinessProfileExecuteResponse(Builder builder) { - super(builder.httpResponse); - - this.businessProfile = builder.businessProfile; - } - - /** Parse JSON response into BusinessProfileExecuteResponse object. */ - public static BusinessProfileExecuteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into BusinessProfileExecuteResponse object with HTTP response. */ - public static BusinessProfileExecuteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.businessProfile(JsonUtil.getObject(json, "business_profile")); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse BusinessProfileExecuteResponse from JSON", e); - } - } - - /** Create a new builder for BusinessProfileExecuteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for BusinessProfileExecuteResponse. */ - public static class Builder { - - private Object businessProfile; - - private Response httpResponse; - - private Builder() {} - - public Builder businessProfile(Object businessProfile) { - this.businessProfile = businessProfile; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public BusinessProfileExecuteResponse build() { - return new BusinessProfileExecuteResponse(this); - } - } - - /** Get the businessProfile from the response. */ - public Object getBusinessProfile() { - return businessProfile; - } -} diff --git a/src/main/java/com/chargebee/v4/models/businessProfile/responses/BusinessProfileRetrieveResponse.java b/src/main/java/com/chargebee/v4/models/businessProfile/responses/BusinessProfileRetrieveResponse.java new file mode 100644 index 00000000..6ba38700 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/businessProfile/responses/BusinessProfileRetrieveResponse.java @@ -0,0 +1,72 @@ +package com.chargebee.v4.models.businessProfile.responses; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for BusinessProfileRetrieve operation. Contains the response data from + * a single resource get operation. + */ +public final class BusinessProfileRetrieveResponse extends BaseResponse { + private final Object businessProfile; + + private BusinessProfileRetrieveResponse(Builder builder) { + super(builder.httpResponse); + + this.businessProfile = builder.businessProfile; + } + + /** Parse JSON response into BusinessProfileRetrieveResponse object. */ + public static BusinessProfileRetrieveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into BusinessProfileRetrieveResponse object with HTTP response. */ + public static BusinessProfileRetrieveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.businessProfile(JsonUtil.getObject(json, "business_profile")); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse BusinessProfileRetrieveResponse from JSON", e); + } + } + + /** Create a new builder for BusinessProfileRetrieveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for BusinessProfileRetrieveResponse. */ + public static class Builder { + + private Object businessProfile; + + private Response httpResponse; + + private Builder() {} + + public Builder businessProfile(Object businessProfile) { + this.businessProfile = businessProfile; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public BusinessProfileRetrieveResponse build() { + return new BusinessProfileRetrieveResponse(this); + } + } + + /** Get the businessProfile from the response. */ + public Object getBusinessProfile() { + return businessProfile; + } +} diff --git a/src/main/java/com/chargebee/v4/models/card/params/CreditCardForCustomerParams.java b/src/main/java/com/chargebee/v4/models/card/params/CreditCardForCustomerParams.java deleted file mode 100644 index a6e51397..00000000 --- a/src/main/java/com/chargebee/v4/models/card/params/CreditCardForCustomerParams.java +++ /dev/null @@ -1,641 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.card.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class CreditCardForCustomerParams { - - private final Gateway gateway; - - private final String gatewayAccountId; - - private final String tmpToken; - - private final String firstName; - - private final String lastName; - - private final String number; - - private final Integer expiryMonth; - - private final Integer expiryYear; - - private final String cvv; - - private final PreferredScheme preferredScheme; - - private final String billingAddr1; - - private final String billingAddr2; - - private final String billingCity; - - private final String billingStateCode; - - private final String billingState; - - private final String billingZip; - - private final String billingCountry; - - private final String ipAddress; - - private final CustomerParams customer; - - private CreditCardForCustomerParams(CreditCardForCustomerBuilder builder) { - - this.gateway = builder.gateway; - - this.gatewayAccountId = builder.gatewayAccountId; - - this.tmpToken = builder.tmpToken; - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.number = builder.number; - - this.expiryMonth = builder.expiryMonth; - - this.expiryYear = builder.expiryYear; - - this.cvv = builder.cvv; - - this.preferredScheme = builder.preferredScheme; - - this.billingAddr1 = builder.billingAddr1; - - this.billingAddr2 = builder.billingAddr2; - - this.billingCity = builder.billingCity; - - this.billingStateCode = builder.billingStateCode; - - this.billingState = builder.billingState; - - this.billingZip = builder.billingZip; - - this.billingCountry = builder.billingCountry; - - this.ipAddress = builder.ipAddress; - - this.customer = builder.customer; - } - - public Gateway getGateway() { - return gateway; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getTmpToken() { - return tmpToken; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getNumber() { - return number; - } - - public Integer getExpiryMonth() { - return expiryMonth; - } - - public Integer getExpiryYear() { - return expiryYear; - } - - public String getCvv() { - return cvv; - } - - public PreferredScheme getPreferredScheme() { - return preferredScheme; - } - - public String getBillingAddr1() { - return billingAddr1; - } - - public String getBillingAddr2() { - return billingAddr2; - } - - public String getBillingCity() { - return billingCity; - } - - public String getBillingStateCode() { - return billingStateCode; - } - - public String getBillingState() { - return billingState; - } - - public String getBillingZip() { - return billingZip; - } - - public String getBillingCountry() { - return billingCountry; - } - - public String getIpAddress() { - return ipAddress; - } - - public CustomerParams getCustomer() { - return customer; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.gateway != null) { - - formData.put("gateway", this.gateway); - } - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.tmpToken != null) { - - formData.put("tmp_token", this.tmpToken); - } - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.number != null) { - - formData.put("number", this.number); - } - - if (this.expiryMonth != null) { - - formData.put("expiry_month", this.expiryMonth); - } - - if (this.expiryYear != null) { - - formData.put("expiry_year", this.expiryYear); - } - - if (this.cvv != null) { - - formData.put("cvv", this.cvv); - } - - if (this.preferredScheme != null) { - - formData.put("preferred_scheme", this.preferredScheme); - } - - if (this.billingAddr1 != null) { - - formData.put("billing_addr1", this.billingAddr1); - } - - if (this.billingAddr2 != null) { - - formData.put("billing_addr2", this.billingAddr2); - } - - if (this.billingCity != null) { - - formData.put("billing_city", this.billingCity); - } - - if (this.billingStateCode != null) { - - formData.put("billing_state_code", this.billingStateCode); - } - - if (this.billingState != null) { - - formData.put("billing_state", this.billingState); - } - - if (this.billingZip != null) { - - formData.put("billing_zip", this.billingZip); - } - - if (this.billingCountry != null) { - - formData.put("billing_country", this.billingCountry); - } - - if (this.ipAddress != null) { - - formData.put("ip_address", this.ipAddress); - } - - if (this.customer != null) { - - // Single object - Map nestedData = this.customer.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "customer[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for CreditCardForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreditCardForCustomerBuilder builder() { - return new CreditCardForCustomerBuilder(); - } - - public static final class CreditCardForCustomerBuilder { - - private Gateway gateway; - - private String gatewayAccountId; - - private String tmpToken; - - private String firstName; - - private String lastName; - - private String number; - - private Integer expiryMonth; - - private Integer expiryYear; - - private String cvv; - - private PreferredScheme preferredScheme; - - private String billingAddr1; - - private String billingAddr2; - - private String billingCity; - - private String billingStateCode; - - private String billingState; - - private String billingZip; - - private String billingCountry; - - private String ipAddress; - - private CustomerParams customer; - - private CreditCardForCustomerBuilder() {} - - @Deprecated - public CreditCardForCustomerBuilder gateway(Gateway value) { - this.gateway = value; - return this; - } - - public CreditCardForCustomerBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public CreditCardForCustomerBuilder tmpToken(String value) { - this.tmpToken = value; - return this; - } - - public CreditCardForCustomerBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public CreditCardForCustomerBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public CreditCardForCustomerBuilder number(String value) { - this.number = value; - return this; - } - - public CreditCardForCustomerBuilder expiryMonth(Integer value) { - this.expiryMonth = value; - return this; - } - - public CreditCardForCustomerBuilder expiryYear(Integer value) { - this.expiryYear = value; - return this; - } - - public CreditCardForCustomerBuilder cvv(String value) { - this.cvv = value; - return this; - } - - public CreditCardForCustomerBuilder preferredScheme(PreferredScheme value) { - this.preferredScheme = value; - return this; - } - - public CreditCardForCustomerBuilder billingAddr1(String value) { - this.billingAddr1 = value; - return this; - } - - public CreditCardForCustomerBuilder billingAddr2(String value) { - this.billingAddr2 = value; - return this; - } - - public CreditCardForCustomerBuilder billingCity(String value) { - this.billingCity = value; - return this; - } - - public CreditCardForCustomerBuilder billingStateCode(String value) { - this.billingStateCode = value; - return this; - } - - public CreditCardForCustomerBuilder billingState(String value) { - this.billingState = value; - return this; - } - - public CreditCardForCustomerBuilder billingZip(String value) { - this.billingZip = value; - return this; - } - - public CreditCardForCustomerBuilder billingCountry(String value) { - this.billingCountry = value; - return this; - } - - @Deprecated - public CreditCardForCustomerBuilder ipAddress(String value) { - this.ipAddress = value; - return this; - } - - @Deprecated - public CreditCardForCustomerBuilder customer(CustomerParams value) { - this.customer = value; - return this; - } - - public CreditCardForCustomerParams build() { - return new CreditCardForCustomerParams(this); - } - } - - public enum Gateway { - CHARGEBEE("chargebee"), - - CHARGEBEE_PAYMENTS("chargebee_payments"), - - ADYEN("adyen"), - - STRIPE("stripe"), - - WEPAY("wepay"), - - BRAINTREE("braintree"), - - AUTHORIZE_NET("authorize_net"), - - PAYPAL_PRO("paypal_pro"), - - PIN("pin"), - - EWAY("eway"), - - EWAY_RAPID("eway_rapid"), - - WORLDPAY("worldpay"), - - BALANCED_PAYMENTS("balanced_payments"), - - BEANSTREAM("beanstream"), - - BLUEPAY("bluepay"), - - ELAVON("elavon"), - - FIRST_DATA_GLOBAL("first_data_global"), - - HDFC("hdfc"), - - MIGS("migs"), - - NMI("nmi"), - - OGONE("ogone"), - - PAYMILL("paymill"), - - PAYPAL_PAYFLOW_PRO("paypal_payflow_pro"), - - SAGE_PAY("sage_pay"), - - TCO("tco"), - - WIRECARD("wirecard"), - - AMAZON_PAYMENTS("amazon_payments"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - ORBITAL("orbital"), - - MONERIS_US("moneris_us"), - - MONERIS("moneris"), - - BLUESNAP("bluesnap"), - - CYBERSOURCE("cybersource"), - - VANTIV("vantiv"), - - CHECKOUT_COM("checkout_com"), - - PAYPAL("paypal"), - - INGENICO_DIRECT("ingenico_direct"), - - EXACT("exact"), - - MOLLIE("mollie"), - - QUICKBOOKS("quickbooks"), - - RAZORPAY("razorpay"), - - GLOBAL_PAYMENTS("global_payments"), - - BANK_OF_AMERICA("bank_of_america"), - - ECENTRIC("ecentric"), - - METRICS_GLOBAL("metrics_global"), - - WINDCAVE("windcave"), - - PAY_COM("pay_com"), - - EBANX("ebanx"), - - DLOCAL("dlocal"), - - NUVEI("nuvei"), - - SOLIDGATE("solidgate"), - - PAYSTACK("paystack"), - - JP_MORGAN("jp_morgan"), - - DEUTSCHE_BANK("deutsche_bank"), - - EZIDEBIT("ezidebit"), - - /** An enum member indicating that Gateway was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Gateway(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Gateway fromString(String value) { - if (value == null) return _UNKNOWN; - for (Gateway enumValue : Gateway.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PreferredScheme { - CARTES_BANCAIRES("cartes_bancaires"), - - MASTERCARD("mastercard"), - - VISA("visa"), - - /** An enum member indicating that PreferredScheme was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PreferredScheme(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PreferredScheme fromString(String value) { - if (value == null) return _UNKNOWN; - for (PreferredScheme enumValue : PreferredScheme.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class CustomerParams { - - private final String vatNumber; - - private CustomerParams(CustomerBuilder builder) { - - this.vatNumber = builder.vatNumber; - } - - public String getVatNumber() { - return vatNumber; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.vatNumber != null) { - - formData.put("vat_number", this.vatNumber); - } - - return formData; - } - - /** Create a new builder for CustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CustomerBuilder builder() { - return new CustomerBuilder(); - } - - public static final class CustomerBuilder { - - private String vatNumber; - - private CustomerBuilder() {} - - @Deprecated - public CustomerBuilder vatNumber(String value) { - this.vatNumber = value; - return this; - } - - public CustomerParams build() { - return new CustomerParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/card/params/UpdateCardForCustomerParams.java b/src/main/java/com/chargebee/v4/models/card/params/UpdateCardForCustomerParams.java new file mode 100644 index 00000000..9f2e076f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/card/params/UpdateCardForCustomerParams.java @@ -0,0 +1,641 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.card.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class UpdateCardForCustomerParams { + + private final Gateway gateway; + + private final String gatewayAccountId; + + private final String tmpToken; + + private final String firstName; + + private final String lastName; + + private final String number; + + private final Integer expiryMonth; + + private final Integer expiryYear; + + private final String cvv; + + private final PreferredScheme preferredScheme; + + private final String billingAddr1; + + private final String billingAddr2; + + private final String billingCity; + + private final String billingStateCode; + + private final String billingState; + + private final String billingZip; + + private final String billingCountry; + + private final String ipAddress; + + private final CustomerParams customer; + + private UpdateCardForCustomerParams(UpdateCardForCustomerBuilder builder) { + + this.gateway = builder.gateway; + + this.gatewayAccountId = builder.gatewayAccountId; + + this.tmpToken = builder.tmpToken; + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.number = builder.number; + + this.expiryMonth = builder.expiryMonth; + + this.expiryYear = builder.expiryYear; + + this.cvv = builder.cvv; + + this.preferredScheme = builder.preferredScheme; + + this.billingAddr1 = builder.billingAddr1; + + this.billingAddr2 = builder.billingAddr2; + + this.billingCity = builder.billingCity; + + this.billingStateCode = builder.billingStateCode; + + this.billingState = builder.billingState; + + this.billingZip = builder.billingZip; + + this.billingCountry = builder.billingCountry; + + this.ipAddress = builder.ipAddress; + + this.customer = builder.customer; + } + + public Gateway getGateway() { + return gateway; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getTmpToken() { + return tmpToken; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getNumber() { + return number; + } + + public Integer getExpiryMonth() { + return expiryMonth; + } + + public Integer getExpiryYear() { + return expiryYear; + } + + public String getCvv() { + return cvv; + } + + public PreferredScheme getPreferredScheme() { + return preferredScheme; + } + + public String getBillingAddr1() { + return billingAddr1; + } + + public String getBillingAddr2() { + return billingAddr2; + } + + public String getBillingCity() { + return billingCity; + } + + public String getBillingStateCode() { + return billingStateCode; + } + + public String getBillingState() { + return billingState; + } + + public String getBillingZip() { + return billingZip; + } + + public String getBillingCountry() { + return billingCountry; + } + + public String getIpAddress() { + return ipAddress; + } + + public CustomerParams getCustomer() { + return customer; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.gateway != null) { + + formData.put("gateway", this.gateway); + } + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.tmpToken != null) { + + formData.put("tmp_token", this.tmpToken); + } + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.number != null) { + + formData.put("number", this.number); + } + + if (this.expiryMonth != null) { + + formData.put("expiry_month", this.expiryMonth); + } + + if (this.expiryYear != null) { + + formData.put("expiry_year", this.expiryYear); + } + + if (this.cvv != null) { + + formData.put("cvv", this.cvv); + } + + if (this.preferredScheme != null) { + + formData.put("preferred_scheme", this.preferredScheme); + } + + if (this.billingAddr1 != null) { + + formData.put("billing_addr1", this.billingAddr1); + } + + if (this.billingAddr2 != null) { + + formData.put("billing_addr2", this.billingAddr2); + } + + if (this.billingCity != null) { + + formData.put("billing_city", this.billingCity); + } + + if (this.billingStateCode != null) { + + formData.put("billing_state_code", this.billingStateCode); + } + + if (this.billingState != null) { + + formData.put("billing_state", this.billingState); + } + + if (this.billingZip != null) { + + formData.put("billing_zip", this.billingZip); + } + + if (this.billingCountry != null) { + + formData.put("billing_country", this.billingCountry); + } + + if (this.ipAddress != null) { + + formData.put("ip_address", this.ipAddress); + } + + if (this.customer != null) { + + // Single object + Map nestedData = this.customer.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "customer[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for UpdateCardForCustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UpdateCardForCustomerBuilder builder() { + return new UpdateCardForCustomerBuilder(); + } + + public static final class UpdateCardForCustomerBuilder { + + private Gateway gateway; + + private String gatewayAccountId; + + private String tmpToken; + + private String firstName; + + private String lastName; + + private String number; + + private Integer expiryMonth; + + private Integer expiryYear; + + private String cvv; + + private PreferredScheme preferredScheme; + + private String billingAddr1; + + private String billingAddr2; + + private String billingCity; + + private String billingStateCode; + + private String billingState; + + private String billingZip; + + private String billingCountry; + + private String ipAddress; + + private CustomerParams customer; + + private UpdateCardForCustomerBuilder() {} + + @Deprecated + public UpdateCardForCustomerBuilder gateway(Gateway value) { + this.gateway = value; + return this; + } + + public UpdateCardForCustomerBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public UpdateCardForCustomerBuilder tmpToken(String value) { + this.tmpToken = value; + return this; + } + + public UpdateCardForCustomerBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public UpdateCardForCustomerBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public UpdateCardForCustomerBuilder number(String value) { + this.number = value; + return this; + } + + public UpdateCardForCustomerBuilder expiryMonth(Integer value) { + this.expiryMonth = value; + return this; + } + + public UpdateCardForCustomerBuilder expiryYear(Integer value) { + this.expiryYear = value; + return this; + } + + public UpdateCardForCustomerBuilder cvv(String value) { + this.cvv = value; + return this; + } + + public UpdateCardForCustomerBuilder preferredScheme(PreferredScheme value) { + this.preferredScheme = value; + return this; + } + + public UpdateCardForCustomerBuilder billingAddr1(String value) { + this.billingAddr1 = value; + return this; + } + + public UpdateCardForCustomerBuilder billingAddr2(String value) { + this.billingAddr2 = value; + return this; + } + + public UpdateCardForCustomerBuilder billingCity(String value) { + this.billingCity = value; + return this; + } + + public UpdateCardForCustomerBuilder billingStateCode(String value) { + this.billingStateCode = value; + return this; + } + + public UpdateCardForCustomerBuilder billingState(String value) { + this.billingState = value; + return this; + } + + public UpdateCardForCustomerBuilder billingZip(String value) { + this.billingZip = value; + return this; + } + + public UpdateCardForCustomerBuilder billingCountry(String value) { + this.billingCountry = value; + return this; + } + + @Deprecated + public UpdateCardForCustomerBuilder ipAddress(String value) { + this.ipAddress = value; + return this; + } + + @Deprecated + public UpdateCardForCustomerBuilder customer(CustomerParams value) { + this.customer = value; + return this; + } + + public UpdateCardForCustomerParams build() { + return new UpdateCardForCustomerParams(this); + } + } + + public enum Gateway { + CHARGEBEE("chargebee"), + + CHARGEBEE_PAYMENTS("chargebee_payments"), + + ADYEN("adyen"), + + STRIPE("stripe"), + + WEPAY("wepay"), + + BRAINTREE("braintree"), + + AUTHORIZE_NET("authorize_net"), + + PAYPAL_PRO("paypal_pro"), + + PIN("pin"), + + EWAY("eway"), + + EWAY_RAPID("eway_rapid"), + + WORLDPAY("worldpay"), + + BALANCED_PAYMENTS("balanced_payments"), + + BEANSTREAM("beanstream"), + + BLUEPAY("bluepay"), + + ELAVON("elavon"), + + FIRST_DATA_GLOBAL("first_data_global"), + + HDFC("hdfc"), + + MIGS("migs"), + + NMI("nmi"), + + OGONE("ogone"), + + PAYMILL("paymill"), + + PAYPAL_PAYFLOW_PRO("paypal_payflow_pro"), + + SAGE_PAY("sage_pay"), + + TCO("tco"), + + WIRECARD("wirecard"), + + AMAZON_PAYMENTS("amazon_payments"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + ORBITAL("orbital"), + + MONERIS_US("moneris_us"), + + MONERIS("moneris"), + + BLUESNAP("bluesnap"), + + CYBERSOURCE("cybersource"), + + VANTIV("vantiv"), + + CHECKOUT_COM("checkout_com"), + + PAYPAL("paypal"), + + INGENICO_DIRECT("ingenico_direct"), + + EXACT("exact"), + + MOLLIE("mollie"), + + QUICKBOOKS("quickbooks"), + + RAZORPAY("razorpay"), + + GLOBAL_PAYMENTS("global_payments"), + + BANK_OF_AMERICA("bank_of_america"), + + ECENTRIC("ecentric"), + + METRICS_GLOBAL("metrics_global"), + + WINDCAVE("windcave"), + + PAY_COM("pay_com"), + + EBANX("ebanx"), + + DLOCAL("dlocal"), + + NUVEI("nuvei"), + + SOLIDGATE("solidgate"), + + PAYSTACK("paystack"), + + JP_MORGAN("jp_morgan"), + + DEUTSCHE_BANK("deutsche_bank"), + + EZIDEBIT("ezidebit"), + + /** An enum member indicating that Gateway was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Gateway(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Gateway fromString(String value) { + if (value == null) return _UNKNOWN; + for (Gateway enumValue : Gateway.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PreferredScheme { + CARTES_BANCAIRES("cartes_bancaires"), + + MASTERCARD("mastercard"), + + VISA("visa"), + + /** An enum member indicating that PreferredScheme was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PreferredScheme(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PreferredScheme fromString(String value) { + if (value == null) return _UNKNOWN; + for (PreferredScheme enumValue : PreferredScheme.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class CustomerParams { + + private final String vatNumber; + + private CustomerParams(CustomerBuilder builder) { + + this.vatNumber = builder.vatNumber; + } + + public String getVatNumber() { + return vatNumber; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.vatNumber != null) { + + formData.put("vat_number", this.vatNumber); + } + + return formData; + } + + /** Create a new builder for CustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerBuilder builder() { + return new CustomerBuilder(); + } + + public static final class CustomerBuilder { + + private String vatNumber; + + private CustomerBuilder() {} + + @Deprecated + public CustomerBuilder vatNumber(String value) { + this.vatNumber = value; + return this; + } + + public CustomerParams build() { + return new CustomerParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/card/responses/CreditCardForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/card/responses/CreditCardForCustomerResponse.java deleted file mode 100644 index 7fa1bc4a..00000000 --- a/src/main/java/com/chargebee/v4/models/card/responses/CreditCardForCustomerResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.card.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CreditCardForCustomer operation. Contains the response data from - * the API. - */ -public final class CreditCardForCustomerResponse extends BaseResponse { - private final Customer customer; - - private final Card card; - - private CreditCardForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into CreditCardForCustomerResponse object. */ - public static CreditCardForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into CreditCardForCustomerResponse object with HTTP response. */ - public static CreditCardForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse CreditCardForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for CreditCardForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CreditCardForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CreditCardForCustomerResponse build() { - return new CreditCardForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/card/responses/UpdateCardForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/card/responses/UpdateCardForCustomerResponse.java new file mode 100644 index 00000000..740131bd --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/card/responses/UpdateCardForCustomerResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.card.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for UpdateCardForCustomer operation. Contains the response data from + * the API. + */ +public final class UpdateCardForCustomerResponse extends BaseResponse { + private final Customer customer; + + private final Card card; + + private UpdateCardForCustomerResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into UpdateCardForCustomerResponse object. */ + public static UpdateCardForCustomerResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into UpdateCardForCustomerResponse object with HTTP response. */ + public static UpdateCardForCustomerResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse UpdateCardForCustomerResponse from JSON", e); + } + } + + /** Create a new builder for UpdateCardForCustomerResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for UpdateCardForCustomerResponse. */ + public static class Builder { + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public UpdateCardForCustomerResponse build() { + return new UpdateCardForCustomerResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/comment/params/CommentDeleteParams.java b/src/main/java/com/chargebee/v4/models/comment/params/CommentDeleteParams.java new file mode 100644 index 00000000..5a9699c2 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/comment/params/CommentDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.comment.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CommentDeleteParams { + + private CommentDeleteParams(CommentDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CommentDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CommentDeleteBuilder builder() { + return new CommentDeleteBuilder(); + } + + public static final class CommentDeleteBuilder { + + private CommentDeleteBuilder() {} + + public CommentDeleteParams build() { + return new CommentDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/comment/params/DeleteCommentParams.java b/src/main/java/com/chargebee/v4/models/comment/params/DeleteCommentParams.java deleted file mode 100644 index ccde52bb..00000000 --- a/src/main/java/com/chargebee/v4/models/comment/params/DeleteCommentParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.comment.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteCommentParams { - - private DeleteCommentParams(DeleteCommentBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteCommentParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteCommentBuilder builder() { - return new DeleteCommentBuilder(); - } - - public static final class DeleteCommentBuilder { - - private DeleteCommentBuilder() {} - - public DeleteCommentParams build() { - return new DeleteCommentParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/comment/responses/CommentDeleteResponse.java b/src/main/java/com/chargebee/v4/models/comment/responses/CommentDeleteResponse.java new file mode 100644 index 00000000..1a3692d3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/comment/responses/CommentDeleteResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.comment.responses; + +import com.chargebee.v4.models.comment.Comment; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CommentDelete operation. Contains the response data from the API. + */ +public final class CommentDeleteResponse extends BaseResponse { + private final Comment comment; + + private CommentDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.comment = builder.comment; + } + + /** Parse JSON response into CommentDeleteResponse object. */ + public static CommentDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CommentDeleteResponse object with HTTP response. */ + public static CommentDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __commentJson = JsonUtil.getObject(json, "comment"); + if (__commentJson != null) { + builder.comment(Comment.fromJson(__commentJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CommentDeleteResponse from JSON", e); + } + } + + /** Create a new builder for CommentDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CommentDeleteResponse. */ + public static class Builder { + + private Comment comment; + + private Response httpResponse; + + private Builder() {} + + public Builder comment(Comment comment) { + this.comment = comment; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CommentDeleteResponse build() { + return new CommentDeleteResponse(this); + } + } + + /** Get the comment from the response. */ + public Comment getComment() { + return comment; + } +} diff --git a/src/main/java/com/chargebee/v4/models/comment/responses/CommentListResponse.java b/src/main/java/com/chargebee/v4/models/comment/responses/CommentListResponse.java index 8cfd35bd..2df463d7 100644 --- a/src/main/java/com/chargebee/v4/models/comment/responses/CommentListResponse.java +++ b/src/main/java/com/chargebee/v4/models/comment/responses/CommentListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.comment.Comment; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.CommentService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public CommentListResponse nextPage() throws Exception { + public CommentListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/comment/responses/DeleteCommentResponse.java b/src/main/java/com/chargebee/v4/models/comment/responses/DeleteCommentResponse.java deleted file mode 100644 index bc77ad55..00000000 --- a/src/main/java/com/chargebee/v4/models/comment/responses/DeleteCommentResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.comment.responses; - -import com.chargebee.v4.models.comment.Comment; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteComment operation. Contains the response data from the API. - */ -public final class DeleteCommentResponse extends BaseResponse { - private final Comment comment; - - private DeleteCommentResponse(Builder builder) { - super(builder.httpResponse); - - this.comment = builder.comment; - } - - /** Parse JSON response into DeleteCommentResponse object. */ - public static DeleteCommentResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteCommentResponse object with HTTP response. */ - public static DeleteCommentResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __commentJson = JsonUtil.getObject(json, "comment"); - if (__commentJson != null) { - builder.comment(Comment.fromJson(__commentJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteCommentResponse from JSON", e); - } - } - - /** Create a new builder for DeleteCommentResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteCommentResponse. */ - public static class Builder { - - private Comment comment; - - private Response httpResponse; - - private Builder() {} - - public Builder comment(Comment comment) { - this.comment = comment; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteCommentResponse build() { - return new DeleteCommentResponse(this); - } - } - - /** Get the comment from the response. */ - public Comment getComment() { - return comment; - } -} diff --git a/src/main/java/com/chargebee/v4/models/configuration/params/ConfigurationExecuteParams.java b/src/main/java/com/chargebee/v4/models/configuration/params/ConfigurationExecuteParams.java deleted file mode 100644 index 280a3511..00000000 --- a/src/main/java/com/chargebee/v4/models/configuration/params/ConfigurationExecuteParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.configuration.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ConfigurationExecuteParams { - - private final Map queryParams; - - private ConfigurationExecuteParams(ConfigurationExecuteBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public ConfigurationExecuteBuilder toBuilder() { - ConfigurationExecuteBuilder builder = new ConfigurationExecuteBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for ConfigurationExecuteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ConfigurationExecuteBuilder builder() { - return new ConfigurationExecuteBuilder(); - } - - public static final class ConfigurationExecuteBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private ConfigurationExecuteBuilder() {} - - public ConfigurationExecuteParams build() { - return new ConfigurationExecuteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/configuration/params/ConfigurationListParams.java b/src/main/java/com/chargebee/v4/models/configuration/params/ConfigurationListParams.java new file mode 100644 index 00000000..a036accc --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/configuration/params/ConfigurationListParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.configuration.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ConfigurationListParams { + + private final Map queryParams; + + private ConfigurationListParams(ConfigurationListBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public ConfigurationListBuilder toBuilder() { + ConfigurationListBuilder builder = new ConfigurationListBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for ConfigurationListParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ConfigurationListBuilder builder() { + return new ConfigurationListBuilder(); + } + + public static final class ConfigurationListBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private ConfigurationListBuilder() {} + + public ConfigurationListParams build() { + return new ConfigurationListParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/configuration/responses/ConfigurationExecuteResponse.java b/src/main/java/com/chargebee/v4/models/configuration/responses/ConfigurationExecuteResponse.java deleted file mode 100644 index 28861001..00000000 --- a/src/main/java/com/chargebee/v4/models/configuration/responses/ConfigurationExecuteResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.configuration.responses; - -import com.chargebee.v4.models.configuration.Configuration; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import java.util.List; - -/** - * Immutable response object for ConfigurationExecute operation. Contains the response data from a - * single resource get operation. - */ -public final class ConfigurationExecuteResponse extends BaseResponse { - private final List configurations; - - private ConfigurationExecuteResponse(Builder builder) { - super(builder.httpResponse); - - this.configurations = builder.configurations; - } - - /** Parse JSON response into ConfigurationExecuteResponse object. */ - public static ConfigurationExecuteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ConfigurationExecuteResponse object with HTTP response. */ - public static ConfigurationExecuteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __configurationsJson = JsonUtil.getArray(json, "configurations"); - if (__configurationsJson != null) { - builder.configurations( - JsonUtil.parseObjectArray(__configurationsJson).stream() - .map(Configuration::fromJson) - .collect(java.util.stream.Collectors.toList())); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ConfigurationExecuteResponse from JSON", e); - } - } - - /** Create a new builder for ConfigurationExecuteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ConfigurationExecuteResponse. */ - public static class Builder { - - private List configurations; - - private Response httpResponse; - - private Builder() {} - - public Builder configurations(List configurations) { - this.configurations = configurations; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ConfigurationExecuteResponse build() { - return new ConfigurationExecuteResponse(this); - } - } - - /** Get the configurations from the response. */ - public List getConfigurations() { - return configurations; - } -} diff --git a/src/main/java/com/chargebee/v4/models/configuration/responses/ConfigurationListResponse.java b/src/main/java/com/chargebee/v4/models/configuration/responses/ConfigurationListResponse.java new file mode 100644 index 00000000..b10b121f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/configuration/responses/ConfigurationListResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.configuration.responses; + +import com.chargebee.v4.models.configuration.Configuration; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import java.util.List; + +/** + * Immutable response object for ConfigurationList operation. Contains the response data from a + * single resource get operation. + */ +public final class ConfigurationListResponse extends BaseResponse { + private final List configurations; + + private ConfigurationListResponse(Builder builder) { + super(builder.httpResponse); + + this.configurations = builder.configurations; + } + + /** Parse JSON response into ConfigurationListResponse object. */ + public static ConfigurationListResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into ConfigurationListResponse object with HTTP response. */ + public static ConfigurationListResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __configurationsJson = JsonUtil.getArray(json, "configurations"); + if (__configurationsJson != null) { + builder.configurations( + JsonUtil.parseObjectArray(__configurationsJson).stream() + .map(Configuration::fromJson) + .collect(java.util.stream.Collectors.toList())); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse ConfigurationListResponse from JSON", e); + } + } + + /** Create a new builder for ConfigurationListResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ConfigurationListResponse. */ + public static class Builder { + + private List configurations; + + private Response httpResponse; + + private Builder() {} + + public Builder configurations(List configurations) { + this.configurations = configurations; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public ConfigurationListResponse build() { + return new ConfigurationListResponse(this); + } + } + + /** Get the configurations from the response. */ + public List getConfigurations() { + return configurations; + } +} diff --git a/src/main/java/com/chargebee/v4/models/coupon/params/CouponDeleteParams.java b/src/main/java/com/chargebee/v4/models/coupon/params/CouponDeleteParams.java new file mode 100644 index 00000000..59b03b04 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/coupon/params/CouponDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.coupon.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CouponDeleteParams { + + private CouponDeleteParams(CouponDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CouponDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponDeleteBuilder builder() { + return new CouponDeleteBuilder(); + } + + public static final class CouponDeleteBuilder { + + private CouponDeleteBuilder() {} + + public CouponDeleteParams build() { + return new CouponDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/coupon/params/CouponUnarchiveParams.java b/src/main/java/com/chargebee/v4/models/coupon/params/CouponUnarchiveParams.java new file mode 100644 index 00000000..9a7586ab --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/coupon/params/CouponUnarchiveParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.coupon.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CouponUnarchiveParams { + + private CouponUnarchiveParams(CouponUnarchiveBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CouponUnarchiveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponUnarchiveBuilder builder() { + return new CouponUnarchiveBuilder(); + } + + public static final class CouponUnarchiveBuilder { + + private CouponUnarchiveBuilder() {} + + public CouponUnarchiveParams build() { + return new CouponUnarchiveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/coupon/params/CouponUpdateForItemsParams.java b/src/main/java/com/chargebee/v4/models/coupon/params/CouponUpdateForItemsParams.java new file mode 100644 index 00000000..a2036436 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/coupon/params/CouponUpdateForItemsParams.java @@ -0,0 +1,1104 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.coupon.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class CouponUpdateForItemsParams { + + private final String name; + + private final String invoiceName; + + private final DiscountType discountType; + + private final Long discountAmount; + + private final String currencyCode; + + private final Number discountPercentage; + + private final Integer discountQuantity; + + private final ApplyOn applyOn; + + private final DurationType durationType; + + private final Integer durationMonth; + + private final Timestamp validFrom; + + private final Timestamp validTill; + + private final Integer maxRedemptions; + + private final String invoiceNotes; + + private final java.util.Map metaData; + + private final Boolean includedInMrr; + + private final Integer period; + + private final PeriodUnit periodUnit; + + private final List itemConstraints; + + private final List itemConstraintCriteria; + + private final List couponConstraints; + + private final Map customFields; + + private CouponUpdateForItemsParams(CouponUpdateForItemsBuilder builder) { + + this.name = builder.name; + + this.invoiceName = builder.invoiceName; + + this.discountType = builder.discountType; + + this.discountAmount = builder.discountAmount; + + this.currencyCode = builder.currencyCode; + + this.discountPercentage = builder.discountPercentage; + + this.discountQuantity = builder.discountQuantity; + + this.applyOn = builder.applyOn; + + this.durationType = builder.durationType; + + this.durationMonth = builder.durationMonth; + + this.validFrom = builder.validFrom; + + this.validTill = builder.validTill; + + this.maxRedemptions = builder.maxRedemptions; + + this.invoiceNotes = builder.invoiceNotes; + + this.metaData = builder.metaData; + + this.includedInMrr = builder.includedInMrr; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + + this.itemConstraints = builder.itemConstraints; + + this.itemConstraintCriteria = builder.itemConstraintCriteria; + + this.couponConstraints = builder.couponConstraints; + + this.customFields = + builder.customFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); + } + + public String getName() { + return name; + } + + public String getInvoiceName() { + return invoiceName; + } + + public DiscountType getDiscountType() { + return discountType; + } + + public Long getDiscountAmount() { + return discountAmount; + } + + public String getCurrencyCode() { + return currencyCode; + } + + public Number getDiscountPercentage() { + return discountPercentage; + } + + public Integer getDiscountQuantity() { + return discountQuantity; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public DurationType getDurationType() { + return durationType; + } + + public Integer getDurationMonth() { + return durationMonth; + } + + public Timestamp getValidFrom() { + return validFrom; + } + + public Timestamp getValidTill() { + return validTill; + } + + public Integer getMaxRedemptions() { + return maxRedemptions; + } + + public String getInvoiceNotes() { + return invoiceNotes; + } + + public java.util.Map getMetaData() { + return metaData; + } + + public Boolean getIncludedInMrr() { + return includedInMrr; + } + + public Integer getPeriod() { + return period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public List getItemConstraints() { + return itemConstraints; + } + + public List getItemConstraintCriteria() { + return itemConstraintCriteria; + } + + public List getCouponConstraints() { + return couponConstraints; + } + + public Map customFields() { + return customFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.name != null) { + + formData.put("name", this.name); + } + + if (this.invoiceName != null) { + + formData.put("invoice_name", this.invoiceName); + } + + if (this.discountType != null) { + + formData.put("discount_type", this.discountType); + } + + if (this.discountAmount != null) { + + formData.put("discount_amount", this.discountAmount); + } + + if (this.currencyCode != null) { + + formData.put("currency_code", this.currencyCode); + } + + if (this.discountPercentage != null) { + + formData.put("discount_percentage", this.discountPercentage); + } + + if (this.discountQuantity != null) { + + formData.put("discount_quantity", this.discountQuantity); + } + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.durationType != null) { + + formData.put("duration_type", this.durationType); + } + + if (this.durationMonth != null) { + + formData.put("duration_month", this.durationMonth); + } + + if (this.validFrom != null) { + + formData.put("valid_from", this.validFrom); + } + + if (this.validTill != null) { + + formData.put("valid_till", this.validTill); + } + + if (this.maxRedemptions != null) { + + formData.put("max_redemptions", this.maxRedemptions); + } + + if (this.invoiceNotes != null) { + + formData.put("invoice_notes", this.invoiceNotes); + } + + if (this.metaData != null) { + + formData.put("meta_data", JsonUtil.toJson(this.metaData)); + } + + if (this.includedInMrr != null) { + + formData.put("included_in_mrr", this.includedInMrr); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.itemConstraints != null) { + + // List of objects + for (int i = 0; i < this.itemConstraints.size(); i++) { + ItemConstraintsParams item = this.itemConstraints.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_constraints[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemConstraintCriteria != null) { + + // List of objects + for (int i = 0; i < this.itemConstraintCriteria.size(); i++) { + ItemConstraintCriteriaParams item = this.itemConstraintCriteria.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_constraint_criteria[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.couponConstraints != null) { + + // List of objects + for (int i = 0; i < this.couponConstraints.size(); i++) { + CouponConstraintsParams item = this.couponConstraints.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "coupon_constraints[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(customFields); + + return formData; + } + + /** Create a new builder for CouponUpdateForItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponUpdateForItemsBuilder builder() { + return new CouponUpdateForItemsBuilder(); + } + + public static final class CouponUpdateForItemsBuilder { + + private String name; + + private String invoiceName; + + private DiscountType discountType; + + private Long discountAmount; + + private String currencyCode; + + private Number discountPercentage; + + private Integer discountQuantity; + + private ApplyOn applyOn; + + private DurationType durationType; + + private Integer durationMonth; + + private Timestamp validFrom; + + private Timestamp validTill; + + private Integer maxRedemptions; + + private String invoiceNotes; + + private java.util.Map metaData; + + private Boolean includedInMrr; + + private Integer period; + + private PeriodUnit periodUnit; + + private List itemConstraints; + + private List itemConstraintCriteria; + + private List couponConstraints; + + private Map customFields = new LinkedHashMap<>(); + + private CouponUpdateForItemsBuilder() {} + + public CouponUpdateForItemsBuilder name(String value) { + this.name = value; + return this; + } + + public CouponUpdateForItemsBuilder invoiceName(String value) { + this.invoiceName = value; + return this; + } + + public CouponUpdateForItemsBuilder discountType(DiscountType value) { + this.discountType = value; + return this; + } + + public CouponUpdateForItemsBuilder discountAmount(Long value) { + this.discountAmount = value; + return this; + } + + public CouponUpdateForItemsBuilder currencyCode(String value) { + this.currencyCode = value; + return this; + } + + public CouponUpdateForItemsBuilder discountPercentage(Number value) { + this.discountPercentage = value; + return this; + } + + public CouponUpdateForItemsBuilder discountQuantity(Integer value) { + this.discountQuantity = value; + return this; + } + + public CouponUpdateForItemsBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public CouponUpdateForItemsBuilder durationType(DurationType value) { + this.durationType = value; + return this; + } + + public CouponUpdateForItemsBuilder durationMonth(Integer value) { + this.durationMonth = value; + return this; + } + + public CouponUpdateForItemsBuilder validFrom(Timestamp value) { + this.validFrom = value; + return this; + } + + public CouponUpdateForItemsBuilder validTill(Timestamp value) { + this.validTill = value; + return this; + } + + public CouponUpdateForItemsBuilder maxRedemptions(Integer value) { + this.maxRedemptions = value; + return this; + } + + public CouponUpdateForItemsBuilder invoiceNotes(String value) { + this.invoiceNotes = value; + return this; + } + + public CouponUpdateForItemsBuilder metaData(java.util.Map value) { + this.metaData = value; + return this; + } + + public CouponUpdateForItemsBuilder includedInMrr(Boolean value) { + this.includedInMrr = value; + return this; + } + + public CouponUpdateForItemsBuilder period(Integer value) { + this.period = value; + return this; + } + + public CouponUpdateForItemsBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public CouponUpdateForItemsBuilder itemConstraints(List value) { + this.itemConstraints = value; + return this; + } + + public CouponUpdateForItemsBuilder itemConstraintCriteria( + List value) { + this.itemConstraintCriteria = value; + return this; + } + + public CouponUpdateForItemsBuilder couponConstraints(List value) { + this.couponConstraints = value; + return this; + } + + /** + * Add a custom field to the request. Custom fields must start with "cf_". + * + * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") + * @param value the value of the custom field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cf_" + */ + public CouponUpdateForItemsBuilder customField(String fieldName, String value) { + if (fieldName == null || !fieldName.startsWith("cf_")) { + throw new IllegalArgumentException("Custom field name must start with 'cf_'"); + } + this.customFields.put(fieldName, value); + return this; + } + + /** + * Add multiple custom fields to the request. All field names must start with "cf_". + * + * @param customFields map of custom field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cf_" + */ + public CouponUpdateForItemsBuilder customFields(Map customFields) { + if (customFields != null) { + for (Map.Entry entry : customFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { + throw new IllegalArgumentException( + "Custom field name must start with 'cf_': " + entry.getKey()); + } + this.customFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CouponUpdateForItemsParams build() { + return new CouponUpdateForItemsParams(this); + } + } + + public enum DiscountType { + FIXED_AMOUNT("fixed_amount"), + + PERCENTAGE("percentage"), + + OFFER_QUANTITY("offer_quantity"), + + /** An enum member indicating that DiscountType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DiscountType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DiscountType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DiscountType enumValue : DiscountType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIED_ITEMS_TOTAL("specified_items_total"), + + EACH_SPECIFIED_ITEM("each_specified_item"), + + EACH_UNIT_OF_SPECIFIED_ITEMS("each_unit_of_specified_items"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum DurationType { + ONE_TIME("one_time"), + + FOREVER("forever"), + + LIMITED_PERIOD("limited_period"), + + /** An enum member indicating that DurationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DurationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DurationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DurationType enumValue : DurationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class ItemConstraintsParams { + + private final Constraint constraint; + + private final ItemType itemType; + + private final List itemPriceIds; + + private ItemConstraintsParams(ItemConstraintsBuilder builder) { + + this.constraint = builder.constraint; + + this.itemType = builder.itemType; + + this.itemPriceIds = builder.itemPriceIds; + } + + public Constraint getConstraint() { + return constraint; + } + + public ItemType getItemType() { + return itemType; + } + + public List getItemPriceIds() { + return itemPriceIds; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.constraint != null) { + + formData.put("constraint", this.constraint); + } + + if (this.itemType != null) { + + formData.put("item_type", this.itemType); + } + + if (this.itemPriceIds != null) { + + formData.put("item_price_ids", JsonUtil.toJson(this.itemPriceIds)); + } + + return formData; + } + + /** Create a new builder for ItemConstraintsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemConstraintsBuilder builder() { + return new ItemConstraintsBuilder(); + } + + public static final class ItemConstraintsBuilder { + + private Constraint constraint; + + private ItemType itemType; + + private List itemPriceIds; + + private ItemConstraintsBuilder() {} + + public ItemConstraintsBuilder constraint(Constraint value) { + this.constraint = value; + return this; + } + + public ItemConstraintsBuilder itemType(ItemType value) { + this.itemType = value; + return this; + } + + public ItemConstraintsBuilder itemPriceIds(List value) { + this.itemPriceIds = value; + return this; + } + + public ItemConstraintsParams build() { + return new ItemConstraintsParams(this); + } + } + + public enum Constraint { + NONE("none"), + + ALL("all"), + + SPECIFIC("specific"), + + CRITERIA("criteria"), + + /** An enum member indicating that Constraint was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Constraint(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Constraint fromString(String value) { + if (value == null) return _UNKNOWN; + for (Constraint enumValue : Constraint.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ItemType { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemType enumValue : ItemType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemConstraintCriteriaParams { + + private final ItemType itemType; + + private final List itemFamilyIds; + + private final List currencies; + + private final List itemPricePeriods; + + private ItemConstraintCriteriaParams(ItemConstraintCriteriaBuilder builder) { + + this.itemType = builder.itemType; + + this.itemFamilyIds = builder.itemFamilyIds; + + this.currencies = builder.currencies; + + this.itemPricePeriods = builder.itemPricePeriods; + } + + public ItemType getItemType() { + return itemType; + } + + public List getItemFamilyIds() { + return itemFamilyIds; + } + + public List getCurrencies() { + return currencies; + } + + public List getItemPricePeriods() { + return itemPricePeriods; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemType != null) { + + formData.put("item_type", this.itemType); + } + + if (this.itemFamilyIds != null) { + + formData.put("item_family_ids", JsonUtil.toJson(this.itemFamilyIds)); + } + + if (this.currencies != null) { + + formData.put("currencies", JsonUtil.toJson(this.currencies)); + } + + if (this.itemPricePeriods != null) { + + formData.put("item_price_periods", JsonUtil.toJson(this.itemPricePeriods)); + } + + return formData; + } + + /** Create a new builder for ItemConstraintCriteriaParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemConstraintCriteriaBuilder builder() { + return new ItemConstraintCriteriaBuilder(); + } + + public static final class ItemConstraintCriteriaBuilder { + + private ItemType itemType; + + private List itemFamilyIds; + + private List currencies; + + private List itemPricePeriods; + + private ItemConstraintCriteriaBuilder() {} + + public ItemConstraintCriteriaBuilder itemType(ItemType value) { + this.itemType = value; + return this; + } + + public ItemConstraintCriteriaBuilder itemFamilyIds(List value) { + this.itemFamilyIds = value; + return this; + } + + public ItemConstraintCriteriaBuilder currencies(List value) { + this.currencies = value; + return this; + } + + public ItemConstraintCriteriaBuilder itemPricePeriods(List value) { + this.itemPricePeriods = value; + return this; + } + + public ItemConstraintCriteriaParams build() { + return new ItemConstraintCriteriaParams(this); + } + } + + public enum ItemType { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemType enumValue : ItemType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CouponConstraintsParams { + + private final EntityType entityType; + + private final Type type; + + private final String value; + + private CouponConstraintsParams(CouponConstraintsBuilder builder) { + + this.entityType = builder.entityType; + + this.type = builder.type; + + this.value = builder.value; + } + + public EntityType getEntityType() { + return entityType; + } + + public Type getType() { + return type; + } + + public String getValue() { + return value; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.entityType != null) { + + formData.put("entity_type", this.entityType); + } + + if (this.type != null) { + + formData.put("type", this.type); + } + + if (this.value != null) { + + formData.put("value", this.value); + } + + return formData; + } + + /** Create a new builder for CouponConstraintsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponConstraintsBuilder builder() { + return new CouponConstraintsBuilder(); + } + + public static final class CouponConstraintsBuilder { + + private EntityType entityType; + + private Type type; + + private String value; + + private CouponConstraintsBuilder() {} + + public CouponConstraintsBuilder entityType(EntityType value) { + this.entityType = value; + return this; + } + + public CouponConstraintsBuilder type(Type value) { + this.type = value; + return this; + } + + public CouponConstraintsBuilder value(String value) { + this.value = value; + return this; + } + + public CouponConstraintsParams build() { + return new CouponConstraintsParams(this); + } + } + + public enum EntityType { + CUSTOMER("customer"), + + /** An enum member indicating that EntityType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + EntityType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EntityType fromString(String value) { + if (value == null) return _UNKNOWN; + for (EntityType enumValue : EntityType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum Type { + MAX_REDEMPTIONS("max_redemptions"), + + UNIQUE_BY("unique_by"), + + EXISTING_CUSTOMER("existing_customer"), + + NEW_CUSTOMER("new_customer"), + + /** An enum member indicating that Type was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Type(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Type fromString(String value) { + if (value == null) return _UNKNOWN; + for (Type enumValue : Type.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/coupon/params/DeleteCouponParams.java b/src/main/java/com/chargebee/v4/models/coupon/params/DeleteCouponParams.java deleted file mode 100644 index 7bd0d56d..00000000 --- a/src/main/java/com/chargebee/v4/models/coupon/params/DeleteCouponParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.coupon.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteCouponParams { - - private DeleteCouponParams(DeleteCouponBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteCouponParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteCouponBuilder builder() { - return new DeleteCouponBuilder(); - } - - public static final class DeleteCouponBuilder { - - private DeleteCouponBuilder() {} - - public DeleteCouponParams build() { - return new DeleteCouponParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/coupon/params/UnarchiveForCouponParams.java b/src/main/java/com/chargebee/v4/models/coupon/params/UnarchiveForCouponParams.java deleted file mode 100644 index b96a3868..00000000 --- a/src/main/java/com/chargebee/v4/models/coupon/params/UnarchiveForCouponParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.coupon.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UnarchiveForCouponParams { - - private UnarchiveForCouponParams(UnarchiveForCouponBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for UnarchiveForCouponParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UnarchiveForCouponBuilder builder() { - return new UnarchiveForCouponBuilder(); - } - - public static final class UnarchiveForCouponBuilder { - - private UnarchiveForCouponBuilder() {} - - public UnarchiveForCouponParams build() { - return new UnarchiveForCouponParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/coupon/params/UpdateForItemsForCouponParams.java b/src/main/java/com/chargebee/v4/models/coupon/params/UpdateForItemsForCouponParams.java deleted file mode 100644 index 59d26b63..00000000 --- a/src/main/java/com/chargebee/v4/models/coupon/params/UpdateForItemsForCouponParams.java +++ /dev/null @@ -1,1104 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.coupon.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class UpdateForItemsForCouponParams { - - private final String name; - - private final String invoiceName; - - private final DiscountType discountType; - - private final Long discountAmount; - - private final String currencyCode; - - private final Number discountPercentage; - - private final Integer discountQuantity; - - private final ApplyOn applyOn; - - private final DurationType durationType; - - private final Integer durationMonth; - - private final Timestamp validFrom; - - private final Timestamp validTill; - - private final Integer maxRedemptions; - - private final String invoiceNotes; - - private final java.util.Map metaData; - - private final Boolean includedInMrr; - - private final Integer period; - - private final PeriodUnit periodUnit; - - private final List itemConstraints; - - private final List itemConstraintCriteria; - - private final List couponConstraints; - - private final Map customFields; - - private UpdateForItemsForCouponParams(UpdateForItemsForCouponBuilder builder) { - - this.name = builder.name; - - this.invoiceName = builder.invoiceName; - - this.discountType = builder.discountType; - - this.discountAmount = builder.discountAmount; - - this.currencyCode = builder.currencyCode; - - this.discountPercentage = builder.discountPercentage; - - this.discountQuantity = builder.discountQuantity; - - this.applyOn = builder.applyOn; - - this.durationType = builder.durationType; - - this.durationMonth = builder.durationMonth; - - this.validFrom = builder.validFrom; - - this.validTill = builder.validTill; - - this.maxRedemptions = builder.maxRedemptions; - - this.invoiceNotes = builder.invoiceNotes; - - this.metaData = builder.metaData; - - this.includedInMrr = builder.includedInMrr; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - - this.itemConstraints = builder.itemConstraints; - - this.itemConstraintCriteria = builder.itemConstraintCriteria; - - this.couponConstraints = builder.couponConstraints; - - this.customFields = - builder.customFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); - } - - public String getName() { - return name; - } - - public String getInvoiceName() { - return invoiceName; - } - - public DiscountType getDiscountType() { - return discountType; - } - - public Long getDiscountAmount() { - return discountAmount; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public Number getDiscountPercentage() { - return discountPercentage; - } - - public Integer getDiscountQuantity() { - return discountQuantity; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public DurationType getDurationType() { - return durationType; - } - - public Integer getDurationMonth() { - return durationMonth; - } - - public Timestamp getValidFrom() { - return validFrom; - } - - public Timestamp getValidTill() { - return validTill; - } - - public Integer getMaxRedemptions() { - return maxRedemptions; - } - - public String getInvoiceNotes() { - return invoiceNotes; - } - - public java.util.Map getMetaData() { - return metaData; - } - - public Boolean getIncludedInMrr() { - return includedInMrr; - } - - public Integer getPeriod() { - return period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public List getItemConstraints() { - return itemConstraints; - } - - public List getItemConstraintCriteria() { - return itemConstraintCriteria; - } - - public List getCouponConstraints() { - return couponConstraints; - } - - public Map customFields() { - return customFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.name != null) { - - formData.put("name", this.name); - } - - if (this.invoiceName != null) { - - formData.put("invoice_name", this.invoiceName); - } - - if (this.discountType != null) { - - formData.put("discount_type", this.discountType); - } - - if (this.discountAmount != null) { - - formData.put("discount_amount", this.discountAmount); - } - - if (this.currencyCode != null) { - - formData.put("currency_code", this.currencyCode); - } - - if (this.discountPercentage != null) { - - formData.put("discount_percentage", this.discountPercentage); - } - - if (this.discountQuantity != null) { - - formData.put("discount_quantity", this.discountQuantity); - } - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.durationType != null) { - - formData.put("duration_type", this.durationType); - } - - if (this.durationMonth != null) { - - formData.put("duration_month", this.durationMonth); - } - - if (this.validFrom != null) { - - formData.put("valid_from", this.validFrom); - } - - if (this.validTill != null) { - - formData.put("valid_till", this.validTill); - } - - if (this.maxRedemptions != null) { - - formData.put("max_redemptions", this.maxRedemptions); - } - - if (this.invoiceNotes != null) { - - formData.put("invoice_notes", this.invoiceNotes); - } - - if (this.metaData != null) { - - formData.put("meta_data", JsonUtil.toJson(this.metaData)); - } - - if (this.includedInMrr != null) { - - formData.put("included_in_mrr", this.includedInMrr); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.itemConstraints != null) { - - // List of objects - for (int i = 0; i < this.itemConstraints.size(); i++) { - ItemConstraintsParams item = this.itemConstraints.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_constraints[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemConstraintCriteria != null) { - - // List of objects - for (int i = 0; i < this.itemConstraintCriteria.size(); i++) { - ItemConstraintCriteriaParams item = this.itemConstraintCriteria.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_constraint_criteria[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.couponConstraints != null) { - - // List of objects - for (int i = 0; i < this.couponConstraints.size(); i++) { - CouponConstraintsParams item = this.couponConstraints.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "coupon_constraints[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(customFields); - - return formData; - } - - /** Create a new builder for UpdateForItemsForCouponParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateForItemsForCouponBuilder builder() { - return new UpdateForItemsForCouponBuilder(); - } - - public static final class UpdateForItemsForCouponBuilder { - - private String name; - - private String invoiceName; - - private DiscountType discountType; - - private Long discountAmount; - - private String currencyCode; - - private Number discountPercentage; - - private Integer discountQuantity; - - private ApplyOn applyOn; - - private DurationType durationType; - - private Integer durationMonth; - - private Timestamp validFrom; - - private Timestamp validTill; - - private Integer maxRedemptions; - - private String invoiceNotes; - - private java.util.Map metaData; - - private Boolean includedInMrr; - - private Integer period; - - private PeriodUnit periodUnit; - - private List itemConstraints; - - private List itemConstraintCriteria; - - private List couponConstraints; - - private Map customFields = new LinkedHashMap<>(); - - private UpdateForItemsForCouponBuilder() {} - - public UpdateForItemsForCouponBuilder name(String value) { - this.name = value; - return this; - } - - public UpdateForItemsForCouponBuilder invoiceName(String value) { - this.invoiceName = value; - return this; - } - - public UpdateForItemsForCouponBuilder discountType(DiscountType value) { - this.discountType = value; - return this; - } - - public UpdateForItemsForCouponBuilder discountAmount(Long value) { - this.discountAmount = value; - return this; - } - - public UpdateForItemsForCouponBuilder currencyCode(String value) { - this.currencyCode = value; - return this; - } - - public UpdateForItemsForCouponBuilder discountPercentage(Number value) { - this.discountPercentage = value; - return this; - } - - public UpdateForItemsForCouponBuilder discountQuantity(Integer value) { - this.discountQuantity = value; - return this; - } - - public UpdateForItemsForCouponBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public UpdateForItemsForCouponBuilder durationType(DurationType value) { - this.durationType = value; - return this; - } - - public UpdateForItemsForCouponBuilder durationMonth(Integer value) { - this.durationMonth = value; - return this; - } - - public UpdateForItemsForCouponBuilder validFrom(Timestamp value) { - this.validFrom = value; - return this; - } - - public UpdateForItemsForCouponBuilder validTill(Timestamp value) { - this.validTill = value; - return this; - } - - public UpdateForItemsForCouponBuilder maxRedemptions(Integer value) { - this.maxRedemptions = value; - return this; - } - - public UpdateForItemsForCouponBuilder invoiceNotes(String value) { - this.invoiceNotes = value; - return this; - } - - public UpdateForItemsForCouponBuilder metaData(java.util.Map value) { - this.metaData = value; - return this; - } - - public UpdateForItemsForCouponBuilder includedInMrr(Boolean value) { - this.includedInMrr = value; - return this; - } - - public UpdateForItemsForCouponBuilder period(Integer value) { - this.period = value; - return this; - } - - public UpdateForItemsForCouponBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public UpdateForItemsForCouponBuilder itemConstraints(List value) { - this.itemConstraints = value; - return this; - } - - public UpdateForItemsForCouponBuilder itemConstraintCriteria( - List value) { - this.itemConstraintCriteria = value; - return this; - } - - public UpdateForItemsForCouponBuilder couponConstraints(List value) { - this.couponConstraints = value; - return this; - } - - /** - * Add a custom field to the request. Custom fields must start with "cf_". - * - * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") - * @param value the value of the custom field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cf_" - */ - public UpdateForItemsForCouponBuilder customField(String fieldName, String value) { - if (fieldName == null || !fieldName.startsWith("cf_")) { - throw new IllegalArgumentException("Custom field name must start with 'cf_'"); - } - this.customFields.put(fieldName, value); - return this; - } - - /** - * Add multiple custom fields to the request. All field names must start with "cf_". - * - * @param customFields map of custom field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cf_" - */ - public UpdateForItemsForCouponBuilder customFields(Map customFields) { - if (customFields != null) { - for (Map.Entry entry : customFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { - throw new IllegalArgumentException( - "Custom field name must start with 'cf_': " + entry.getKey()); - } - this.customFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public UpdateForItemsForCouponParams build() { - return new UpdateForItemsForCouponParams(this); - } - } - - public enum DiscountType { - FIXED_AMOUNT("fixed_amount"), - - PERCENTAGE("percentage"), - - OFFER_QUANTITY("offer_quantity"), - - /** An enum member indicating that DiscountType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DiscountType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DiscountType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DiscountType enumValue : DiscountType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIED_ITEMS_TOTAL("specified_items_total"), - - EACH_SPECIFIED_ITEM("each_specified_item"), - - EACH_UNIT_OF_SPECIFIED_ITEMS("each_unit_of_specified_items"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum DurationType { - ONE_TIME("one_time"), - - FOREVER("forever"), - - LIMITED_PERIOD("limited_period"), - - /** An enum member indicating that DurationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DurationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DurationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DurationType enumValue : DurationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class ItemConstraintsParams { - - private final Constraint constraint; - - private final ItemType itemType; - - private final List itemPriceIds; - - private ItemConstraintsParams(ItemConstraintsBuilder builder) { - - this.constraint = builder.constraint; - - this.itemType = builder.itemType; - - this.itemPriceIds = builder.itemPriceIds; - } - - public Constraint getConstraint() { - return constraint; - } - - public ItemType getItemType() { - return itemType; - } - - public List getItemPriceIds() { - return itemPriceIds; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.constraint != null) { - - formData.put("constraint", this.constraint); - } - - if (this.itemType != null) { - - formData.put("item_type", this.itemType); - } - - if (this.itemPriceIds != null) { - - formData.put("item_price_ids", JsonUtil.toJson(this.itemPriceIds)); - } - - return formData; - } - - /** Create a new builder for ItemConstraintsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemConstraintsBuilder builder() { - return new ItemConstraintsBuilder(); - } - - public static final class ItemConstraintsBuilder { - - private Constraint constraint; - - private ItemType itemType; - - private List itemPriceIds; - - private ItemConstraintsBuilder() {} - - public ItemConstraintsBuilder constraint(Constraint value) { - this.constraint = value; - return this; - } - - public ItemConstraintsBuilder itemType(ItemType value) { - this.itemType = value; - return this; - } - - public ItemConstraintsBuilder itemPriceIds(List value) { - this.itemPriceIds = value; - return this; - } - - public ItemConstraintsParams build() { - return new ItemConstraintsParams(this); - } - } - - public enum Constraint { - NONE("none"), - - ALL("all"), - - SPECIFIC("specific"), - - CRITERIA("criteria"), - - /** An enum member indicating that Constraint was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Constraint(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Constraint fromString(String value) { - if (value == null) return _UNKNOWN; - for (Constraint enumValue : Constraint.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ItemType { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemType enumValue : ItemType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemConstraintCriteriaParams { - - private final ItemType itemType; - - private final List itemFamilyIds; - - private final List currencies; - - private final List itemPricePeriods; - - private ItemConstraintCriteriaParams(ItemConstraintCriteriaBuilder builder) { - - this.itemType = builder.itemType; - - this.itemFamilyIds = builder.itemFamilyIds; - - this.currencies = builder.currencies; - - this.itemPricePeriods = builder.itemPricePeriods; - } - - public ItemType getItemType() { - return itemType; - } - - public List getItemFamilyIds() { - return itemFamilyIds; - } - - public List getCurrencies() { - return currencies; - } - - public List getItemPricePeriods() { - return itemPricePeriods; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemType != null) { - - formData.put("item_type", this.itemType); - } - - if (this.itemFamilyIds != null) { - - formData.put("item_family_ids", JsonUtil.toJson(this.itemFamilyIds)); - } - - if (this.currencies != null) { - - formData.put("currencies", JsonUtil.toJson(this.currencies)); - } - - if (this.itemPricePeriods != null) { - - formData.put("item_price_periods", JsonUtil.toJson(this.itemPricePeriods)); - } - - return formData; - } - - /** Create a new builder for ItemConstraintCriteriaParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemConstraintCriteriaBuilder builder() { - return new ItemConstraintCriteriaBuilder(); - } - - public static final class ItemConstraintCriteriaBuilder { - - private ItemType itemType; - - private List itemFamilyIds; - - private List currencies; - - private List itemPricePeriods; - - private ItemConstraintCriteriaBuilder() {} - - public ItemConstraintCriteriaBuilder itemType(ItemType value) { - this.itemType = value; - return this; - } - - public ItemConstraintCriteriaBuilder itemFamilyIds(List value) { - this.itemFamilyIds = value; - return this; - } - - public ItemConstraintCriteriaBuilder currencies(List value) { - this.currencies = value; - return this; - } - - public ItemConstraintCriteriaBuilder itemPricePeriods(List value) { - this.itemPricePeriods = value; - return this; - } - - public ItemConstraintCriteriaParams build() { - return new ItemConstraintCriteriaParams(this); - } - } - - public enum ItemType { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemType enumValue : ItemType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CouponConstraintsParams { - - private final EntityType entityType; - - private final Type type; - - private final String value; - - private CouponConstraintsParams(CouponConstraintsBuilder builder) { - - this.entityType = builder.entityType; - - this.type = builder.type; - - this.value = builder.value; - } - - public EntityType getEntityType() { - return entityType; - } - - public Type getType() { - return type; - } - - public String getValue() { - return value; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.entityType != null) { - - formData.put("entity_type", this.entityType); - } - - if (this.type != null) { - - formData.put("type", this.type); - } - - if (this.value != null) { - - formData.put("value", this.value); - } - - return formData; - } - - /** Create a new builder for CouponConstraintsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CouponConstraintsBuilder builder() { - return new CouponConstraintsBuilder(); - } - - public static final class CouponConstraintsBuilder { - - private EntityType entityType; - - private Type type; - - private String value; - - private CouponConstraintsBuilder() {} - - public CouponConstraintsBuilder entityType(EntityType value) { - this.entityType = value; - return this; - } - - public CouponConstraintsBuilder type(Type value) { - this.type = value; - return this; - } - - public CouponConstraintsBuilder value(String value) { - this.value = value; - return this; - } - - public CouponConstraintsParams build() { - return new CouponConstraintsParams(this); - } - } - - public enum EntityType { - CUSTOMER("customer"), - - /** An enum member indicating that EntityType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - EntityType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static EntityType fromString(String value) { - if (value == null) return _UNKNOWN; - for (EntityType enumValue : EntityType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum Type { - MAX_REDEMPTIONS("max_redemptions"), - - UNIQUE_BY("unique_by"), - - EXISTING_CUSTOMER("existing_customer"), - - NEW_CUSTOMER("new_customer"), - - /** An enum member indicating that Type was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Type(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Type fromString(String value) { - if (value == null) return _UNKNOWN; - for (Type enumValue : Type.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/coupon/responses/CouponDeleteResponse.java b/src/main/java/com/chargebee/v4/models/coupon/responses/CouponDeleteResponse.java new file mode 100644 index 00000000..28aa79b5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/coupon/responses/CouponDeleteResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.coupon.responses; + +import com.chargebee.v4.models.coupon.Coupon; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CouponDelete operation. Contains the response data from the API. + */ +public final class CouponDeleteResponse extends BaseResponse { + private final Coupon coupon; + + private CouponDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.coupon = builder.coupon; + } + + /** Parse JSON response into CouponDeleteResponse object. */ + public static CouponDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CouponDeleteResponse object with HTTP response. */ + public static CouponDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __couponJson = JsonUtil.getObject(json, "coupon"); + if (__couponJson != null) { + builder.coupon(Coupon.fromJson(__couponJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CouponDeleteResponse from JSON", e); + } + } + + /** Create a new builder for CouponDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CouponDeleteResponse. */ + public static class Builder { + + private Coupon coupon; + + private Response httpResponse; + + private Builder() {} + + public Builder coupon(Coupon coupon) { + this.coupon = coupon; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CouponDeleteResponse build() { + return new CouponDeleteResponse(this); + } + } + + /** Get the coupon from the response. */ + public Coupon getCoupon() { + return coupon; + } +} diff --git a/src/main/java/com/chargebee/v4/models/coupon/responses/CouponListResponse.java b/src/main/java/com/chargebee/v4/models/coupon/responses/CouponListResponse.java index ff5c6dc9..afc11db0 100644 --- a/src/main/java/com/chargebee/v4/models/coupon/responses/CouponListResponse.java +++ b/src/main/java/com/chargebee/v4/models/coupon/responses/CouponListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.coupon.Coupon; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.CouponService; @@ -95,9 +96,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public CouponListResponse nextPage() throws Exception { + public CouponListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/coupon/responses/CouponUnarchiveResponse.java b/src/main/java/com/chargebee/v4/models/coupon/responses/CouponUnarchiveResponse.java new file mode 100644 index 00000000..33890d4a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/coupon/responses/CouponUnarchiveResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.coupon.responses; + +import com.chargebee.v4.models.coupon.Coupon; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CouponUnarchive operation. Contains the response data from the API. + */ +public final class CouponUnarchiveResponse extends BaseResponse { + private final Coupon coupon; + + private CouponUnarchiveResponse(Builder builder) { + super(builder.httpResponse); + + this.coupon = builder.coupon; + } + + /** Parse JSON response into CouponUnarchiveResponse object. */ + public static CouponUnarchiveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CouponUnarchiveResponse object with HTTP response. */ + public static CouponUnarchiveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __couponJson = JsonUtil.getObject(json, "coupon"); + if (__couponJson != null) { + builder.coupon(Coupon.fromJson(__couponJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CouponUnarchiveResponse from JSON", e); + } + } + + /** Create a new builder for CouponUnarchiveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CouponUnarchiveResponse. */ + public static class Builder { + + private Coupon coupon; + + private Response httpResponse; + + private Builder() {} + + public Builder coupon(Coupon coupon) { + this.coupon = coupon; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CouponUnarchiveResponse build() { + return new CouponUnarchiveResponse(this); + } + } + + /** Get the coupon from the response. */ + public Coupon getCoupon() { + return coupon; + } +} diff --git a/src/main/java/com/chargebee/v4/models/coupon/responses/CouponUpdateForItemsResponse.java b/src/main/java/com/chargebee/v4/models/coupon/responses/CouponUpdateForItemsResponse.java new file mode 100644 index 00000000..06d37a99 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/coupon/responses/CouponUpdateForItemsResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.coupon.responses; + +import com.chargebee.v4.models.coupon.Coupon; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CouponUpdateForItems operation. Contains the response data from the + * API. + */ +public final class CouponUpdateForItemsResponse extends BaseResponse { + private final Coupon coupon; + + private CouponUpdateForItemsResponse(Builder builder) { + super(builder.httpResponse); + + this.coupon = builder.coupon; + } + + /** Parse JSON response into CouponUpdateForItemsResponse object. */ + public static CouponUpdateForItemsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CouponUpdateForItemsResponse object with HTTP response. */ + public static CouponUpdateForItemsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __couponJson = JsonUtil.getObject(json, "coupon"); + if (__couponJson != null) { + builder.coupon(Coupon.fromJson(__couponJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CouponUpdateForItemsResponse from JSON", e); + } + } + + /** Create a new builder for CouponUpdateForItemsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CouponUpdateForItemsResponse. */ + public static class Builder { + + private Coupon coupon; + + private Response httpResponse; + + private Builder() {} + + public Builder coupon(Coupon coupon) { + this.coupon = coupon; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CouponUpdateForItemsResponse build() { + return new CouponUpdateForItemsResponse(this); + } + } + + /** Get the coupon from the response. */ + public Coupon getCoupon() { + return coupon; + } +} diff --git a/src/main/java/com/chargebee/v4/models/coupon/responses/DeleteCouponResponse.java b/src/main/java/com/chargebee/v4/models/coupon/responses/DeleteCouponResponse.java deleted file mode 100644 index 288eadbe..00000000 --- a/src/main/java/com/chargebee/v4/models/coupon/responses/DeleteCouponResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.coupon.responses; - -import com.chargebee.v4.models.coupon.Coupon; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteCoupon operation. Contains the response data from the API. - */ -public final class DeleteCouponResponse extends BaseResponse { - private final Coupon coupon; - - private DeleteCouponResponse(Builder builder) { - super(builder.httpResponse); - - this.coupon = builder.coupon; - } - - /** Parse JSON response into DeleteCouponResponse object. */ - public static DeleteCouponResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteCouponResponse object with HTTP response. */ - public static DeleteCouponResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __couponJson = JsonUtil.getObject(json, "coupon"); - if (__couponJson != null) { - builder.coupon(Coupon.fromJson(__couponJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteCouponResponse from JSON", e); - } - } - - /** Create a new builder for DeleteCouponResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteCouponResponse. */ - public static class Builder { - - private Coupon coupon; - - private Response httpResponse; - - private Builder() {} - - public Builder coupon(Coupon coupon) { - this.coupon = coupon; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteCouponResponse build() { - return new DeleteCouponResponse(this); - } - } - - /** Get the coupon from the response. */ - public Coupon getCoupon() { - return coupon; - } -} diff --git a/src/main/java/com/chargebee/v4/models/coupon/responses/UnarchiveForCouponResponse.java b/src/main/java/com/chargebee/v4/models/coupon/responses/UnarchiveForCouponResponse.java deleted file mode 100644 index 5c42d58d..00000000 --- a/src/main/java/com/chargebee/v4/models/coupon/responses/UnarchiveForCouponResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.coupon.responses; - -import com.chargebee.v4.models.coupon.Coupon; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UnarchiveForCoupon operation. Contains the response data from the - * API. - */ -public final class UnarchiveForCouponResponse extends BaseResponse { - private final Coupon coupon; - - private UnarchiveForCouponResponse(Builder builder) { - super(builder.httpResponse); - - this.coupon = builder.coupon; - } - - /** Parse JSON response into UnarchiveForCouponResponse object. */ - public static UnarchiveForCouponResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UnarchiveForCouponResponse object with HTTP response. */ - public static UnarchiveForCouponResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __couponJson = JsonUtil.getObject(json, "coupon"); - if (__couponJson != null) { - builder.coupon(Coupon.fromJson(__couponJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UnarchiveForCouponResponse from JSON", e); - } - } - - /** Create a new builder for UnarchiveForCouponResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UnarchiveForCouponResponse. */ - public static class Builder { - - private Coupon coupon; - - private Response httpResponse; - - private Builder() {} - - public Builder coupon(Coupon coupon) { - this.coupon = coupon; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UnarchiveForCouponResponse build() { - return new UnarchiveForCouponResponse(this); - } - } - - /** Get the coupon from the response. */ - public Coupon getCoupon() { - return coupon; - } -} diff --git a/src/main/java/com/chargebee/v4/models/coupon/responses/UpdateForItemsForCouponResponse.java b/src/main/java/com/chargebee/v4/models/coupon/responses/UpdateForItemsForCouponResponse.java deleted file mode 100644 index 44a28c37..00000000 --- a/src/main/java/com/chargebee/v4/models/coupon/responses/UpdateForItemsForCouponResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.coupon.responses; - -import com.chargebee.v4.models.coupon.Coupon; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateForItemsForCoupon operation. Contains the response data from - * the API. - */ -public final class UpdateForItemsForCouponResponse extends BaseResponse { - private final Coupon coupon; - - private UpdateForItemsForCouponResponse(Builder builder) { - super(builder.httpResponse); - - this.coupon = builder.coupon; - } - - /** Parse JSON response into UpdateForItemsForCouponResponse object. */ - public static UpdateForItemsForCouponResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdateForItemsForCouponResponse object with HTTP response. */ - public static UpdateForItemsForCouponResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __couponJson = JsonUtil.getObject(json, "coupon"); - if (__couponJson != null) { - builder.coupon(Coupon.fromJson(__couponJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UpdateForItemsForCouponResponse from JSON", e); - } - } - - /** Create a new builder for UpdateForItemsForCouponResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateForItemsForCouponResponse. */ - public static class Builder { - - private Coupon coupon; - - private Response httpResponse; - - private Builder() {} - - public Builder coupon(Coupon coupon) { - this.coupon = coupon; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateForItemsForCouponResponse build() { - return new UpdateForItemsForCouponResponse(this); - } - } - - /** Get the coupon from the response. */ - public Coupon getCoupon() { - return coupon; - } -} diff --git a/src/main/java/com/chargebee/v4/models/couponCode/params/ArchiveForCouponCodeParams.java b/src/main/java/com/chargebee/v4/models/couponCode/params/ArchiveForCouponCodeParams.java deleted file mode 100644 index d1efe7ec..00000000 --- a/src/main/java/com/chargebee/v4/models/couponCode/params/ArchiveForCouponCodeParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.couponCode.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ArchiveForCouponCodeParams { - - private ArchiveForCouponCodeParams(ArchiveForCouponCodeBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for ArchiveForCouponCodeParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ArchiveForCouponCodeBuilder builder() { - return new ArchiveForCouponCodeBuilder(); - } - - public static final class ArchiveForCouponCodeBuilder { - - private ArchiveForCouponCodeBuilder() {} - - public ArchiveForCouponCodeParams build() { - return new ArchiveForCouponCodeParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/couponCode/params/CouponCodeArchiveParams.java b/src/main/java/com/chargebee/v4/models/couponCode/params/CouponCodeArchiveParams.java new file mode 100644 index 00000000..c64fbd46 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/couponCode/params/CouponCodeArchiveParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.couponCode.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CouponCodeArchiveParams { + + private CouponCodeArchiveParams(CouponCodeArchiveBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CouponCodeArchiveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponCodeArchiveBuilder builder() { + return new CouponCodeArchiveBuilder(); + } + + public static final class CouponCodeArchiveBuilder { + + private CouponCodeArchiveBuilder() {} + + public CouponCodeArchiveParams build() { + return new CouponCodeArchiveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/couponCode/responses/ArchiveForCouponCodeResponse.java b/src/main/java/com/chargebee/v4/models/couponCode/responses/ArchiveForCouponCodeResponse.java deleted file mode 100644 index 3eb8e6ac..00000000 --- a/src/main/java/com/chargebee/v4/models/couponCode/responses/ArchiveForCouponCodeResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.couponCode.responses; - -import com.chargebee.v4.models.couponCode.CouponCode; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ArchiveForCouponCode operation. Contains the response data from the - * API. - */ -public final class ArchiveForCouponCodeResponse extends BaseResponse { - private final CouponCode couponCode; - - private ArchiveForCouponCodeResponse(Builder builder) { - super(builder.httpResponse); - - this.couponCode = builder.couponCode; - } - - /** Parse JSON response into ArchiveForCouponCodeResponse object. */ - public static ArchiveForCouponCodeResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ArchiveForCouponCodeResponse object with HTTP response. */ - public static ArchiveForCouponCodeResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __couponCodeJson = JsonUtil.getObject(json, "coupon_code"); - if (__couponCodeJson != null) { - builder.couponCode(CouponCode.fromJson(__couponCodeJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ArchiveForCouponCodeResponse from JSON", e); - } - } - - /** Create a new builder for ArchiveForCouponCodeResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ArchiveForCouponCodeResponse. */ - public static class Builder { - - private CouponCode couponCode; - - private Response httpResponse; - - private Builder() {} - - public Builder couponCode(CouponCode couponCode) { - this.couponCode = couponCode; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ArchiveForCouponCodeResponse build() { - return new ArchiveForCouponCodeResponse(this); - } - } - - /** Get the couponCode from the response. */ - public CouponCode getCouponCode() { - return couponCode; - } -} diff --git a/src/main/java/com/chargebee/v4/models/couponCode/responses/CouponCodeArchiveResponse.java b/src/main/java/com/chargebee/v4/models/couponCode/responses/CouponCodeArchiveResponse.java new file mode 100644 index 00000000..de47aa1c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/couponCode/responses/CouponCodeArchiveResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.couponCode.responses; + +import com.chargebee.v4.models.couponCode.CouponCode; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CouponCodeArchive operation. Contains the response data from the + * API. + */ +public final class CouponCodeArchiveResponse extends BaseResponse { + private final CouponCode couponCode; + + private CouponCodeArchiveResponse(Builder builder) { + super(builder.httpResponse); + + this.couponCode = builder.couponCode; + } + + /** Parse JSON response into CouponCodeArchiveResponse object. */ + public static CouponCodeArchiveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CouponCodeArchiveResponse object with HTTP response. */ + public static CouponCodeArchiveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __couponCodeJson = JsonUtil.getObject(json, "coupon_code"); + if (__couponCodeJson != null) { + builder.couponCode(CouponCode.fromJson(__couponCodeJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CouponCodeArchiveResponse from JSON", e); + } + } + + /** Create a new builder for CouponCodeArchiveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CouponCodeArchiveResponse. */ + public static class Builder { + + private CouponCode couponCode; + + private Response httpResponse; + + private Builder() {} + + public Builder couponCode(CouponCode couponCode) { + this.couponCode = couponCode; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CouponCodeArchiveResponse build() { + return new CouponCodeArchiveResponse(this); + } + } + + /** Get the couponCode from the response. */ + public CouponCode getCouponCode() { + return couponCode; + } +} diff --git a/src/main/java/com/chargebee/v4/models/couponCode/responses/CouponCodeListResponse.java b/src/main/java/com/chargebee/v4/models/couponCode/responses/CouponCodeListResponse.java index 2117e76f..23ee2c5e 100644 --- a/src/main/java/com/chargebee/v4/models/couponCode/responses/CouponCodeListResponse.java +++ b/src/main/java/com/chargebee/v4/models/couponCode/responses/CouponCodeListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.couponCode.CouponCode; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.CouponCodeService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public CouponCodeListResponse nextPage() throws Exception { + public CouponCodeListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/couponSet/params/AddCouponCodesForCouponSetParams.java b/src/main/java/com/chargebee/v4/models/couponSet/params/AddCouponCodesForCouponSetParams.java deleted file mode 100644 index 5ab67b5d..00000000 --- a/src/main/java/com/chargebee/v4/models/couponSet/params/AddCouponCodesForCouponSetParams.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.couponSet.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class AddCouponCodesForCouponSetParams { - - private final List code; - - private AddCouponCodesForCouponSetParams(AddCouponCodesForCouponSetBuilder builder) { - - this.code = builder.code; - } - - public List getCode() { - return code; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.code != null) { - - formData.put("code", this.code); - } - - return formData; - } - - /** Create a new builder for AddCouponCodesForCouponSetParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddCouponCodesForCouponSetBuilder builder() { - return new AddCouponCodesForCouponSetBuilder(); - } - - public static final class AddCouponCodesForCouponSetBuilder { - - private List code; - - private AddCouponCodesForCouponSetBuilder() {} - - public AddCouponCodesForCouponSetBuilder code(List value) { - this.code = value; - return this; - } - - public AddCouponCodesForCouponSetParams build() { - return new AddCouponCodesForCouponSetParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetAddCouponCodesParams.java b/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetAddCouponCodesParams.java new file mode 100644 index 00000000..15936fcf --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetAddCouponCodesParams.java @@ -0,0 +1,61 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.couponSet.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class CouponSetAddCouponCodesParams { + + private final List code; + + private CouponSetAddCouponCodesParams(CouponSetAddCouponCodesBuilder builder) { + + this.code = builder.code; + } + + public List getCode() { + return code; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.code != null) { + + formData.put("code", this.code); + } + + return formData; + } + + /** Create a new builder for CouponSetAddCouponCodesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponSetAddCouponCodesBuilder builder() { + return new CouponSetAddCouponCodesBuilder(); + } + + public static final class CouponSetAddCouponCodesBuilder { + + private List code; + + private CouponSetAddCouponCodesBuilder() {} + + public CouponSetAddCouponCodesBuilder code(List value) { + this.code = value; + return this; + } + + public CouponSetAddCouponCodesParams build() { + return new CouponSetAddCouponCodesParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetDeleteParams.java b/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetDeleteParams.java new file mode 100644 index 00000000..031d8ebe --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.couponSet.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CouponSetDeleteParams { + + private CouponSetDeleteParams(CouponSetDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CouponSetDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponSetDeleteBuilder builder() { + return new CouponSetDeleteBuilder(); + } + + public static final class CouponSetDeleteBuilder { + + private CouponSetDeleteBuilder() {} + + public CouponSetDeleteParams build() { + return new CouponSetDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetDeleteUnusedCouponCodesParams.java b/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetDeleteUnusedCouponCodesParams.java new file mode 100644 index 00000000..222707c9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetDeleteUnusedCouponCodesParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.couponSet.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CouponSetDeleteUnusedCouponCodesParams { + + private CouponSetDeleteUnusedCouponCodesParams(CouponSetDeleteUnusedCouponCodesBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CouponSetDeleteUnusedCouponCodesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponSetDeleteUnusedCouponCodesBuilder builder() { + return new CouponSetDeleteUnusedCouponCodesBuilder(); + } + + public static final class CouponSetDeleteUnusedCouponCodesBuilder { + + private CouponSetDeleteUnusedCouponCodesBuilder() {} + + public CouponSetDeleteUnusedCouponCodesParams build() { + return new CouponSetDeleteUnusedCouponCodesParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetUpdateParams.java b/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetUpdateParams.java new file mode 100644 index 00000000..bfbb5c04 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/couponSet/params/CouponSetUpdateParams.java @@ -0,0 +1,81 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.couponSet.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CouponSetUpdateParams { + + private final String name; + + private final java.util.Map metaData; + + private CouponSetUpdateParams(CouponSetUpdateBuilder builder) { + + this.name = builder.name; + + this.metaData = builder.metaData; + } + + public String getName() { + return name; + } + + public java.util.Map getMetaData() { + return metaData; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.name != null) { + + formData.put("name", this.name); + } + + if (this.metaData != null) { + + formData.put("meta_data", JsonUtil.toJson(this.metaData)); + } + + return formData; + } + + /** Create a new builder for CouponSetUpdateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponSetUpdateBuilder builder() { + return new CouponSetUpdateBuilder(); + } + + public static final class CouponSetUpdateBuilder { + + private String name; + + private java.util.Map metaData; + + private CouponSetUpdateBuilder() {} + + public CouponSetUpdateBuilder name(String value) { + this.name = value; + return this; + } + + public CouponSetUpdateBuilder metaData(java.util.Map value) { + this.metaData = value; + return this; + } + + public CouponSetUpdateParams build() { + return new CouponSetUpdateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/params/DeleteCouponSetParams.java b/src/main/java/com/chargebee/v4/models/couponSet/params/DeleteCouponSetParams.java deleted file mode 100644 index f75f44e6..00000000 --- a/src/main/java/com/chargebee/v4/models/couponSet/params/DeleteCouponSetParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.couponSet.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteCouponSetParams { - - private DeleteCouponSetParams(DeleteCouponSetBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteCouponSetParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteCouponSetBuilder builder() { - return new DeleteCouponSetBuilder(); - } - - public static final class DeleteCouponSetBuilder { - - private DeleteCouponSetBuilder() {} - - public DeleteCouponSetParams build() { - return new DeleteCouponSetParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/params/DeleteUnusedCouponCodesForCouponSetParams.java b/src/main/java/com/chargebee/v4/models/couponSet/params/DeleteUnusedCouponCodesForCouponSetParams.java deleted file mode 100644 index 75f537aa..00000000 --- a/src/main/java/com/chargebee/v4/models/couponSet/params/DeleteUnusedCouponCodesForCouponSetParams.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.couponSet.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteUnusedCouponCodesForCouponSetParams { - - private DeleteUnusedCouponCodesForCouponSetParams( - DeleteUnusedCouponCodesForCouponSetBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteUnusedCouponCodesForCouponSetParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteUnusedCouponCodesForCouponSetBuilder builder() { - return new DeleteUnusedCouponCodesForCouponSetBuilder(); - } - - public static final class DeleteUnusedCouponCodesForCouponSetBuilder { - - private DeleteUnusedCouponCodesForCouponSetBuilder() {} - - public DeleteUnusedCouponCodesForCouponSetParams build() { - return new DeleteUnusedCouponCodesForCouponSetParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/params/UpdateCouponSetParams.java b/src/main/java/com/chargebee/v4/models/couponSet/params/UpdateCouponSetParams.java deleted file mode 100644 index 04d89b4d..00000000 --- a/src/main/java/com/chargebee/v4/models/couponSet/params/UpdateCouponSetParams.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.couponSet.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UpdateCouponSetParams { - - private final String name; - - private final java.util.Map metaData; - - private UpdateCouponSetParams(UpdateCouponSetBuilder builder) { - - this.name = builder.name; - - this.metaData = builder.metaData; - } - - public String getName() { - return name; - } - - public java.util.Map getMetaData() { - return metaData; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.name != null) { - - formData.put("name", this.name); - } - - if (this.metaData != null) { - - formData.put("meta_data", JsonUtil.toJson(this.metaData)); - } - - return formData; - } - - /** Create a new builder for UpdateCouponSetParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateCouponSetBuilder builder() { - return new UpdateCouponSetBuilder(); - } - - public static final class UpdateCouponSetBuilder { - - private String name; - - private java.util.Map metaData; - - private UpdateCouponSetBuilder() {} - - public UpdateCouponSetBuilder name(String value) { - this.name = value; - return this; - } - - public UpdateCouponSetBuilder metaData(java.util.Map value) { - this.metaData = value; - return this; - } - - public UpdateCouponSetParams build() { - return new UpdateCouponSetParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/responses/AddCouponCodesForCouponSetResponse.java b/src/main/java/com/chargebee/v4/models/couponSet/responses/AddCouponCodesForCouponSetResponse.java deleted file mode 100644 index 05cacaa6..00000000 --- a/src/main/java/com/chargebee/v4/models/couponSet/responses/AddCouponCodesForCouponSetResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.couponSet.responses; - -import com.chargebee.v4.models.couponSet.CouponSet; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddCouponCodesForCouponSet operation. Contains the response data - * from the API. - */ -public final class AddCouponCodesForCouponSetResponse extends BaseResponse { - private final CouponSet couponSet; - - private AddCouponCodesForCouponSetResponse(Builder builder) { - super(builder.httpResponse); - - this.couponSet = builder.couponSet; - } - - /** Parse JSON response into AddCouponCodesForCouponSetResponse object. */ - public static AddCouponCodesForCouponSetResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddCouponCodesForCouponSetResponse object with HTTP response. */ - public static AddCouponCodesForCouponSetResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __couponSetJson = JsonUtil.getObject(json, "coupon_set"); - if (__couponSetJson != null) { - builder.couponSet(CouponSet.fromJson(__couponSetJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddCouponCodesForCouponSetResponse from JSON", e); - } - } - - /** Create a new builder for AddCouponCodesForCouponSetResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddCouponCodesForCouponSetResponse. */ - public static class Builder { - - private CouponSet couponSet; - - private Response httpResponse; - - private Builder() {} - - public Builder couponSet(CouponSet couponSet) { - this.couponSet = couponSet; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddCouponCodesForCouponSetResponse build() { - return new AddCouponCodesForCouponSetResponse(this); - } - } - - /** Get the couponSet from the response. */ - public CouponSet getCouponSet() { - return couponSet; - } -} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetAddCouponCodesResponse.java b/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetAddCouponCodesResponse.java new file mode 100644 index 00000000..4c833f88 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetAddCouponCodesResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.couponSet.responses; + +import com.chargebee.v4.models.couponSet.CouponSet; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CouponSetAddCouponCodes operation. Contains the response data from + * the API. + */ +public final class CouponSetAddCouponCodesResponse extends BaseResponse { + private final CouponSet couponSet; + + private CouponSetAddCouponCodesResponse(Builder builder) { + super(builder.httpResponse); + + this.couponSet = builder.couponSet; + } + + /** Parse JSON response into CouponSetAddCouponCodesResponse object. */ + public static CouponSetAddCouponCodesResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CouponSetAddCouponCodesResponse object with HTTP response. */ + public static CouponSetAddCouponCodesResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __couponSetJson = JsonUtil.getObject(json, "coupon_set"); + if (__couponSetJson != null) { + builder.couponSet(CouponSet.fromJson(__couponSetJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CouponSetAddCouponCodesResponse from JSON", e); + } + } + + /** Create a new builder for CouponSetAddCouponCodesResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CouponSetAddCouponCodesResponse. */ + public static class Builder { + + private CouponSet couponSet; + + private Response httpResponse; + + private Builder() {} + + public Builder couponSet(CouponSet couponSet) { + this.couponSet = couponSet; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CouponSetAddCouponCodesResponse build() { + return new CouponSetAddCouponCodesResponse(this); + } + } + + /** Get the couponSet from the response. */ + public CouponSet getCouponSet() { + return couponSet; + } +} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetDeleteResponse.java b/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetDeleteResponse.java new file mode 100644 index 00000000..b164aa89 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetDeleteResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.couponSet.responses; + +import com.chargebee.v4.models.couponSet.CouponSet; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CouponSetDelete operation. Contains the response data from the API. + */ +public final class CouponSetDeleteResponse extends BaseResponse { + private final CouponSet couponSet; + + private CouponSetDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.couponSet = builder.couponSet; + } + + /** Parse JSON response into CouponSetDeleteResponse object. */ + public static CouponSetDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CouponSetDeleteResponse object with HTTP response. */ + public static CouponSetDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __couponSetJson = JsonUtil.getObject(json, "coupon_set"); + if (__couponSetJson != null) { + builder.couponSet(CouponSet.fromJson(__couponSetJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CouponSetDeleteResponse from JSON", e); + } + } + + /** Create a new builder for CouponSetDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CouponSetDeleteResponse. */ + public static class Builder { + + private CouponSet couponSet; + + private Response httpResponse; + + private Builder() {} + + public Builder couponSet(CouponSet couponSet) { + this.couponSet = couponSet; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CouponSetDeleteResponse build() { + return new CouponSetDeleteResponse(this); + } + } + + /** Get the couponSet from the response. */ + public CouponSet getCouponSet() { + return couponSet; + } +} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetDeleteUnusedCouponCodesResponse.java b/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetDeleteUnusedCouponCodesResponse.java new file mode 100644 index 00000000..93f6fb6c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetDeleteUnusedCouponCodesResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.couponSet.responses; + +import com.chargebee.v4.models.couponSet.CouponSet; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CouponSetDeleteUnusedCouponCodes operation. Contains the response + * data from the API. + */ +public final class CouponSetDeleteUnusedCouponCodesResponse extends BaseResponse { + private final CouponSet couponSet; + + private CouponSetDeleteUnusedCouponCodesResponse(Builder builder) { + super(builder.httpResponse); + + this.couponSet = builder.couponSet; + } + + /** Parse JSON response into CouponSetDeleteUnusedCouponCodesResponse object. */ + public static CouponSetDeleteUnusedCouponCodesResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into CouponSetDeleteUnusedCouponCodesResponse object with HTTP response. + */ + public static CouponSetDeleteUnusedCouponCodesResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __couponSetJson = JsonUtil.getObject(json, "coupon_set"); + if (__couponSetJson != null) { + builder.couponSet(CouponSet.fromJson(__couponSetJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CouponSetDeleteUnusedCouponCodesResponse from JSON", e); + } + } + + /** Create a new builder for CouponSetDeleteUnusedCouponCodesResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CouponSetDeleteUnusedCouponCodesResponse. */ + public static class Builder { + + private CouponSet couponSet; + + private Response httpResponse; + + private Builder() {} + + public Builder couponSet(CouponSet couponSet) { + this.couponSet = couponSet; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CouponSetDeleteUnusedCouponCodesResponse build() { + return new CouponSetDeleteUnusedCouponCodesResponse(this); + } + } + + /** Get the couponSet from the response. */ + public CouponSet getCouponSet() { + return couponSet; + } +} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetListResponse.java b/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetListResponse.java index b1af15a6..fb7e79b8 100644 --- a/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetListResponse.java +++ b/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.couponSet.CouponSet; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.CouponSetService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public CouponSetListResponse nextPage() throws Exception { + public CouponSetListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetUpdateResponse.java b/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetUpdateResponse.java new file mode 100644 index 00000000..dd7b16eb --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/couponSet/responses/CouponSetUpdateResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.couponSet.responses; + +import com.chargebee.v4.models.couponSet.CouponSet; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CouponSetUpdate operation. Contains the response data from the API. + */ +public final class CouponSetUpdateResponse extends BaseResponse { + private final CouponSet couponSet; + + private CouponSetUpdateResponse(Builder builder) { + super(builder.httpResponse); + + this.couponSet = builder.couponSet; + } + + /** Parse JSON response into CouponSetUpdateResponse object. */ + public static CouponSetUpdateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CouponSetUpdateResponse object with HTTP response. */ + public static CouponSetUpdateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __couponSetJson = JsonUtil.getObject(json, "coupon_set"); + if (__couponSetJson != null) { + builder.couponSet(CouponSet.fromJson(__couponSetJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CouponSetUpdateResponse from JSON", e); + } + } + + /** Create a new builder for CouponSetUpdateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CouponSetUpdateResponse. */ + public static class Builder { + + private CouponSet couponSet; + + private Response httpResponse; + + private Builder() {} + + public Builder couponSet(CouponSet couponSet) { + this.couponSet = couponSet; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CouponSetUpdateResponse build() { + return new CouponSetUpdateResponse(this); + } + } + + /** Get the couponSet from the response. */ + public CouponSet getCouponSet() { + return couponSet; + } +} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/responses/DeleteCouponSetResponse.java b/src/main/java/com/chargebee/v4/models/couponSet/responses/DeleteCouponSetResponse.java deleted file mode 100644 index c4a36f2c..00000000 --- a/src/main/java/com/chargebee/v4/models/couponSet/responses/DeleteCouponSetResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.couponSet.responses; - -import com.chargebee.v4.models.couponSet.CouponSet; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteCouponSet operation. Contains the response data from the API. - */ -public final class DeleteCouponSetResponse extends BaseResponse { - private final CouponSet couponSet; - - private DeleteCouponSetResponse(Builder builder) { - super(builder.httpResponse); - - this.couponSet = builder.couponSet; - } - - /** Parse JSON response into DeleteCouponSetResponse object. */ - public static DeleteCouponSetResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteCouponSetResponse object with HTTP response. */ - public static DeleteCouponSetResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __couponSetJson = JsonUtil.getObject(json, "coupon_set"); - if (__couponSetJson != null) { - builder.couponSet(CouponSet.fromJson(__couponSetJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteCouponSetResponse from JSON", e); - } - } - - /** Create a new builder for DeleteCouponSetResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteCouponSetResponse. */ - public static class Builder { - - private CouponSet couponSet; - - private Response httpResponse; - - private Builder() {} - - public Builder couponSet(CouponSet couponSet) { - this.couponSet = couponSet; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteCouponSetResponse build() { - return new DeleteCouponSetResponse(this); - } - } - - /** Get the couponSet from the response. */ - public CouponSet getCouponSet() { - return couponSet; - } -} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/responses/DeleteUnusedCouponCodesForCouponSetResponse.java b/src/main/java/com/chargebee/v4/models/couponSet/responses/DeleteUnusedCouponCodesForCouponSetResponse.java deleted file mode 100644 index 7bfc98bd..00000000 --- a/src/main/java/com/chargebee/v4/models/couponSet/responses/DeleteUnusedCouponCodesForCouponSetResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.couponSet.responses; - -import com.chargebee.v4.models.couponSet.CouponSet; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteUnusedCouponCodesForCouponSet operation. Contains the - * response data from the API. - */ -public final class DeleteUnusedCouponCodesForCouponSetResponse extends BaseResponse { - private final CouponSet couponSet; - - private DeleteUnusedCouponCodesForCouponSetResponse(Builder builder) { - super(builder.httpResponse); - - this.couponSet = builder.couponSet; - } - - /** Parse JSON response into DeleteUnusedCouponCodesForCouponSetResponse object. */ - public static DeleteUnusedCouponCodesForCouponSetResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into DeleteUnusedCouponCodesForCouponSetResponse object with HTTP response. - */ - public static DeleteUnusedCouponCodesForCouponSetResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __couponSetJson = JsonUtil.getObject(json, "coupon_set"); - if (__couponSetJson != null) { - builder.couponSet(CouponSet.fromJson(__couponSetJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse DeleteUnusedCouponCodesForCouponSetResponse from JSON", e); - } - } - - /** Create a new builder for DeleteUnusedCouponCodesForCouponSetResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteUnusedCouponCodesForCouponSetResponse. */ - public static class Builder { - - private CouponSet couponSet; - - private Response httpResponse; - - private Builder() {} - - public Builder couponSet(CouponSet couponSet) { - this.couponSet = couponSet; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteUnusedCouponCodesForCouponSetResponse build() { - return new DeleteUnusedCouponCodesForCouponSetResponse(this); - } - } - - /** Get the couponSet from the response. */ - public CouponSet getCouponSet() { - return couponSet; - } -} diff --git a/src/main/java/com/chargebee/v4/models/couponSet/responses/UpdateCouponSetResponse.java b/src/main/java/com/chargebee/v4/models/couponSet/responses/UpdateCouponSetResponse.java deleted file mode 100644 index 723ad5bf..00000000 --- a/src/main/java/com/chargebee/v4/models/couponSet/responses/UpdateCouponSetResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.couponSet.responses; - -import com.chargebee.v4.models.couponSet.CouponSet; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateCouponSet operation. Contains the response data from the API. - */ -public final class UpdateCouponSetResponse extends BaseResponse { - private final CouponSet couponSet; - - private UpdateCouponSetResponse(Builder builder) { - super(builder.httpResponse); - - this.couponSet = builder.couponSet; - } - - /** Parse JSON response into UpdateCouponSetResponse object. */ - public static UpdateCouponSetResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdateCouponSetResponse object with HTTP response. */ - public static UpdateCouponSetResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __couponSetJson = JsonUtil.getObject(json, "coupon_set"); - if (__couponSetJson != null) { - builder.couponSet(CouponSet.fromJson(__couponSetJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UpdateCouponSetResponse from JSON", e); - } - } - - /** Create a new builder for UpdateCouponSetResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateCouponSetResponse. */ - public static class Builder { - - private CouponSet couponSet; - - private Response httpResponse; - - private Builder() {} - - public Builder couponSet(CouponSet couponSet) { - this.couponSet = couponSet; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateCouponSetResponse build() { - return new UpdateCouponSetResponse(this); - } - } - - /** Get the couponSet from the response. */ - public CouponSet getCouponSet() { - return couponSet; - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteDeleteParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteDeleteParams.java new file mode 100644 index 00000000..1fabd136 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteDeleteParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.creditNote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditNoteDeleteParams { + + private final String comment; + + private CreditNoteDeleteParams(CreditNoteDeleteBuilder builder) { + + this.comment = builder.comment; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for CreditNoteDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteDeleteBuilder builder() { + return new CreditNoteDeleteBuilder(); + } + + public static final class CreditNoteDeleteBuilder { + + private String comment; + + private CreditNoteDeleteBuilder() {} + + public CreditNoteDeleteBuilder comment(String value) { + this.comment = value; + return this; + } + + public CreditNoteDeleteParams build() { + return new CreditNoteDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteDownloadEinvoiceParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteDownloadEinvoiceParams.java new file mode 100644 index 00000000..b12611a8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteDownloadEinvoiceParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.creditNote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditNoteDownloadEinvoiceParams { + + private final Map queryParams; + + private CreditNoteDownloadEinvoiceParams(CreditNoteDownloadEinvoiceBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public CreditNoteDownloadEinvoiceBuilder toBuilder() { + CreditNoteDownloadEinvoiceBuilder builder = new CreditNoteDownloadEinvoiceBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for CreditNoteDownloadEinvoiceParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteDownloadEinvoiceBuilder builder() { + return new CreditNoteDownloadEinvoiceBuilder(); + } + + public static final class CreditNoteDownloadEinvoiceBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private CreditNoteDownloadEinvoiceBuilder() {} + + public CreditNoteDownloadEinvoiceParams build() { + return new CreditNoteDownloadEinvoiceParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNotePdfParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNotePdfParams.java new file mode 100644 index 00000000..b0add7a7 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNotePdfParams.java @@ -0,0 +1,88 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.creditNote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditNotePdfParams { + + private final DispositionType dispositionType; + + private CreditNotePdfParams(CreditNotePdfBuilder builder) { + + this.dispositionType = builder.dispositionType; + } + + public DispositionType getDispositionType() { + return dispositionType; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.dispositionType != null) { + + formData.put("disposition_type", this.dispositionType); + } + + return formData; + } + + /** Create a new builder for CreditNotePdfParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNotePdfBuilder builder() { + return new CreditNotePdfBuilder(); + } + + public static final class CreditNotePdfBuilder { + + private DispositionType dispositionType; + + private CreditNotePdfBuilder() {} + + public CreditNotePdfBuilder dispositionType(DispositionType value) { + this.dispositionType = value; + return this; + } + + public CreditNotePdfParams build() { + return new CreditNotePdfParams(this); + } + } + + public enum DispositionType { + ATTACHMENT("attachment"), + + INLINE("inline"), + + /** An enum member indicating that DispositionType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DispositionType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DispositionType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DispositionType enumValue : DispositionType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRecordRefundParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRecordRefundParams.java new file mode 100644 index 00000000..11735d89 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRecordRefundParams.java @@ -0,0 +1,294 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.creditNote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class CreditNoteRecordRefundParams { + + private final String refundReasonCode; + + private final String comment; + + private final TransactionParams transaction; + + private CreditNoteRecordRefundParams(CreditNoteRecordRefundBuilder builder) { + + this.refundReasonCode = builder.refundReasonCode; + + this.comment = builder.comment; + + this.transaction = builder.transaction; + } + + public String getRefundReasonCode() { + return refundReasonCode; + } + + public String getComment() { + return comment; + } + + public TransactionParams getTransaction() { + return transaction; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.refundReasonCode != null) { + + formData.put("refund_reason_code", this.refundReasonCode); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.transaction != null) { + + // Single object + Map nestedData = this.transaction.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "transaction[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for CreditNoteRecordRefundParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteRecordRefundBuilder builder() { + return new CreditNoteRecordRefundBuilder(); + } + + public static final class CreditNoteRecordRefundBuilder { + + private String refundReasonCode; + + private String comment; + + private TransactionParams transaction; + + private CreditNoteRecordRefundBuilder() {} + + public CreditNoteRecordRefundBuilder refundReasonCode(String value) { + this.refundReasonCode = value; + return this; + } + + public CreditNoteRecordRefundBuilder comment(String value) { + this.comment = value; + return this; + } + + public CreditNoteRecordRefundBuilder transaction(TransactionParams value) { + this.transaction = value; + return this; + } + + public CreditNoteRecordRefundParams build() { + return new CreditNoteRecordRefundParams(this); + } + } + + public static final class TransactionParams { + + private final String id; + + private final Long amount; + + private final PaymentMethod paymentMethod; + + private final String referenceNumber; + + private final String customPaymentMethodId; + + private final Timestamp date; + + private TransactionParams(TransactionBuilder builder) { + + this.id = builder.id; + + this.amount = builder.amount; + + this.paymentMethod = builder.paymentMethod; + + this.referenceNumber = builder.referenceNumber; + + this.customPaymentMethodId = builder.customPaymentMethodId; + + this.date = builder.date; + } + + public String getId() { + return id; + } + + public Long getAmount() { + return amount; + } + + public PaymentMethod getPaymentMethod() { + return paymentMethod; + } + + public String getReferenceNumber() { + return referenceNumber; + } + + public String getCustomPaymentMethodId() { + return customPaymentMethodId; + } + + public Timestamp getDate() { + return date; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.paymentMethod != null) { + + formData.put("payment_method", this.paymentMethod); + } + + if (this.referenceNumber != null) { + + formData.put("reference_number", this.referenceNumber); + } + + if (this.customPaymentMethodId != null) { + + formData.put("custom_payment_method_id", this.customPaymentMethodId); + } + + if (this.date != null) { + + formData.put("date", this.date); + } + + return formData; + } + + /** Create a new builder for TransactionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TransactionBuilder builder() { + return new TransactionBuilder(); + } + + public static final class TransactionBuilder { + + private String id; + + private Long amount; + + private PaymentMethod paymentMethod; + + private String referenceNumber; + + private String customPaymentMethodId; + + private Timestamp date; + + private TransactionBuilder() {} + + public TransactionBuilder id(String value) { + this.id = value; + return this; + } + + public TransactionBuilder amount(Long value) { + this.amount = value; + return this; + } + + public TransactionBuilder paymentMethod(PaymentMethod value) { + this.paymentMethod = value; + return this; + } + + public TransactionBuilder referenceNumber(String value) { + this.referenceNumber = value; + return this; + } + + public TransactionBuilder customPaymentMethodId(String value) { + this.customPaymentMethodId = value; + return this; + } + + public TransactionBuilder date(Timestamp value) { + this.date = value; + return this; + } + + public TransactionParams build() { + return new TransactionParams(this); + } + } + + public enum PaymentMethod { + CASH("cash"), + + CHECK("check"), + + CHARGEBACK("chargeback"), + + BANK_TRANSFER("bank_transfer"), + + OTHER("other"), + + APP_STORE("app_store"), + + PLAY_STORE("play_store"), + + CUSTOM("custom"), + + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethod enumValue : PaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRefundParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRefundParams.java new file mode 100644 index 00000000..f14f8f0c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRefundParams.java @@ -0,0 +1,100 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.creditNote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditNoteRefundParams { + + private final Long refundAmount; + + private final String customerNotes; + + private final String refundReasonCode; + + private CreditNoteRefundParams(CreditNoteRefundBuilder builder) { + + this.refundAmount = builder.refundAmount; + + this.customerNotes = builder.customerNotes; + + this.refundReasonCode = builder.refundReasonCode; + } + + public Long getRefundAmount() { + return refundAmount; + } + + public String getCustomerNotes() { + return customerNotes; + } + + public String getRefundReasonCode() { + return refundReasonCode; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.refundAmount != null) { + + formData.put("refund_amount", this.refundAmount); + } + + if (this.customerNotes != null) { + + formData.put("customer_notes", this.customerNotes); + } + + if (this.refundReasonCode != null) { + + formData.put("refund_reason_code", this.refundReasonCode); + } + + return formData; + } + + /** Create a new builder for CreditNoteRefundParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteRefundBuilder builder() { + return new CreditNoteRefundBuilder(); + } + + public static final class CreditNoteRefundBuilder { + + private Long refundAmount; + + private String customerNotes; + + private String refundReasonCode; + + private CreditNoteRefundBuilder() {} + + public CreditNoteRefundBuilder refundAmount(Long value) { + this.refundAmount = value; + return this; + } + + public CreditNoteRefundBuilder customerNotes(String value) { + this.customerNotes = value; + return this; + } + + public CreditNoteRefundBuilder refundReasonCode(String value) { + this.refundReasonCode = value; + return this; + } + + public CreditNoteRefundParams build() { + return new CreditNoteRefundParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRemoveTaxWithheldRefundParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRemoveTaxWithheldRefundParams.java new file mode 100644 index 00000000..636e0e20 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRemoveTaxWithheldRefundParams.java @@ -0,0 +1,114 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.creditNote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditNoteRemoveTaxWithheldRefundParams { + + private final TaxWithheldParams taxWithheld; + + private CreditNoteRemoveTaxWithheldRefundParams( + CreditNoteRemoveTaxWithheldRefundBuilder builder) { + + this.taxWithheld = builder.taxWithheld; + } + + public TaxWithheldParams getTaxWithheld() { + return taxWithheld; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.taxWithheld != null) { + + // Single object + Map nestedData = this.taxWithheld.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "tax_withheld[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for CreditNoteRemoveTaxWithheldRefundParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteRemoveTaxWithheldRefundBuilder builder() { + return new CreditNoteRemoveTaxWithheldRefundBuilder(); + } + + public static final class CreditNoteRemoveTaxWithheldRefundBuilder { + + private TaxWithheldParams taxWithheld; + + private CreditNoteRemoveTaxWithheldRefundBuilder() {} + + public CreditNoteRemoveTaxWithheldRefundBuilder taxWithheld(TaxWithheldParams value) { + this.taxWithheld = value; + return this; + } + + public CreditNoteRemoveTaxWithheldRefundParams build() { + return new CreditNoteRemoveTaxWithheldRefundParams(this); + } + } + + public static final class TaxWithheldParams { + + private final String id; + + private TaxWithheldParams(TaxWithheldBuilder builder) { + + this.id = builder.id; + } + + public String getId() { + return id; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + return formData; + } + + /** Create a new builder for TaxWithheldParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TaxWithheldBuilder builder() { + return new TaxWithheldBuilder(); + } + + public static final class TaxWithheldBuilder { + + private String id; + + private TaxWithheldBuilder() {} + + public TaxWithheldBuilder id(String value) { + this.id = value; + return this; + } + + public TaxWithheldParams build() { + return new TaxWithheldParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteResendEinvoiceParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteResendEinvoiceParams.java new file mode 100644 index 00000000..78b0473a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteResendEinvoiceParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.creditNote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditNoteResendEinvoiceParams { + + private CreditNoteResendEinvoiceParams(CreditNoteResendEinvoiceBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CreditNoteResendEinvoiceParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteResendEinvoiceBuilder builder() { + return new CreditNoteResendEinvoiceBuilder(); + } + + public static final class CreditNoteResendEinvoiceBuilder { + + private CreditNoteResendEinvoiceBuilder() {} + + public CreditNoteResendEinvoiceParams build() { + return new CreditNoteResendEinvoiceParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteSendEinvoiceParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteSendEinvoiceParams.java new file mode 100644 index 00000000..51f6718f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteSendEinvoiceParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.creditNote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditNoteSendEinvoiceParams { + + private CreditNoteSendEinvoiceParams(CreditNoteSendEinvoiceBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CreditNoteSendEinvoiceParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteSendEinvoiceBuilder builder() { + return new CreditNoteSendEinvoiceBuilder(); + } + + public static final class CreditNoteSendEinvoiceBuilder { + + private CreditNoteSendEinvoiceBuilder() {} + + public CreditNoteSendEinvoiceParams build() { + return new CreditNoteSendEinvoiceParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/DeleteCreditNoteParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/DeleteCreditNoteParams.java deleted file mode 100644 index d44f3c27..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/params/DeleteCreditNoteParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.creditNote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteCreditNoteParams { - - private final String comment; - - private DeleteCreditNoteParams(DeleteCreditNoteBuilder builder) { - - this.comment = builder.comment; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for DeleteCreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteCreditNoteBuilder builder() { - return new DeleteCreditNoteBuilder(); - } - - public static final class DeleteCreditNoteBuilder { - - private String comment; - - private DeleteCreditNoteBuilder() {} - - public DeleteCreditNoteBuilder comment(String value) { - this.comment = value; - return this; - } - - public DeleteCreditNoteParams build() { - return new DeleteCreditNoteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/DownloadEinvoiceForCreditNoteParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/DownloadEinvoiceForCreditNoteParams.java deleted file mode 100644 index cce8a544..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/params/DownloadEinvoiceForCreditNoteParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.creditNote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DownloadEinvoiceForCreditNoteParams { - - private final Map queryParams; - - private DownloadEinvoiceForCreditNoteParams(DownloadEinvoiceForCreditNoteBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public DownloadEinvoiceForCreditNoteBuilder toBuilder() { - DownloadEinvoiceForCreditNoteBuilder builder = new DownloadEinvoiceForCreditNoteBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for DownloadEinvoiceForCreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DownloadEinvoiceForCreditNoteBuilder builder() { - return new DownloadEinvoiceForCreditNoteBuilder(); - } - - public static final class DownloadEinvoiceForCreditNoteBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private DownloadEinvoiceForCreditNoteBuilder() {} - - public DownloadEinvoiceForCreditNoteParams build() { - return new DownloadEinvoiceForCreditNoteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/PdfForCreditNoteParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/PdfForCreditNoteParams.java deleted file mode 100644 index fa7a597f..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/params/PdfForCreditNoteParams.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.creditNote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class PdfForCreditNoteParams { - - private final DispositionType dispositionType; - - private PdfForCreditNoteParams(PdfForCreditNoteBuilder builder) { - - this.dispositionType = builder.dispositionType; - } - - public DispositionType getDispositionType() { - return dispositionType; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.dispositionType != null) { - - formData.put("disposition_type", this.dispositionType); - } - - return formData; - } - - /** Create a new builder for PdfForCreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PdfForCreditNoteBuilder builder() { - return new PdfForCreditNoteBuilder(); - } - - public static final class PdfForCreditNoteBuilder { - - private DispositionType dispositionType; - - private PdfForCreditNoteBuilder() {} - - public PdfForCreditNoteBuilder dispositionType(DispositionType value) { - this.dispositionType = value; - return this; - } - - public PdfForCreditNoteParams build() { - return new PdfForCreditNoteParams(this); - } - } - - public enum DispositionType { - ATTACHMENT("attachment"), - - INLINE("inline"), - - /** An enum member indicating that DispositionType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DispositionType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DispositionType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DispositionType enumValue : DispositionType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/RecordRefundForCreditNoteParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/RecordRefundForCreditNoteParams.java deleted file mode 100644 index e38bb351..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/params/RecordRefundForCreditNoteParams.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.creditNote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class RecordRefundForCreditNoteParams { - - private final String refundReasonCode; - - private final String comment; - - private final TransactionParams transaction; - - private RecordRefundForCreditNoteParams(RecordRefundForCreditNoteBuilder builder) { - - this.refundReasonCode = builder.refundReasonCode; - - this.comment = builder.comment; - - this.transaction = builder.transaction; - } - - public String getRefundReasonCode() { - return refundReasonCode; - } - - public String getComment() { - return comment; - } - - public TransactionParams getTransaction() { - return transaction; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.refundReasonCode != null) { - - formData.put("refund_reason_code", this.refundReasonCode); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.transaction != null) { - - // Single object - Map nestedData = this.transaction.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "transaction[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for RecordRefundForCreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RecordRefundForCreditNoteBuilder builder() { - return new RecordRefundForCreditNoteBuilder(); - } - - public static final class RecordRefundForCreditNoteBuilder { - - private String refundReasonCode; - - private String comment; - - private TransactionParams transaction; - - private RecordRefundForCreditNoteBuilder() {} - - public RecordRefundForCreditNoteBuilder refundReasonCode(String value) { - this.refundReasonCode = value; - return this; - } - - public RecordRefundForCreditNoteBuilder comment(String value) { - this.comment = value; - return this; - } - - public RecordRefundForCreditNoteBuilder transaction(TransactionParams value) { - this.transaction = value; - return this; - } - - public RecordRefundForCreditNoteParams build() { - return new RecordRefundForCreditNoteParams(this); - } - } - - public static final class TransactionParams { - - private final String id; - - private final Long amount; - - private final PaymentMethod paymentMethod; - - private final String referenceNumber; - - private final String customPaymentMethodId; - - private final Timestamp date; - - private TransactionParams(TransactionBuilder builder) { - - this.id = builder.id; - - this.amount = builder.amount; - - this.paymentMethod = builder.paymentMethod; - - this.referenceNumber = builder.referenceNumber; - - this.customPaymentMethodId = builder.customPaymentMethodId; - - this.date = builder.date; - } - - public String getId() { - return id; - } - - public Long getAmount() { - return amount; - } - - public PaymentMethod getPaymentMethod() { - return paymentMethod; - } - - public String getReferenceNumber() { - return referenceNumber; - } - - public String getCustomPaymentMethodId() { - return customPaymentMethodId; - } - - public Timestamp getDate() { - return date; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.paymentMethod != null) { - - formData.put("payment_method", this.paymentMethod); - } - - if (this.referenceNumber != null) { - - formData.put("reference_number", this.referenceNumber); - } - - if (this.customPaymentMethodId != null) { - - formData.put("custom_payment_method_id", this.customPaymentMethodId); - } - - if (this.date != null) { - - formData.put("date", this.date); - } - - return formData; - } - - /** Create a new builder for TransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TransactionBuilder builder() { - return new TransactionBuilder(); - } - - public static final class TransactionBuilder { - - private String id; - - private Long amount; - - private PaymentMethod paymentMethod; - - private String referenceNumber; - - private String customPaymentMethodId; - - private Timestamp date; - - private TransactionBuilder() {} - - public TransactionBuilder id(String value) { - this.id = value; - return this; - } - - public TransactionBuilder amount(Long value) { - this.amount = value; - return this; - } - - public TransactionBuilder paymentMethod(PaymentMethod value) { - this.paymentMethod = value; - return this; - } - - public TransactionBuilder referenceNumber(String value) { - this.referenceNumber = value; - return this; - } - - public TransactionBuilder customPaymentMethodId(String value) { - this.customPaymentMethodId = value; - return this; - } - - public TransactionBuilder date(Timestamp value) { - this.date = value; - return this; - } - - public TransactionParams build() { - return new TransactionParams(this); - } - } - - public enum PaymentMethod { - CASH("cash"), - - CHECK("check"), - - CHARGEBACK("chargeback"), - - BANK_TRANSFER("bank_transfer"), - - OTHER("other"), - - APP_STORE("app_store"), - - PLAY_STORE("play_store"), - - CUSTOM("custom"), - - /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethod enumValue : PaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/RefundForCreditNoteParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/RefundForCreditNoteParams.java deleted file mode 100644 index 05a0a26f..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/params/RefundForCreditNoteParams.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.creditNote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RefundForCreditNoteParams { - - private final Long refundAmount; - - private final String customerNotes; - - private final String refundReasonCode; - - private RefundForCreditNoteParams(RefundForCreditNoteBuilder builder) { - - this.refundAmount = builder.refundAmount; - - this.customerNotes = builder.customerNotes; - - this.refundReasonCode = builder.refundReasonCode; - } - - public Long getRefundAmount() { - return refundAmount; - } - - public String getCustomerNotes() { - return customerNotes; - } - - public String getRefundReasonCode() { - return refundReasonCode; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.refundAmount != null) { - - formData.put("refund_amount", this.refundAmount); - } - - if (this.customerNotes != null) { - - formData.put("customer_notes", this.customerNotes); - } - - if (this.refundReasonCode != null) { - - formData.put("refund_reason_code", this.refundReasonCode); - } - - return formData; - } - - /** Create a new builder for RefundForCreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RefundForCreditNoteBuilder builder() { - return new RefundForCreditNoteBuilder(); - } - - public static final class RefundForCreditNoteBuilder { - - private Long refundAmount; - - private String customerNotes; - - private String refundReasonCode; - - private RefundForCreditNoteBuilder() {} - - public RefundForCreditNoteBuilder refundAmount(Long value) { - this.refundAmount = value; - return this; - } - - public RefundForCreditNoteBuilder customerNotes(String value) { - this.customerNotes = value; - return this; - } - - public RefundForCreditNoteBuilder refundReasonCode(String value) { - this.refundReasonCode = value; - return this; - } - - public RefundForCreditNoteParams build() { - return new RefundForCreditNoteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/RemoveTaxWithheldRefundForCreditNoteParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/RemoveTaxWithheldRefundForCreditNoteParams.java deleted file mode 100644 index bc397fec..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/params/RemoveTaxWithheldRefundForCreditNoteParams.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.creditNote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RemoveTaxWithheldRefundForCreditNoteParams { - - private final TaxWithheldParams taxWithheld; - - private RemoveTaxWithheldRefundForCreditNoteParams( - RemoveTaxWithheldRefundForCreditNoteBuilder builder) { - - this.taxWithheld = builder.taxWithheld; - } - - public TaxWithheldParams getTaxWithheld() { - return taxWithheld; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.taxWithheld != null) { - - // Single object - Map nestedData = this.taxWithheld.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "tax_withheld[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for RemoveTaxWithheldRefundForCreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RemoveTaxWithheldRefundForCreditNoteBuilder builder() { - return new RemoveTaxWithheldRefundForCreditNoteBuilder(); - } - - public static final class RemoveTaxWithheldRefundForCreditNoteBuilder { - - private TaxWithheldParams taxWithheld; - - private RemoveTaxWithheldRefundForCreditNoteBuilder() {} - - public RemoveTaxWithheldRefundForCreditNoteBuilder taxWithheld(TaxWithheldParams value) { - this.taxWithheld = value; - return this; - } - - public RemoveTaxWithheldRefundForCreditNoteParams build() { - return new RemoveTaxWithheldRefundForCreditNoteParams(this); - } - } - - public static final class TaxWithheldParams { - - private final String id; - - private TaxWithheldParams(TaxWithheldBuilder builder) { - - this.id = builder.id; - } - - public String getId() { - return id; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - return formData; - } - - /** Create a new builder for TaxWithheldParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TaxWithheldBuilder builder() { - return new TaxWithheldBuilder(); - } - - public static final class TaxWithheldBuilder { - - private String id; - - private TaxWithheldBuilder() {} - - public TaxWithheldBuilder id(String value) { - this.id = value; - return this; - } - - public TaxWithheldParams build() { - return new TaxWithheldParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/ResendEinvoiceForCreditNoteParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/ResendEinvoiceForCreditNoteParams.java deleted file mode 100644 index 3880319f..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/params/ResendEinvoiceForCreditNoteParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.creditNote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ResendEinvoiceForCreditNoteParams { - - private ResendEinvoiceForCreditNoteParams(ResendEinvoiceForCreditNoteBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for ResendEinvoiceForCreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ResendEinvoiceForCreditNoteBuilder builder() { - return new ResendEinvoiceForCreditNoteBuilder(); - } - - public static final class ResendEinvoiceForCreditNoteBuilder { - - private ResendEinvoiceForCreditNoteBuilder() {} - - public ResendEinvoiceForCreditNoteParams build() { - return new ResendEinvoiceForCreditNoteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/SendEinvoiceForCreditNoteParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/SendEinvoiceForCreditNoteParams.java deleted file mode 100644 index 64861c9c..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/params/SendEinvoiceForCreditNoteParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.creditNote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class SendEinvoiceForCreditNoteParams { - - private SendEinvoiceForCreditNoteParams(SendEinvoiceForCreditNoteBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for SendEinvoiceForCreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SendEinvoiceForCreditNoteBuilder builder() { - return new SendEinvoiceForCreditNoteBuilder(); - } - - public static final class SendEinvoiceForCreditNoteBuilder { - - private SendEinvoiceForCreditNoteBuilder() {} - - public SendEinvoiceForCreditNoteParams build() { - return new SendEinvoiceForCreditNoteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteDeleteResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteDeleteResponse.java new file mode 100644 index 00000000..0705443b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteDeleteResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.creditNote.responses; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreditNoteDelete operation. Contains the response data from the + * API. + */ +public final class CreditNoteDeleteResponse extends BaseResponse { + private final CreditNote creditNote; + + private CreditNoteDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.creditNote = builder.creditNote; + } + + /** Parse JSON response into CreditNoteDeleteResponse object. */ + public static CreditNoteDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreditNoteDeleteResponse object with HTTP response. */ + public static CreditNoteDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); + if (__creditNoteJson != null) { + builder.creditNote(CreditNote.fromJson(__creditNoteJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditNoteDeleteResponse from JSON", e); + } + } + + /** Create a new builder for CreditNoteDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditNoteDeleteResponse. */ + public static class Builder { + + private CreditNote creditNote; + + private Response httpResponse; + + private Builder() {} + + public Builder creditNote(CreditNote creditNote) { + this.creditNote = creditNote; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditNoteDeleteResponse build() { + return new CreditNoteDeleteResponse(this); + } + } + + /** Get the creditNote from the response. */ + public CreditNote getCreditNote() { + return creditNote; + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteDownloadEinvoiceResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteDownloadEinvoiceResponse.java new file mode 100644 index 00000000..a1d48950 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteDownloadEinvoiceResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.creditNote.responses; + +import com.chargebee.v4.models.download.Download; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import java.util.List; + +/** + * Immutable response object for CreditNoteDownloadEinvoice operation. Contains the response data + * from a single resource get operation. + */ +public final class CreditNoteDownloadEinvoiceResponse extends BaseResponse { + private final List downloads; + + private CreditNoteDownloadEinvoiceResponse(Builder builder) { + super(builder.httpResponse); + + this.downloads = builder.downloads; + } + + /** Parse JSON response into CreditNoteDownloadEinvoiceResponse object. */ + public static CreditNoteDownloadEinvoiceResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreditNoteDownloadEinvoiceResponse object with HTTP response. */ + public static CreditNoteDownloadEinvoiceResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __downloadsJson = JsonUtil.getArray(json, "downloads"); + if (__downloadsJson != null) { + builder.downloads( + JsonUtil.parseObjectArray(__downloadsJson).stream() + .map(Download::fromJson) + .collect(java.util.stream.Collectors.toList())); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditNoteDownloadEinvoiceResponse from JSON", e); + } + } + + /** Create a new builder for CreditNoteDownloadEinvoiceResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditNoteDownloadEinvoiceResponse. */ + public static class Builder { + + private List downloads; + + private Response httpResponse; + + private Builder() {} + + public Builder downloads(List downloads) { + this.downloads = downloads; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditNoteDownloadEinvoiceResponse build() { + return new CreditNoteDownloadEinvoiceResponse(this); + } + } + + /** Get the downloads from the response. */ + public List getDownloads() { + return downloads; + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteListResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteListResponse.java index 1070fbd0..ab551b5e 100644 --- a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteListResponse.java +++ b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.creditNote.CreditNote; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.CreditNoteService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public CreditNoteListResponse nextPage() throws Exception { + public CreditNoteListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNotePdfResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNotePdfResponse.java new file mode 100644 index 00000000..92f0b245 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNotePdfResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.creditNote.responses; + +import com.chargebee.v4.models.download.Download; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreditNotePdf operation. Contains the response data from the API. + */ +public final class CreditNotePdfResponse extends BaseResponse { + private final Download download; + + private CreditNotePdfResponse(Builder builder) { + super(builder.httpResponse); + + this.download = builder.download; + } + + /** Parse JSON response into CreditNotePdfResponse object. */ + public static CreditNotePdfResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreditNotePdfResponse object with HTTP response. */ + public static CreditNotePdfResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __downloadJson = JsonUtil.getObject(json, "download"); + if (__downloadJson != null) { + builder.download(Download.fromJson(__downloadJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditNotePdfResponse from JSON", e); + } + } + + /** Create a new builder for CreditNotePdfResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditNotePdfResponse. */ + public static class Builder { + + private Download download; + + private Response httpResponse; + + private Builder() {} + + public Builder download(Download download) { + this.download = download; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditNotePdfResponse build() { + return new CreditNotePdfResponse(this); + } + } + + /** Get the download from the response. */ + public Download getDownload() { + return download; + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteRecordRefundResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteRecordRefundResponse.java new file mode 100644 index 00000000..aeedefe4 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteRecordRefundResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.creditNote.responses; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreditNoteRecordRefund operation. Contains the response data from + * the API. + */ +public final class CreditNoteRecordRefundResponse extends BaseResponse { + private final CreditNote creditNote; + + private final Transaction transaction; + + private CreditNoteRecordRefundResponse(Builder builder) { + super(builder.httpResponse); + + this.creditNote = builder.creditNote; + + this.transaction = builder.transaction; + } + + /** Parse JSON response into CreditNoteRecordRefundResponse object. */ + public static CreditNoteRecordRefundResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreditNoteRecordRefundResponse object with HTTP response. */ + public static CreditNoteRecordRefundResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); + if (__creditNoteJson != null) { + builder.creditNote(CreditNote.fromJson(__creditNoteJson)); + } + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditNoteRecordRefundResponse from JSON", e); + } + } + + /** Create a new builder for CreditNoteRecordRefundResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditNoteRecordRefundResponse. */ + public static class Builder { + + private CreditNote creditNote; + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder creditNote(CreditNote creditNote) { + this.creditNote = creditNote; + return this; + } + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditNoteRecordRefundResponse build() { + return new CreditNoteRecordRefundResponse(this); + } + } + + /** Get the creditNote from the response. */ + public CreditNote getCreditNote() { + return creditNote; + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteRefundResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteRefundResponse.java new file mode 100644 index 00000000..0e0bc07b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteRefundResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.creditNote.responses; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreditNoteRefund operation. Contains the response data from the + * API. + */ +public final class CreditNoteRefundResponse extends BaseResponse { + private final CreditNote creditNote; + + private final Transaction transaction; + + private CreditNoteRefundResponse(Builder builder) { + super(builder.httpResponse); + + this.creditNote = builder.creditNote; + + this.transaction = builder.transaction; + } + + /** Parse JSON response into CreditNoteRefundResponse object. */ + public static CreditNoteRefundResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreditNoteRefundResponse object with HTTP response. */ + public static CreditNoteRefundResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); + if (__creditNoteJson != null) { + builder.creditNote(CreditNote.fromJson(__creditNoteJson)); + } + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditNoteRefundResponse from JSON", e); + } + } + + /** Create a new builder for CreditNoteRefundResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditNoteRefundResponse. */ + public static class Builder { + + private CreditNote creditNote; + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder creditNote(CreditNote creditNote) { + this.creditNote = creditNote; + return this; + } + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditNoteRefundResponse build() { + return new CreditNoteRefundResponse(this); + } + } + + /** Get the creditNote from the response. */ + public CreditNote getCreditNote() { + return creditNote; + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteRemoveTaxWithheldRefundResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteRemoveTaxWithheldRefundResponse.java new file mode 100644 index 00000000..bf969c87 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteRemoveTaxWithheldRefundResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.creditNote.responses; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreditNoteRemoveTaxWithheldRefund operation. Contains the response + * data from the API. + */ +public final class CreditNoteRemoveTaxWithheldRefundResponse extends BaseResponse { + private final CreditNote creditNote; + + private CreditNoteRemoveTaxWithheldRefundResponse(Builder builder) { + super(builder.httpResponse); + + this.creditNote = builder.creditNote; + } + + /** Parse JSON response into CreditNoteRemoveTaxWithheldRefundResponse object. */ + public static CreditNoteRemoveTaxWithheldRefundResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into CreditNoteRemoveTaxWithheldRefundResponse object with HTTP response. + */ + public static CreditNoteRemoveTaxWithheldRefundResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); + if (__creditNoteJson != null) { + builder.creditNote(CreditNote.fromJson(__creditNoteJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CreditNoteRemoveTaxWithheldRefundResponse from JSON", e); + } + } + + /** Create a new builder for CreditNoteRemoveTaxWithheldRefundResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditNoteRemoveTaxWithheldRefundResponse. */ + public static class Builder { + + private CreditNote creditNote; + + private Response httpResponse; + + private Builder() {} + + public Builder creditNote(CreditNote creditNote) { + this.creditNote = creditNote; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditNoteRemoveTaxWithheldRefundResponse build() { + return new CreditNoteRemoveTaxWithheldRefundResponse(this); + } + } + + /** Get the creditNote from the response. */ + public CreditNote getCreditNote() { + return creditNote; + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteResendEinvoiceResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteResendEinvoiceResponse.java new file mode 100644 index 00000000..2816ac78 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteResendEinvoiceResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.creditNote.responses; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreditNoteResendEinvoice operation. Contains the response data from + * the API. + */ +public final class CreditNoteResendEinvoiceResponse extends BaseResponse { + private final CreditNote creditNote; + + private CreditNoteResendEinvoiceResponse(Builder builder) { + super(builder.httpResponse); + + this.creditNote = builder.creditNote; + } + + /** Parse JSON response into CreditNoteResendEinvoiceResponse object. */ + public static CreditNoteResendEinvoiceResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreditNoteResendEinvoiceResponse object with HTTP response. */ + public static CreditNoteResendEinvoiceResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); + if (__creditNoteJson != null) { + builder.creditNote(CreditNote.fromJson(__creditNoteJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditNoteResendEinvoiceResponse from JSON", e); + } + } + + /** Create a new builder for CreditNoteResendEinvoiceResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditNoteResendEinvoiceResponse. */ + public static class Builder { + + private CreditNote creditNote; + + private Response httpResponse; + + private Builder() {} + + public Builder creditNote(CreditNote creditNote) { + this.creditNote = creditNote; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditNoteResendEinvoiceResponse build() { + return new CreditNoteResendEinvoiceResponse(this); + } + } + + /** Get the creditNote from the response. */ + public CreditNote getCreditNote() { + return creditNote; + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteSendEinvoiceResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteSendEinvoiceResponse.java new file mode 100644 index 00000000..6027f5f7 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNoteSendEinvoiceResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.creditNote.responses; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreditNoteSendEinvoice operation. Contains the response data from + * the API. + */ +public final class CreditNoteSendEinvoiceResponse extends BaseResponse { + private final CreditNote creditNote; + + private CreditNoteSendEinvoiceResponse(Builder builder) { + super(builder.httpResponse); + + this.creditNote = builder.creditNote; + } + + /** Parse JSON response into CreditNoteSendEinvoiceResponse object. */ + public static CreditNoteSendEinvoiceResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreditNoteSendEinvoiceResponse object with HTTP response. */ + public static CreditNoteSendEinvoiceResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); + if (__creditNoteJson != null) { + builder.creditNote(CreditNote.fromJson(__creditNoteJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditNoteSendEinvoiceResponse from JSON", e); + } + } + + /** Create a new builder for CreditNoteSendEinvoiceResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditNoteSendEinvoiceResponse. */ + public static class Builder { + + private CreditNote creditNote; + + private Response httpResponse; + + private Builder() {} + + public Builder creditNote(CreditNote creditNote) { + this.creditNote = creditNote; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditNoteSendEinvoiceResponse build() { + return new CreditNoteSendEinvoiceResponse(this); + } + } + + /** Get the creditNote from the response. */ + public CreditNote getCreditNote() { + return creditNote; + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNotesForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNotesForCustomerResponse.java index 3789bf32..cc363915 100644 --- a/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNotesForCustomerResponse.java +++ b/src/main/java/com/chargebee/v4/models/creditNote/responses/CreditNotesForCustomerResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.creditNote.CreditNote; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.CreditNoteService; @@ -105,9 +106,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public CreditNotesForCustomerResponse nextPage() throws Exception { + public CreditNotesForCustomerResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/DeleteCreditNoteResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/DeleteCreditNoteResponse.java deleted file mode 100644 index 09dae689..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/responses/DeleteCreditNoteResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.creditNote.responses; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteCreditNote operation. Contains the response data from the - * API. - */ -public final class DeleteCreditNoteResponse extends BaseResponse { - private final CreditNote creditNote; - - private DeleteCreditNoteResponse(Builder builder) { - super(builder.httpResponse); - - this.creditNote = builder.creditNote; - } - - /** Parse JSON response into DeleteCreditNoteResponse object. */ - public static DeleteCreditNoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteCreditNoteResponse object with HTTP response. */ - public static DeleteCreditNoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); - if (__creditNoteJson != null) { - builder.creditNote(CreditNote.fromJson(__creditNoteJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteCreditNoteResponse from JSON", e); - } - } - - /** Create a new builder for DeleteCreditNoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteCreditNoteResponse. */ - public static class Builder { - - private CreditNote creditNote; - - private Response httpResponse; - - private Builder() {} - - public Builder creditNote(CreditNote creditNote) { - this.creditNote = creditNote; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteCreditNoteResponse build() { - return new DeleteCreditNoteResponse(this); - } - } - - /** Get the creditNote from the response. */ - public CreditNote getCreditNote() { - return creditNote; - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/DownloadEinvoiceForCreditNoteResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/DownloadEinvoiceForCreditNoteResponse.java deleted file mode 100644 index a82bf329..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/responses/DownloadEinvoiceForCreditNoteResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.creditNote.responses; - -import com.chargebee.v4.models.download.Download; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import java.util.List; - -/** - * Immutable response object for DownloadEinvoiceForCreditNote operation. Contains the response data - * from a single resource get operation. - */ -public final class DownloadEinvoiceForCreditNoteResponse extends BaseResponse { - private final List downloads; - - private DownloadEinvoiceForCreditNoteResponse(Builder builder) { - super(builder.httpResponse); - - this.downloads = builder.downloads; - } - - /** Parse JSON response into DownloadEinvoiceForCreditNoteResponse object. */ - public static DownloadEinvoiceForCreditNoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DownloadEinvoiceForCreditNoteResponse object with HTTP response. */ - public static DownloadEinvoiceForCreditNoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __downloadsJson = JsonUtil.getArray(json, "downloads"); - if (__downloadsJson != null) { - builder.downloads( - JsonUtil.parseObjectArray(__downloadsJson).stream() - .map(Download::fromJson) - .collect(java.util.stream.Collectors.toList())); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse DownloadEinvoiceForCreditNoteResponse from JSON", e); - } - } - - /** Create a new builder for DownloadEinvoiceForCreditNoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DownloadEinvoiceForCreditNoteResponse. */ - public static class Builder { - - private List downloads; - - private Response httpResponse; - - private Builder() {} - - public Builder downloads(List downloads) { - this.downloads = downloads; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DownloadEinvoiceForCreditNoteResponse build() { - return new DownloadEinvoiceForCreditNoteResponse(this); - } - } - - /** Get the downloads from the response. */ - public List getDownloads() { - return downloads; - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/PdfForCreditNoteResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/PdfForCreditNoteResponse.java deleted file mode 100644 index 1597fc3c..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/responses/PdfForCreditNoteResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.creditNote.responses; - -import com.chargebee.v4.models.download.Download; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for PdfForCreditNote operation. Contains the response data from the - * API. - */ -public final class PdfForCreditNoteResponse extends BaseResponse { - private final Download download; - - private PdfForCreditNoteResponse(Builder builder) { - super(builder.httpResponse); - - this.download = builder.download; - } - - /** Parse JSON response into PdfForCreditNoteResponse object. */ - public static PdfForCreditNoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into PdfForCreditNoteResponse object with HTTP response. */ - public static PdfForCreditNoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __downloadJson = JsonUtil.getObject(json, "download"); - if (__downloadJson != null) { - builder.download(Download.fromJson(__downloadJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse PdfForCreditNoteResponse from JSON", e); - } - } - - /** Create a new builder for PdfForCreditNoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for PdfForCreditNoteResponse. */ - public static class Builder { - - private Download download; - - private Response httpResponse; - - private Builder() {} - - public Builder download(Download download) { - this.download = download; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public PdfForCreditNoteResponse build() { - return new PdfForCreditNoteResponse(this); - } - } - - /** Get the download from the response. */ - public Download getDownload() { - return download; - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/RecordRefundForCreditNoteResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/RecordRefundForCreditNoteResponse.java deleted file mode 100644 index 3f84e3e7..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/responses/RecordRefundForCreditNoteResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.creditNote.responses; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RecordRefundForCreditNote operation. Contains the response data - * from the API. - */ -public final class RecordRefundForCreditNoteResponse extends BaseResponse { - private final CreditNote creditNote; - - private final Transaction transaction; - - private RecordRefundForCreditNoteResponse(Builder builder) { - super(builder.httpResponse); - - this.creditNote = builder.creditNote; - - this.transaction = builder.transaction; - } - - /** Parse JSON response into RecordRefundForCreditNoteResponse object. */ - public static RecordRefundForCreditNoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RecordRefundForCreditNoteResponse object with HTTP response. */ - public static RecordRefundForCreditNoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); - if (__creditNoteJson != null) { - builder.creditNote(CreditNote.fromJson(__creditNoteJson)); - } - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RecordRefundForCreditNoteResponse from JSON", e); - } - } - - /** Create a new builder for RecordRefundForCreditNoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RecordRefundForCreditNoteResponse. */ - public static class Builder { - - private CreditNote creditNote; - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder creditNote(CreditNote creditNote) { - this.creditNote = creditNote; - return this; - } - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RecordRefundForCreditNoteResponse build() { - return new RecordRefundForCreditNoteResponse(this); - } - } - - /** Get the creditNote from the response. */ - public CreditNote getCreditNote() { - return creditNote; - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/RefundForCreditNoteResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/RefundForCreditNoteResponse.java deleted file mode 100644 index 009e9f37..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/responses/RefundForCreditNoteResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.creditNote.responses; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RefundForCreditNote operation. Contains the response data from the - * API. - */ -public final class RefundForCreditNoteResponse extends BaseResponse { - private final CreditNote creditNote; - - private final Transaction transaction; - - private RefundForCreditNoteResponse(Builder builder) { - super(builder.httpResponse); - - this.creditNote = builder.creditNote; - - this.transaction = builder.transaction; - } - - /** Parse JSON response into RefundForCreditNoteResponse object. */ - public static RefundForCreditNoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RefundForCreditNoteResponse object with HTTP response. */ - public static RefundForCreditNoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); - if (__creditNoteJson != null) { - builder.creditNote(CreditNote.fromJson(__creditNoteJson)); - } - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RefundForCreditNoteResponse from JSON", e); - } - } - - /** Create a new builder for RefundForCreditNoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RefundForCreditNoteResponse. */ - public static class Builder { - - private CreditNote creditNote; - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder creditNote(CreditNote creditNote) { - this.creditNote = creditNote; - return this; - } - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RefundForCreditNoteResponse build() { - return new RefundForCreditNoteResponse(this); - } - } - - /** Get the creditNote from the response. */ - public CreditNote getCreditNote() { - return creditNote; - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/RemoveTaxWithheldRefundForCreditNoteResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/RemoveTaxWithheldRefundForCreditNoteResponse.java deleted file mode 100644 index f5304be5..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/responses/RemoveTaxWithheldRefundForCreditNoteResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.creditNote.responses; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RemoveTaxWithheldRefundForCreditNote operation. Contains the - * response data from the API. - */ -public final class RemoveTaxWithheldRefundForCreditNoteResponse extends BaseResponse { - private final CreditNote creditNote; - - private RemoveTaxWithheldRefundForCreditNoteResponse(Builder builder) { - super(builder.httpResponse); - - this.creditNote = builder.creditNote; - } - - /** Parse JSON response into RemoveTaxWithheldRefundForCreditNoteResponse object. */ - public static RemoveTaxWithheldRefundForCreditNoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into RemoveTaxWithheldRefundForCreditNoteResponse object with HTTP - * response. - */ - public static RemoveTaxWithheldRefundForCreditNoteResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); - if (__creditNoteJson != null) { - builder.creditNote(CreditNote.fromJson(__creditNoteJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RemoveTaxWithheldRefundForCreditNoteResponse from JSON", e); - } - } - - /** Create a new builder for RemoveTaxWithheldRefundForCreditNoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RemoveTaxWithheldRefundForCreditNoteResponse. */ - public static class Builder { - - private CreditNote creditNote; - - private Response httpResponse; - - private Builder() {} - - public Builder creditNote(CreditNote creditNote) { - this.creditNote = creditNote; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RemoveTaxWithheldRefundForCreditNoteResponse build() { - return new RemoveTaxWithheldRefundForCreditNoteResponse(this); - } - } - - /** Get the creditNote from the response. */ - public CreditNote getCreditNote() { - return creditNote; - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/ResendEinvoiceForCreditNoteResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/ResendEinvoiceForCreditNoteResponse.java deleted file mode 100644 index b469b7cc..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/responses/ResendEinvoiceForCreditNoteResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.creditNote.responses; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ResendEinvoiceForCreditNote operation. Contains the response data - * from the API. - */ -public final class ResendEinvoiceForCreditNoteResponse extends BaseResponse { - private final CreditNote creditNote; - - private ResendEinvoiceForCreditNoteResponse(Builder builder) { - super(builder.httpResponse); - - this.creditNote = builder.creditNote; - } - - /** Parse JSON response into ResendEinvoiceForCreditNoteResponse object. */ - public static ResendEinvoiceForCreditNoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ResendEinvoiceForCreditNoteResponse object with HTTP response. */ - public static ResendEinvoiceForCreditNoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); - if (__creditNoteJson != null) { - builder.creditNote(CreditNote.fromJson(__creditNoteJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ResendEinvoiceForCreditNoteResponse from JSON", e); - } - } - - /** Create a new builder for ResendEinvoiceForCreditNoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ResendEinvoiceForCreditNoteResponse. */ - public static class Builder { - - private CreditNote creditNote; - - private Response httpResponse; - - private Builder() {} - - public Builder creditNote(CreditNote creditNote) { - this.creditNote = creditNote; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ResendEinvoiceForCreditNoteResponse build() { - return new ResendEinvoiceForCreditNoteResponse(this); - } - } - - /** Get the creditNote from the response. */ - public CreditNote getCreditNote() { - return creditNote; - } -} diff --git a/src/main/java/com/chargebee/v4/models/creditNote/responses/SendEinvoiceForCreditNoteResponse.java b/src/main/java/com/chargebee/v4/models/creditNote/responses/SendEinvoiceForCreditNoteResponse.java deleted file mode 100644 index 0290907f..00000000 --- a/src/main/java/com/chargebee/v4/models/creditNote/responses/SendEinvoiceForCreditNoteResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.creditNote.responses; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for SendEinvoiceForCreditNote operation. Contains the response data - * from the API. - */ -public final class SendEinvoiceForCreditNoteResponse extends BaseResponse { - private final CreditNote creditNote; - - private SendEinvoiceForCreditNoteResponse(Builder builder) { - super(builder.httpResponse); - - this.creditNote = builder.creditNote; - } - - /** Parse JSON response into SendEinvoiceForCreditNoteResponse object. */ - public static SendEinvoiceForCreditNoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into SendEinvoiceForCreditNoteResponse object with HTTP response. */ - public static SendEinvoiceForCreditNoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); - if (__creditNoteJson != null) { - builder.creditNote(CreditNote.fromJson(__creditNoteJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse SendEinvoiceForCreditNoteResponse from JSON", e); - } - } - - /** Create a new builder for SendEinvoiceForCreditNoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for SendEinvoiceForCreditNoteResponse. */ - public static class Builder { - - private CreditNote creditNote; - - private Response httpResponse; - - private Builder() {} - - public Builder creditNote(CreditNote creditNote) { - this.creditNote = creditNote; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public SendEinvoiceForCreditNoteResponse build() { - return new SendEinvoiceForCreditNoteResponse(this); - } - } - - /** Get the creditNote from the response. */ - public CreditNote getCreditNote() { - return creditNote; - } -} diff --git a/src/main/java/com/chargebee/v4/models/currency/params/AddScheduleForCurrencyParams.java b/src/main/java/com/chargebee/v4/models/currency/params/AddScheduleForCurrencyParams.java deleted file mode 100644 index 5b1e520e..00000000 --- a/src/main/java/com/chargebee/v4/models/currency/params/AddScheduleForCurrencyParams.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.currency.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class AddScheduleForCurrencyParams { - - private final String manualExchangeRate; - - private final Timestamp scheduleAt; - - private AddScheduleForCurrencyParams(AddScheduleForCurrencyBuilder builder) { - - this.manualExchangeRate = builder.manualExchangeRate; - - this.scheduleAt = builder.scheduleAt; - } - - public String getManualExchangeRate() { - return manualExchangeRate; - } - - public Timestamp getScheduleAt() { - return scheduleAt; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.manualExchangeRate != null) { - - formData.put("manual_exchange_rate", this.manualExchangeRate); - } - - if (this.scheduleAt != null) { - - formData.put("schedule_at", this.scheduleAt); - } - - return formData; - } - - /** Create a new builder for AddScheduleForCurrencyParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddScheduleForCurrencyBuilder builder() { - return new AddScheduleForCurrencyBuilder(); - } - - public static final class AddScheduleForCurrencyBuilder { - - private String manualExchangeRate; - - private Timestamp scheduleAt; - - private AddScheduleForCurrencyBuilder() {} - - public AddScheduleForCurrencyBuilder manualExchangeRate(String value) { - this.manualExchangeRate = value; - return this; - } - - public AddScheduleForCurrencyBuilder scheduleAt(Timestamp value) { - this.scheduleAt = value; - return this; - } - - public AddScheduleForCurrencyParams build() { - return new AddScheduleForCurrencyParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/currency/params/CurrencyAddScheduleParams.java b/src/main/java/com/chargebee/v4/models/currency/params/CurrencyAddScheduleParams.java new file mode 100644 index 00000000..c8c38fb8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/currency/params/CurrencyAddScheduleParams.java @@ -0,0 +1,81 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.currency.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class CurrencyAddScheduleParams { + + private final String manualExchangeRate; + + private final Timestamp scheduleAt; + + private CurrencyAddScheduleParams(CurrencyAddScheduleBuilder builder) { + + this.manualExchangeRate = builder.manualExchangeRate; + + this.scheduleAt = builder.scheduleAt; + } + + public String getManualExchangeRate() { + return manualExchangeRate; + } + + public Timestamp getScheduleAt() { + return scheduleAt; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.manualExchangeRate != null) { + + formData.put("manual_exchange_rate", this.manualExchangeRate); + } + + if (this.scheduleAt != null) { + + formData.put("schedule_at", this.scheduleAt); + } + + return formData; + } + + /** Create a new builder for CurrencyAddScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CurrencyAddScheduleBuilder builder() { + return new CurrencyAddScheduleBuilder(); + } + + public static final class CurrencyAddScheduleBuilder { + + private String manualExchangeRate; + + private Timestamp scheduleAt; + + private CurrencyAddScheduleBuilder() {} + + public CurrencyAddScheduleBuilder manualExchangeRate(String value) { + this.manualExchangeRate = value; + return this; + } + + public CurrencyAddScheduleBuilder scheduleAt(Timestamp value) { + this.scheduleAt = value; + return this; + } + + public CurrencyAddScheduleParams build() { + return new CurrencyAddScheduleParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/currency/params/CurrencyListListParams.java b/src/main/java/com/chargebee/v4/models/currency/params/CurrencyListListParams.java deleted file mode 100644 index 50da59dd..00000000 --- a/src/main/java/com/chargebee/v4/models/currency/params/CurrencyListListParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.currency.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class CurrencyListListParams { - - private final Map queryParams; - - private CurrencyListListParams(CurrencyListListBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public CurrencyListListBuilder toBuilder() { - CurrencyListListBuilder builder = new CurrencyListListBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for CurrencyListListParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CurrencyListListBuilder builder() { - return new CurrencyListListBuilder(); - } - - public static final class CurrencyListListBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private CurrencyListListBuilder() {} - - public CurrencyListListBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public CurrencyListListBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - public CurrencyListListParams build() { - return new CurrencyListListParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/currency/params/CurrencyListParams.java b/src/main/java/com/chargebee/v4/models/currency/params/CurrencyListParams.java new file mode 100644 index 00000000..588602e1 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/currency/params/CurrencyListParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.currency.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CurrencyListParams { + + private final Map queryParams; + + private CurrencyListParams(CurrencyListBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public CurrencyListBuilder toBuilder() { + CurrencyListBuilder builder = new CurrencyListBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for CurrencyListParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CurrencyListBuilder builder() { + return new CurrencyListBuilder(); + } + + public static final class CurrencyListBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private CurrencyListBuilder() {} + + public CurrencyListBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public CurrencyListBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + public CurrencyListParams build() { + return new CurrencyListParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/currency/params/CurrencyRemoveScheduleParams.java b/src/main/java/com/chargebee/v4/models/currency/params/CurrencyRemoveScheduleParams.java new file mode 100644 index 00000000..68d773b5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/currency/params/CurrencyRemoveScheduleParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.currency.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CurrencyRemoveScheduleParams { + + private CurrencyRemoveScheduleParams(CurrencyRemoveScheduleBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CurrencyRemoveScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CurrencyRemoveScheduleBuilder builder() { + return new CurrencyRemoveScheduleBuilder(); + } + + public static final class CurrencyRemoveScheduleBuilder { + + private CurrencyRemoveScheduleBuilder() {} + + public CurrencyRemoveScheduleParams build() { + return new CurrencyRemoveScheduleParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/currency/params/RemoveScheduleForCurrencyParams.java b/src/main/java/com/chargebee/v4/models/currency/params/RemoveScheduleForCurrencyParams.java deleted file mode 100644 index 14f6fde8..00000000 --- a/src/main/java/com/chargebee/v4/models/currency/params/RemoveScheduleForCurrencyParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.currency.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RemoveScheduleForCurrencyParams { - - private RemoveScheduleForCurrencyParams(RemoveScheduleForCurrencyBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for RemoveScheduleForCurrencyParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RemoveScheduleForCurrencyBuilder builder() { - return new RemoveScheduleForCurrencyBuilder(); - } - - public static final class RemoveScheduleForCurrencyBuilder { - - private RemoveScheduleForCurrencyBuilder() {} - - public RemoveScheduleForCurrencyParams build() { - return new RemoveScheduleForCurrencyParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/currency/responses/AddScheduleForCurrencyResponse.java b/src/main/java/com/chargebee/v4/models/currency/responses/AddScheduleForCurrencyResponse.java deleted file mode 100644 index 92258691..00000000 --- a/src/main/java/com/chargebee/v4/models/currency/responses/AddScheduleForCurrencyResponse.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.chargebee.v4.models.currency.responses; - -import com.chargebee.v4.models.currency.Currency; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import java.sql.Timestamp; - -/** - * Immutable response object for AddScheduleForCurrency operation. Contains the response data from - * the API. - */ -public final class AddScheduleForCurrencyResponse extends BaseResponse { - private final Timestamp scheduledAt; - - private final Currency currency; - - private AddScheduleForCurrencyResponse(Builder builder) { - super(builder.httpResponse); - - this.scheduledAt = builder.scheduledAt; - - this.currency = builder.currency; - } - - /** Parse JSON response into AddScheduleForCurrencyResponse object. */ - public static AddScheduleForCurrencyResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddScheduleForCurrencyResponse object with HTTP response. */ - public static AddScheduleForCurrencyResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.scheduledAt(JsonUtil.getTimestamp(json, "scheduled_at")); - - String __currencyJson = JsonUtil.getObject(json, "currency"); - if (__currencyJson != null) { - builder.currency(Currency.fromJson(__currencyJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddScheduleForCurrencyResponse from JSON", e); - } - } - - /** Create a new builder for AddScheduleForCurrencyResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddScheduleForCurrencyResponse. */ - public static class Builder { - - private Timestamp scheduledAt; - - private Currency currency; - - private Response httpResponse; - - private Builder() {} - - public Builder scheduledAt(Timestamp scheduledAt) { - this.scheduledAt = scheduledAt; - return this; - } - - public Builder currency(Currency currency) { - this.currency = currency; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddScheduleForCurrencyResponse build() { - return new AddScheduleForCurrencyResponse(this); - } - } - - /** Get the scheduledAt from the response. */ - public Timestamp getScheduledAt() { - return scheduledAt; - } - - /** Get the currency from the response. */ - public Currency getCurrency() { - return currency; - } -} diff --git a/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyAddScheduleResponse.java b/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyAddScheduleResponse.java new file mode 100644 index 00000000..3e0b1c2f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyAddScheduleResponse.java @@ -0,0 +1,96 @@ +package com.chargebee.v4.models.currency.responses; + +import com.chargebee.v4.models.currency.Currency; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import java.sql.Timestamp; + +/** + * Immutable response object for CurrencyAddSchedule operation. Contains the response data from the + * API. + */ +public final class CurrencyAddScheduleResponse extends BaseResponse { + private final Timestamp scheduledAt; + + private final Currency currency; + + private CurrencyAddScheduleResponse(Builder builder) { + super(builder.httpResponse); + + this.scheduledAt = builder.scheduledAt; + + this.currency = builder.currency; + } + + /** Parse JSON response into CurrencyAddScheduleResponse object. */ + public static CurrencyAddScheduleResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CurrencyAddScheduleResponse object with HTTP response. */ + public static CurrencyAddScheduleResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.scheduledAt(JsonUtil.getTimestamp(json, "scheduled_at")); + + String __currencyJson = JsonUtil.getObject(json, "currency"); + if (__currencyJson != null) { + builder.currency(Currency.fromJson(__currencyJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CurrencyAddScheduleResponse from JSON", e); + } + } + + /** Create a new builder for CurrencyAddScheduleResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CurrencyAddScheduleResponse. */ + public static class Builder { + + private Timestamp scheduledAt; + + private Currency currency; + + private Response httpResponse; + + private Builder() {} + + public Builder scheduledAt(Timestamp scheduledAt) { + this.scheduledAt = scheduledAt; + return this; + } + + public Builder currency(Currency currency) { + this.currency = currency; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CurrencyAddScheduleResponse build() { + return new CurrencyAddScheduleResponse(this); + } + } + + /** Get the scheduledAt from the response. */ + public Timestamp getScheduledAt() { + return scheduledAt; + } + + /** Get the currency from the response. */ + public Currency getCurrency() { + return currency; + } +} diff --git a/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyListListResponse.java b/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyListListResponse.java deleted file mode 100644 index 1bf002e5..00000000 --- a/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyListListResponse.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.chargebee.v4.models.currency.responses; - -import java.util.List; - -import com.chargebee.v4.models.currency.Currency; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.CurrencyService; -import com.chargebee.v4.models.currency.params.CurrencyListListParams; - -/** Immutable response object for CurrencyListList operation. Contains paginated list data. */ -public final class CurrencyListListResponse { - - private final List list; - - private final String nextOffset; - - private final CurrencyService service; - private final CurrencyListListParams originalParams; - private final Response httpResponse; - - private CurrencyListListResponse( - List list, - String nextOffset, - CurrencyService service, - CurrencyListListParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into CurrencyListListResponse object (no service context). Use this when - * you only need to read a single page (no nextPage()). - */ - public static CurrencyListListResponse fromJson(String json) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(CurrencyListListItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new CurrencyListListResponse(list, nextOffset, null, null, null); - } catch (Exception e) { - throw new RuntimeException("Failed to parse CurrencyListListResponse from JSON", e); - } - } - - /** - * Parse JSON response into CurrencyListListResponse object with service context for pagination - * (enables nextPage()). - */ - public static CurrencyListListResponse fromJson( - String json, - CurrencyService service, - CurrencyListListParams originalParams, - Response httpResponse) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(CurrencyListListItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new CurrencyListListResponse(list, nextOffset, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException("Failed to parse CurrencyListListResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public CurrencyListListResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - CurrencyListListParams nextParams = - (originalParams != null ? originalParams.toBuilder() : CurrencyListListParams.builder()) - .offset(nextOffset) - .build(); - - return service.listList(nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } - - public static class CurrencyListListItem { - - private Currency currency; - - public Currency getCurrency() { - return currency; - } - - public static CurrencyListListItem fromJson(String json) { - CurrencyListListItem item = new CurrencyListListItem(); - - String __currencyJson = JsonUtil.getObject(json, "currency"); - if (__currencyJson != null) { - item.currency = Currency.fromJson(__currencyJson); - } - - return item; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyListResponse.java b/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyListResponse.java new file mode 100644 index 00000000..d85a13af --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyListResponse.java @@ -0,0 +1,165 @@ +package com.chargebee.v4.models.currency.responses; + +import java.util.List; + +import com.chargebee.v4.models.currency.Currency; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.CurrencyService; +import com.chargebee.v4.models.currency.params.CurrencyListParams; + +/** Immutable response object for CurrencyList operation. Contains paginated list data. */ +public final class CurrencyListResponse { + + private final List list; + + private final String nextOffset; + + private final CurrencyService service; + private final CurrencyListParams originalParams; + private final Response httpResponse; + + private CurrencyListResponse( + List list, + String nextOffset, + CurrencyService service, + CurrencyListParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into CurrencyListResponse object (no service context). Use this when you + * only need to read a single page (no nextPage()). + */ + public static CurrencyListResponse fromJson(String json) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(CurrencyListItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new CurrencyListResponse(list, nextOffset, null, null, null); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CurrencyListResponse from JSON", e); + } + } + + /** + * Parse JSON response into CurrencyListResponse object with service context for pagination + * (enables nextPage()). + */ + public static CurrencyListResponse fromJson( + String json, + CurrencyService service, + CurrencyListParams originalParams, + Response httpResponse) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(CurrencyListItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new CurrencyListResponse(list, nextOffset, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CurrencyListResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public CurrencyListResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + CurrencyListParams nextParams = + (originalParams != null ? originalParams.toBuilder() : CurrencyListParams.builder()) + .offset(nextOffset) + .build(); + + return service.list(nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + public static class CurrencyListItem { + + private Currency currency; + + public Currency getCurrency() { + return currency; + } + + public static CurrencyListItem fromJson(String json) { + CurrencyListItem item = new CurrencyListItem(); + + String __currencyJson = JsonUtil.getObject(json, "currency"); + if (__currencyJson != null) { + item.currency = Currency.fromJson(__currencyJson); + } + + return item; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyRemoveScheduleResponse.java b/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyRemoveScheduleResponse.java new file mode 100644 index 00000000..1d740b01 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/currency/responses/CurrencyRemoveScheduleResponse.java @@ -0,0 +1,96 @@ +package com.chargebee.v4.models.currency.responses; + +import com.chargebee.v4.models.currency.Currency; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import java.sql.Timestamp; + +/** + * Immutable response object for CurrencyRemoveSchedule operation. Contains the response data from + * the API. + */ +public final class CurrencyRemoveScheduleResponse extends BaseResponse { + private final Timestamp scheduledAt; + + private final Currency currency; + + private CurrencyRemoveScheduleResponse(Builder builder) { + super(builder.httpResponse); + + this.scheduledAt = builder.scheduledAt; + + this.currency = builder.currency; + } + + /** Parse JSON response into CurrencyRemoveScheduleResponse object. */ + public static CurrencyRemoveScheduleResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CurrencyRemoveScheduleResponse object with HTTP response. */ + public static CurrencyRemoveScheduleResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.scheduledAt(JsonUtil.getTimestamp(json, "scheduled_at")); + + String __currencyJson = JsonUtil.getObject(json, "currency"); + if (__currencyJson != null) { + builder.currency(Currency.fromJson(__currencyJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CurrencyRemoveScheduleResponse from JSON", e); + } + } + + /** Create a new builder for CurrencyRemoveScheduleResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CurrencyRemoveScheduleResponse. */ + public static class Builder { + + private Timestamp scheduledAt; + + private Currency currency; + + private Response httpResponse; + + private Builder() {} + + public Builder scheduledAt(Timestamp scheduledAt) { + this.scheduledAt = scheduledAt; + return this; + } + + public Builder currency(Currency currency) { + this.currency = currency; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CurrencyRemoveScheduleResponse build() { + return new CurrencyRemoveScheduleResponse(this); + } + } + + /** Get the scheduledAt from the response. */ + public Timestamp getScheduledAt() { + return scheduledAt; + } + + /** Get the currency from the response. */ + public Currency getCurrency() { + return currency; + } +} diff --git a/src/main/java/com/chargebee/v4/models/currency/responses/RemoveScheduleForCurrencyResponse.java b/src/main/java/com/chargebee/v4/models/currency/responses/RemoveScheduleForCurrencyResponse.java deleted file mode 100644 index ba572c3a..00000000 --- a/src/main/java/com/chargebee/v4/models/currency/responses/RemoveScheduleForCurrencyResponse.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.chargebee.v4.models.currency.responses; - -import com.chargebee.v4.models.currency.Currency; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import java.sql.Timestamp; - -/** - * Immutable response object for RemoveScheduleForCurrency operation. Contains the response data - * from the API. - */ -public final class RemoveScheduleForCurrencyResponse extends BaseResponse { - private final Timestamp scheduledAt; - - private final Currency currency; - - private RemoveScheduleForCurrencyResponse(Builder builder) { - super(builder.httpResponse); - - this.scheduledAt = builder.scheduledAt; - - this.currency = builder.currency; - } - - /** Parse JSON response into RemoveScheduleForCurrencyResponse object. */ - public static RemoveScheduleForCurrencyResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RemoveScheduleForCurrencyResponse object with HTTP response. */ - public static RemoveScheduleForCurrencyResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.scheduledAt(JsonUtil.getTimestamp(json, "scheduled_at")); - - String __currencyJson = JsonUtil.getObject(json, "currency"); - if (__currencyJson != null) { - builder.currency(Currency.fromJson(__currencyJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RemoveScheduleForCurrencyResponse from JSON", e); - } - } - - /** Create a new builder for RemoveScheduleForCurrencyResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RemoveScheduleForCurrencyResponse. */ - public static class Builder { - - private Timestamp scheduledAt; - - private Currency currency; - - private Response httpResponse; - - private Builder() {} - - public Builder scheduledAt(Timestamp scheduledAt) { - this.scheduledAt = scheduledAt; - return this; - } - - public Builder currency(Currency currency) { - this.currency = currency; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RemoveScheduleForCurrencyResponse build() { - return new RemoveScheduleForCurrencyResponse(this); - } - } - - /** Get the scheduledAt from the response. */ - public Timestamp getScheduledAt() { - return scheduledAt; - } - - /** Get the currency from the response. */ - public Currency getCurrency() { - return currency; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/AddContactForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/AddContactForCustomerParams.java deleted file mode 100644 index 4ef094cc..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/AddContactForCustomerParams.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AddContactForCustomerParams { - - private final ContactParams contact; - - private final Map consentFields; - - private AddContactForCustomerParams(AddContactForCustomerBuilder builder) { - - this.contact = builder.contact; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public ContactParams getContact() { - return contact; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.contact != null) { - - // Single object - Map nestedData = this.contact.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contact[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for AddContactForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddContactForCustomerBuilder builder() { - return new AddContactForCustomerBuilder(); - } - - public static final class AddContactForCustomerBuilder { - - private ContactParams contact; - - private Map consentFields = new LinkedHashMap<>(); - - private AddContactForCustomerBuilder() {} - - public AddContactForCustomerBuilder contact(ContactParams value) { - this.contact = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public AddContactForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public AddContactForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public AddContactForCustomerBuilder consentFields(Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public AddContactForCustomerParams build() { - return new AddContactForCustomerParams(this); - } - } - - public static final class ContactParams { - - private final String id; - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String phone; - - private final String label; - - private final Boolean enabled; - - private final Boolean sendBillingEmail; - - private final Boolean sendAccountEmail; - - private ContactParams(ContactBuilder builder) { - - this.id = builder.id; - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.phone = builder.phone; - - this.label = builder.label; - - this.enabled = builder.enabled; - - this.sendBillingEmail = builder.sendBillingEmail; - - this.sendAccountEmail = builder.sendAccountEmail; - } - - public String getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getPhone() { - return phone; - } - - public String getLabel() { - return label; - } - - public Boolean getEnabled() { - return enabled; - } - - public Boolean getSendBillingEmail() { - return sendBillingEmail; - } - - public Boolean getSendAccountEmail() { - return sendAccountEmail; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.label != null) { - - formData.put("label", this.label); - } - - if (this.enabled != null) { - - formData.put("enabled", this.enabled); - } - - if (this.sendBillingEmail != null) { - - formData.put("send_billing_email", this.sendBillingEmail); - } - - if (this.sendAccountEmail != null) { - - formData.put("send_account_email", this.sendAccountEmail); - } - - return formData; - } - - /** Create a new builder for ContactParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContactBuilder builder() { - return new ContactBuilder(); - } - - public static final class ContactBuilder { - - private String id; - - private String firstName; - - private String lastName; - - private String email; - - private String phone; - - private String label; - - private Boolean enabled; - - private Boolean sendBillingEmail; - - private Boolean sendAccountEmail; - - private ContactBuilder() {} - - public ContactBuilder id(String value) { - this.id = value; - return this; - } - - public ContactBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ContactBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ContactBuilder email(String value) { - this.email = value; - return this; - } - - public ContactBuilder phone(String value) { - this.phone = value; - return this; - } - - public ContactBuilder label(String value) { - this.label = value; - return this; - } - - public ContactBuilder enabled(Boolean value) { - this.enabled = value; - return this; - } - - public ContactBuilder sendBillingEmail(Boolean value) { - this.sendBillingEmail = value; - return this; - } - - public ContactBuilder sendAccountEmail(Boolean value) { - this.sendAccountEmail = value; - return this; - } - - public ContactParams build() { - return new ContactParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/AddPromotionalCreditsForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/AddPromotionalCreditsForCustomerParams.java deleted file mode 100644 index 04ddebb4..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/AddPromotionalCreditsForCustomerParams.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AddPromotionalCreditsForCustomerParams { - - private final Long amount; - - private final String currencyCode; - - private final String description; - - private final CreditType creditType; - - private final String reference; - - private final Map consentFields; - - private AddPromotionalCreditsForCustomerParams(AddPromotionalCreditsForCustomerBuilder builder) { - - this.amount = builder.amount; - - this.currencyCode = builder.currencyCode; - - this.description = builder.description; - - this.creditType = builder.creditType; - - this.reference = builder.reference; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public Long getAmount() { - return amount; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public String getDescription() { - return description; - } - - public CreditType getCreditType() { - return creditType; - } - - public String getReference() { - return reference; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.currencyCode != null) { - - formData.put("currency_code", this.currencyCode); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.creditType != null) { - - formData.put("credit_type", this.creditType); - } - - if (this.reference != null) { - - formData.put("reference", this.reference); - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for AddPromotionalCreditsForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddPromotionalCreditsForCustomerBuilder builder() { - return new AddPromotionalCreditsForCustomerBuilder(); - } - - public static final class AddPromotionalCreditsForCustomerBuilder { - - private Long amount; - - private String currencyCode; - - private String description; - - private CreditType creditType; - - private String reference; - - private Map consentFields = new LinkedHashMap<>(); - - private AddPromotionalCreditsForCustomerBuilder() {} - - public AddPromotionalCreditsForCustomerBuilder amount(Long value) { - this.amount = value; - return this; - } - - public AddPromotionalCreditsForCustomerBuilder currencyCode(String value) { - this.currencyCode = value; - return this; - } - - public AddPromotionalCreditsForCustomerBuilder description(String value) { - this.description = value; - return this; - } - - public AddPromotionalCreditsForCustomerBuilder creditType(CreditType value) { - this.creditType = value; - return this; - } - - public AddPromotionalCreditsForCustomerBuilder reference(String value) { - this.reference = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public AddPromotionalCreditsForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public AddPromotionalCreditsForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public AddPromotionalCreditsForCustomerBuilder consentFields( - Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public AddPromotionalCreditsForCustomerParams build() { - return new AddPromotionalCreditsForCustomerParams(this); - } - } - - public enum CreditType { - LOYALTY_CREDITS("loyalty_credits"), - - REFERRAL_REWARDS("referral_rewards"), - - GENERAL("general"), - - /** An enum member indicating that CreditType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - CreditType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CreditType fromString(String value) { - if (value == null) return _UNKNOWN; - for (CreditType enumValue : CreditType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/AssignPaymentRoleForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/AssignPaymentRoleForCustomerParams.java deleted file mode 100644 index 24262f04..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/AssignPaymentRoleForCustomerParams.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AssignPaymentRoleForCustomerParams { - - private final String paymentSourceId; - - private final Role role; - - private final Map consentFields; - - private AssignPaymentRoleForCustomerParams(AssignPaymentRoleForCustomerBuilder builder) { - - this.paymentSourceId = builder.paymentSourceId; - - this.role = builder.role; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public String getPaymentSourceId() { - return paymentSourceId; - } - - public Role getRole() { - return role; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.paymentSourceId != null) { - - formData.put("payment_source_id", this.paymentSourceId); - } - - if (this.role != null) { - - formData.put("role", this.role); - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for AssignPaymentRoleForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AssignPaymentRoleForCustomerBuilder builder() { - return new AssignPaymentRoleForCustomerBuilder(); - } - - public static final class AssignPaymentRoleForCustomerBuilder { - - private String paymentSourceId; - - private Role role; - - private Map consentFields = new LinkedHashMap<>(); - - private AssignPaymentRoleForCustomerBuilder() {} - - public AssignPaymentRoleForCustomerBuilder paymentSourceId(String value) { - this.paymentSourceId = value; - return this; - } - - public AssignPaymentRoleForCustomerBuilder role(Role value) { - this.role = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public AssignPaymentRoleForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public AssignPaymentRoleForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public AssignPaymentRoleForCustomerBuilder consentFields(Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public AssignPaymentRoleForCustomerParams build() { - return new AssignPaymentRoleForCustomerParams(this); - } - } - - public enum Role { - PRIMARY("primary"), - - BACKUP("backup"), - - NONE("none"), - - /** An enum member indicating that Role was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Role(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Role fromString(String value) { - if (value == null) return _UNKNOWN; - for (Role enumValue : Role.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/ChangeBillingDateForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/ChangeBillingDateForCustomerParams.java deleted file mode 100644 index 46f90a2b..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/ChangeBillingDateForCustomerParams.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ChangeBillingDateForCustomerParams { - - private final Integer billingDate; - - private final Integer billingMonth; - - private final BillingDateMode billingDateMode; - - private final BillingDayOfWeek billingDayOfWeek; - - private final BillingDayOfWeekMode billingDayOfWeekMode; - - private final Map consentFields; - - private ChangeBillingDateForCustomerParams(ChangeBillingDateForCustomerBuilder builder) { - - this.billingDate = builder.billingDate; - - this.billingMonth = builder.billingMonth; - - this.billingDateMode = builder.billingDateMode; - - this.billingDayOfWeek = builder.billingDayOfWeek; - - this.billingDayOfWeekMode = builder.billingDayOfWeekMode; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public Integer getBillingDate() { - return billingDate; - } - - public Integer getBillingMonth() { - return billingMonth; - } - - public BillingDateMode getBillingDateMode() { - return billingDateMode; - } - - public BillingDayOfWeek getBillingDayOfWeek() { - return billingDayOfWeek; - } - - public BillingDayOfWeekMode getBillingDayOfWeekMode() { - return billingDayOfWeekMode; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.billingDate != null) { - - formData.put("billing_date", this.billingDate); - } - - if (this.billingMonth != null) { - - formData.put("billing_month", this.billingMonth); - } - - if (this.billingDateMode != null) { - - formData.put("billing_date_mode", this.billingDateMode); - } - - if (this.billingDayOfWeek != null) { - - formData.put("billing_day_of_week", this.billingDayOfWeek); - } - - if (this.billingDayOfWeekMode != null) { - - formData.put("billing_day_of_week_mode", this.billingDayOfWeekMode); - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for ChangeBillingDateForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ChangeBillingDateForCustomerBuilder builder() { - return new ChangeBillingDateForCustomerBuilder(); - } - - public static final class ChangeBillingDateForCustomerBuilder { - - private Integer billingDate; - - private Integer billingMonth; - - private BillingDateMode billingDateMode; - - private BillingDayOfWeek billingDayOfWeek; - - private BillingDayOfWeekMode billingDayOfWeekMode; - - private Map consentFields = new LinkedHashMap<>(); - - private ChangeBillingDateForCustomerBuilder() {} - - public ChangeBillingDateForCustomerBuilder billingDate(Integer value) { - this.billingDate = value; - return this; - } - - public ChangeBillingDateForCustomerBuilder billingMonth(Integer value) { - this.billingMonth = value; - return this; - } - - public ChangeBillingDateForCustomerBuilder billingDateMode(BillingDateMode value) { - this.billingDateMode = value; - return this; - } - - public ChangeBillingDateForCustomerBuilder billingDayOfWeek(BillingDayOfWeek value) { - this.billingDayOfWeek = value; - return this; - } - - public ChangeBillingDateForCustomerBuilder billingDayOfWeekMode(BillingDayOfWeekMode value) { - this.billingDayOfWeekMode = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public ChangeBillingDateForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public ChangeBillingDateForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public ChangeBillingDateForCustomerBuilder consentFields(Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public ChangeBillingDateForCustomerParams build() { - return new ChangeBillingDateForCustomerParams(this); - } - } - - public enum BillingDateMode { - USING_DEFAULTS("using_defaults"), - - MANUALLY_SET("manually_set"), - - /** An enum member indicating that BillingDateMode was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - BillingDateMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingDateMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingDateMode enumValue : BillingDateMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum BillingDayOfWeek { - SUNDAY("sunday"), - - MONDAY("monday"), - - TUESDAY("tuesday"), - - WEDNESDAY("wednesday"), - - THURSDAY("thursday"), - - FRIDAY("friday"), - - SATURDAY("saturday"), - - /** An enum member indicating that BillingDayOfWeek was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - BillingDayOfWeek(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingDayOfWeek fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingDayOfWeek enumValue : BillingDayOfWeek.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum BillingDayOfWeekMode { - USING_DEFAULTS("using_defaults"), - - MANUALLY_SET("manually_set"), - - /** - * An enum member indicating that BillingDayOfWeekMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingDayOfWeekMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingDayOfWeekMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingDayOfWeekMode enumValue : BillingDayOfWeekMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/ClearPersonalDataForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/ClearPersonalDataForCustomerParams.java deleted file mode 100644 index 7cda0257..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/ClearPersonalDataForCustomerParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ClearPersonalDataForCustomerParams { - - private ClearPersonalDataForCustomerParams(ClearPersonalDataForCustomerBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for ClearPersonalDataForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ClearPersonalDataForCustomerBuilder builder() { - return new ClearPersonalDataForCustomerBuilder(); - } - - public static final class ClearPersonalDataForCustomerBuilder { - - private ClearPersonalDataForCustomerBuilder() {} - - public ClearPersonalDataForCustomerParams build() { - return new ClearPersonalDataForCustomerParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CollectPaymentForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CollectPaymentForCustomerParams.java deleted file mode 100644 index ccbb73d7..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/CollectPaymentForCustomerParams.java +++ /dev/null @@ -1,1270 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class CollectPaymentForCustomerParams { - - private final Long amount; - - private final String paymentSourceId; - - private final String tokenId; - - private final Boolean replacePrimaryPaymentSource; - - private final Boolean retainPaymentSource; - - private final PaymentInitiator paymentInitiator; - - private final PaymentMethodParams paymentMethod; - - private final CardParams card; - - private final PaymentIntentParams paymentIntent; - - private final List invoiceAllocations; - - private final Map consentFields; - - private CollectPaymentForCustomerParams(CollectPaymentForCustomerBuilder builder) { - - this.amount = builder.amount; - - this.paymentSourceId = builder.paymentSourceId; - - this.tokenId = builder.tokenId; - - this.replacePrimaryPaymentSource = builder.replacePrimaryPaymentSource; - - this.retainPaymentSource = builder.retainPaymentSource; - - this.paymentInitiator = builder.paymentInitiator; - - this.paymentMethod = builder.paymentMethod; - - this.card = builder.card; - - this.paymentIntent = builder.paymentIntent; - - this.invoiceAllocations = builder.invoiceAllocations; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public Long getAmount() { - return amount; - } - - public String getPaymentSourceId() { - return paymentSourceId; - } - - public String getTokenId() { - return tokenId; - } - - public Boolean getReplacePrimaryPaymentSource() { - return replacePrimaryPaymentSource; - } - - public Boolean getRetainPaymentSource() { - return retainPaymentSource; - } - - public PaymentInitiator getPaymentInitiator() { - return paymentInitiator; - } - - public PaymentMethodParams getPaymentMethod() { - return paymentMethod; - } - - public CardParams getCard() { - return card; - } - - public PaymentIntentParams getPaymentIntent() { - return paymentIntent; - } - - public List getInvoiceAllocations() { - return invoiceAllocations; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.paymentSourceId != null) { - - formData.put("payment_source_id", this.paymentSourceId); - } - - if (this.tokenId != null) { - - formData.put("token_id", this.tokenId); - } - - if (this.replacePrimaryPaymentSource != null) { - - formData.put("replace_primary_payment_source", this.replacePrimaryPaymentSource); - } - - if (this.retainPaymentSource != null) { - - formData.put("retain_payment_source", this.retainPaymentSource); - } - - if (this.paymentInitiator != null) { - - formData.put("payment_initiator", this.paymentInitiator); - } - - if (this.paymentMethod != null) { - - // Single object - Map nestedData = this.paymentMethod.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "payment_method[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.card != null) { - - // Single object - Map nestedData = this.card.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "card[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.paymentIntent != null) { - - // Single object - Map nestedData = this.paymentIntent.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "payment_intent[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.invoiceAllocations != null) { - - // List of objects - for (int i = 0; i < this.invoiceAllocations.size(); i++) { - InvoiceAllocationsParams item = this.invoiceAllocations.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "invoice_allocations[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for CollectPaymentForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CollectPaymentForCustomerBuilder builder() { - return new CollectPaymentForCustomerBuilder(); - } - - public static final class CollectPaymentForCustomerBuilder { - - private Long amount; - - private String paymentSourceId; - - private String tokenId; - - private Boolean replacePrimaryPaymentSource; - - private Boolean retainPaymentSource; - - private PaymentInitiator paymentInitiator; - - private PaymentMethodParams paymentMethod; - - private CardParams card; - - private PaymentIntentParams paymentIntent; - - private List invoiceAllocations; - - private Map consentFields = new LinkedHashMap<>(); - - private CollectPaymentForCustomerBuilder() {} - - public CollectPaymentForCustomerBuilder amount(Long value) { - this.amount = value; - return this; - } - - public CollectPaymentForCustomerBuilder paymentSourceId(String value) { - this.paymentSourceId = value; - return this; - } - - public CollectPaymentForCustomerBuilder tokenId(String value) { - this.tokenId = value; - return this; - } - - public CollectPaymentForCustomerBuilder replacePrimaryPaymentSource(Boolean value) { - this.replacePrimaryPaymentSource = value; - return this; - } - - public CollectPaymentForCustomerBuilder retainPaymentSource(Boolean value) { - this.retainPaymentSource = value; - return this; - } - - public CollectPaymentForCustomerBuilder paymentInitiator(PaymentInitiator value) { - this.paymentInitiator = value; - return this; - } - - public CollectPaymentForCustomerBuilder paymentMethod(PaymentMethodParams value) { - this.paymentMethod = value; - return this; - } - - public CollectPaymentForCustomerBuilder card(CardParams value) { - this.card = value; - return this; - } - - public CollectPaymentForCustomerBuilder paymentIntent(PaymentIntentParams value) { - this.paymentIntent = value; - return this; - } - - public CollectPaymentForCustomerBuilder invoiceAllocations( - List value) { - this.invoiceAllocations = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public CollectPaymentForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public CollectPaymentForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public CollectPaymentForCustomerBuilder consentFields(Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public CollectPaymentForCustomerParams build() { - return new CollectPaymentForCustomerParams(this); - } - } - - public enum PaymentInitiator { - CUSTOMER("customer"), - - MERCHANT("merchant"), - - /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentInitiator(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentInitiator fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentInitiator enumValue : PaymentInitiator.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class PaymentMethodParams { - - private final Type type; - - private final String gatewayAccountId; - - private final String referenceId; - - private final String tmpToken; - - private final java.util.Map additionalInformation; - - private PaymentMethodParams(PaymentMethodBuilder builder) { - - this.type = builder.type; - - this.gatewayAccountId = builder.gatewayAccountId; - - this.referenceId = builder.referenceId; - - this.tmpToken = builder.tmpToken; - - this.additionalInformation = builder.additionalInformation; - } - - public Type getType() { - return type; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getReferenceId() { - return referenceId; - } - - public String getTmpToken() { - return tmpToken; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.type != null) { - - formData.put("type", this.type); - } - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.referenceId != null) { - - formData.put("reference_id", this.referenceId); - } - - if (this.tmpToken != null) { - - formData.put("tmp_token", this.tmpToken); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for PaymentMethodParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PaymentMethodBuilder builder() { - return new PaymentMethodBuilder(); - } - - public static final class PaymentMethodBuilder { - - private Type type; - - private String gatewayAccountId; - - private String referenceId; - - private String tmpToken; - - private java.util.Map additionalInformation; - - private PaymentMethodBuilder() {} - - public PaymentMethodBuilder type(Type value) { - this.type = value; - return this; - } - - public PaymentMethodBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public PaymentMethodBuilder referenceId(String value) { - this.referenceId = value; - return this; - } - - public PaymentMethodBuilder tmpToken(String value) { - this.tmpToken = value; - return this; - } - - public PaymentMethodBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public PaymentMethodParams build() { - return new PaymentMethodParams(this); - } - } - - public enum Type { - CARD("card"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - AMAZON_PAYMENTS("amazon_payments"), - - DIRECT_DEBIT("direct_debit"), - - GENERIC("generic"), - - ALIPAY("alipay"), - - UNIONPAY("unionpay"), - - APPLE_PAY("apple_pay"), - - WECHAT_PAY("wechat_pay"), - - IDEAL("ideal"), - - GOOGLE_PAY("google_pay"), - - SOFORT("sofort"), - - BANCONTACT("bancontact"), - - GIROPAY("giropay"), - - DOTPAY("dotpay"), - - UPI("upi"), - - NETBANKING_EMANDATES("netbanking_emandates"), - - VENMO("venmo"), - - PAY_TO("pay_to"), - - FASTER_PAYMENTS("faster_payments"), - - SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), - - AUTOMATED_BANK_TRANSFER("automated_bank_transfer"), - - KLARNA_PAY_NOW("klarna_pay_now"), - - ONLINE_BANKING_POLAND("online_banking_poland"), - - PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), - - ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), - - KBC_PAYMENT_BUTTON("kbc_payment_button"), - - PAY_BY_BANK("pay_by_bank"), - - TRUSTLY("trustly"), - - STABLECOIN("stablecoin"), - - /** An enum member indicating that Type was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Type(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Type fromString(String value) { - if (value == null) return _UNKNOWN; - for (Type enumValue : Type.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CardParams { - - private final String gatewayAccountId; - - private final String firstName; - - private final String lastName; - - private final String number; - - private final Integer expiryMonth; - - private final Integer expiryYear; - - private final String cvv; - - private final PreferredScheme preferredScheme; - - private final String billingAddr1; - - private final String billingAddr2; - - private final String billingCity; - - private final String billingStateCode; - - private final String billingState; - - private final String billingZip; - - private final String billingCountry; - - private final java.util.Map additionalInformation; - - private CardParams(CardBuilder builder) { - - this.gatewayAccountId = builder.gatewayAccountId; - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.number = builder.number; - - this.expiryMonth = builder.expiryMonth; - - this.expiryYear = builder.expiryYear; - - this.cvv = builder.cvv; - - this.preferredScheme = builder.preferredScheme; - - this.billingAddr1 = builder.billingAddr1; - - this.billingAddr2 = builder.billingAddr2; - - this.billingCity = builder.billingCity; - - this.billingStateCode = builder.billingStateCode; - - this.billingState = builder.billingState; - - this.billingZip = builder.billingZip; - - this.billingCountry = builder.billingCountry; - - this.additionalInformation = builder.additionalInformation; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getNumber() { - return number; - } - - public Integer getExpiryMonth() { - return expiryMonth; - } - - public Integer getExpiryYear() { - return expiryYear; - } - - public String getCvv() { - return cvv; - } - - public PreferredScheme getPreferredScheme() { - return preferredScheme; - } - - public String getBillingAddr1() { - return billingAddr1; - } - - public String getBillingAddr2() { - return billingAddr2; - } - - public String getBillingCity() { - return billingCity; - } - - public String getBillingStateCode() { - return billingStateCode; - } - - public String getBillingState() { - return billingState; - } - - public String getBillingZip() { - return billingZip; - } - - public String getBillingCountry() { - return billingCountry; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.number != null) { - - formData.put("number", this.number); - } - - if (this.expiryMonth != null) { - - formData.put("expiry_month", this.expiryMonth); - } - - if (this.expiryYear != null) { - - formData.put("expiry_year", this.expiryYear); - } - - if (this.cvv != null) { - - formData.put("cvv", this.cvv); - } - - if (this.preferredScheme != null) { - - formData.put("preferred_scheme", this.preferredScheme); - } - - if (this.billingAddr1 != null) { - - formData.put("billing_addr1", this.billingAddr1); - } - - if (this.billingAddr2 != null) { - - formData.put("billing_addr2", this.billingAddr2); - } - - if (this.billingCity != null) { - - formData.put("billing_city", this.billingCity); - } - - if (this.billingStateCode != null) { - - formData.put("billing_state_code", this.billingStateCode); - } - - if (this.billingState != null) { - - formData.put("billing_state", this.billingState); - } - - if (this.billingZip != null) { - - formData.put("billing_zip", this.billingZip); - } - - if (this.billingCountry != null) { - - formData.put("billing_country", this.billingCountry); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for CardParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CardBuilder builder() { - return new CardBuilder(); - } - - public static final class CardBuilder { - - private String gatewayAccountId; - - private String firstName; - - private String lastName; - - private String number; - - private Integer expiryMonth; - - private Integer expiryYear; - - private String cvv; - - private PreferredScheme preferredScheme; - - private String billingAddr1; - - private String billingAddr2; - - private String billingCity; - - private String billingStateCode; - - private String billingState; - - private String billingZip; - - private String billingCountry; - - private java.util.Map additionalInformation; - - private CardBuilder() {} - - public CardBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public CardBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public CardBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public CardBuilder number(String value) { - this.number = value; - return this; - } - - public CardBuilder expiryMonth(Integer value) { - this.expiryMonth = value; - return this; - } - - public CardBuilder expiryYear(Integer value) { - this.expiryYear = value; - return this; - } - - public CardBuilder cvv(String value) { - this.cvv = value; - return this; - } - - public CardBuilder preferredScheme(PreferredScheme value) { - this.preferredScheme = value; - return this; - } - - public CardBuilder billingAddr1(String value) { - this.billingAddr1 = value; - return this; - } - - public CardBuilder billingAddr2(String value) { - this.billingAddr2 = value; - return this; - } - - public CardBuilder billingCity(String value) { - this.billingCity = value; - return this; - } - - public CardBuilder billingStateCode(String value) { - this.billingStateCode = value; - return this; - } - - public CardBuilder billingState(String value) { - this.billingState = value; - return this; - } - - public CardBuilder billingZip(String value) { - this.billingZip = value; - return this; - } - - public CardBuilder billingCountry(String value) { - this.billingCountry = value; - return this; - } - - public CardBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public CardParams build() { - return new CardParams(this); - } - } - - public enum PreferredScheme { - CARTES_BANCAIRES("cartes_bancaires"), - - MASTERCARD("mastercard"), - - VISA("visa"), - - /** An enum member indicating that PreferredScheme was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PreferredScheme(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PreferredScheme fromString(String value) { - if (value == null) return _UNKNOWN; - for (PreferredScheme enumValue : PreferredScheme.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class PaymentIntentParams { - - private final String id; - - private final String gatewayAccountId; - - private final String gwToken; - - private final PaymentMethodType paymentMethodType; - - private final String gwPaymentMethodId; - - private final String referenceId; - - private final java.util.Map additionalInformation; - - private PaymentIntentParams(PaymentIntentBuilder builder) { - - this.id = builder.id; - - this.gatewayAccountId = builder.gatewayAccountId; - - this.gwToken = builder.gwToken; - - this.paymentMethodType = builder.paymentMethodType; - - this.gwPaymentMethodId = builder.gwPaymentMethodId; - - this.referenceId = builder.referenceId; - - this.additionalInformation = builder.additionalInformation; - } - - public String getId() { - return id; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getGwToken() { - return gwToken; - } - - public PaymentMethodType getPaymentMethodType() { - return paymentMethodType; - } - - public String getGwPaymentMethodId() { - return gwPaymentMethodId; - } - - public String getReferenceId() { - return referenceId; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.gwToken != null) { - - formData.put("gw_token", this.gwToken); - } - - if (this.paymentMethodType != null) { - - formData.put("payment_method_type", this.paymentMethodType); - } - - if (this.gwPaymentMethodId != null) { - - formData.put("gw_payment_method_id", this.gwPaymentMethodId); - } - - if (this.referenceId != null) { - - formData.put("reference_id", this.referenceId); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for PaymentIntentParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PaymentIntentBuilder builder() { - return new PaymentIntentBuilder(); - } - - public static final class PaymentIntentBuilder { - - private String id; - - private String gatewayAccountId; - - private String gwToken; - - private PaymentMethodType paymentMethodType; - - private String gwPaymentMethodId; - - private String referenceId; - - private java.util.Map additionalInformation; - - private PaymentIntentBuilder() {} - - public PaymentIntentBuilder id(String value) { - this.id = value; - return this; - } - - public PaymentIntentBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public PaymentIntentBuilder gwToken(String value) { - this.gwToken = value; - return this; - } - - public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { - this.paymentMethodType = value; - return this; - } - - @Deprecated - public PaymentIntentBuilder gwPaymentMethodId(String value) { - this.gwPaymentMethodId = value; - return this; - } - - public PaymentIntentBuilder referenceId(String value) { - this.referenceId = value; - return this; - } - - public PaymentIntentBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public PaymentIntentParams build() { - return new PaymentIntentParams(this); - } - } - - public enum PaymentMethodType { - CARD("card"), - - IDEAL("ideal"), - - SOFORT("sofort"), - - BANCONTACT("bancontact"), - - GOOGLE_PAY("google_pay"), - - DOTPAY("dotpay"), - - GIROPAY("giropay"), - - APPLE_PAY("apple_pay"), - - UPI("upi"), - - NETBANKING_EMANDATES("netbanking_emandates"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - DIRECT_DEBIT("direct_debit"), - - BOLETO("boleto"), - - VENMO("venmo"), - - AMAZON_PAYMENTS("amazon_payments"), - - PAY_TO("pay_to"), - - FASTER_PAYMENTS("faster_payments"), - - SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), - - KLARNA_PAY_NOW("klarna_pay_now"), - - ONLINE_BANKING_POLAND("online_banking_poland"), - - PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), - - ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), - - KBC_PAYMENT_BUTTON("kbc_payment_button"), - - PAY_BY_BANK("pay_by_bank"), - - TRUSTLY("trustly"), - - STABLECOIN("stablecoin"), - - /** - * An enum member indicating that PaymentMethodType was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - PaymentMethodType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethodType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethodType enumValue : PaymentMethodType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class InvoiceAllocationsParams { - - private final String invoiceId; - - private final Long allocationAmount; - - private InvoiceAllocationsParams(InvoiceAllocationsBuilder builder) { - - this.invoiceId = builder.invoiceId; - - this.allocationAmount = builder.allocationAmount; - } - - public String getInvoiceId() { - return invoiceId; - } - - public Long getAllocationAmount() { - return allocationAmount; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.invoiceId != null) { - - formData.put("invoice_id", this.invoiceId); - } - - if (this.allocationAmount != null) { - - formData.put("allocation_amount", this.allocationAmount); - } - - return formData; - } - - /** Create a new builder for InvoiceAllocationsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static InvoiceAllocationsBuilder builder() { - return new InvoiceAllocationsBuilder(); - } - - public static final class InvoiceAllocationsBuilder { - - private String invoiceId; - - private Long allocationAmount; - - private InvoiceAllocationsBuilder() {} - - public InvoiceAllocationsBuilder invoiceId(String value) { - this.invoiceId = value; - return this; - } - - public InvoiceAllocationsBuilder allocationAmount(Long value) { - this.allocationAmount = value; - return this; - } - - public InvoiceAllocationsParams build() { - return new InvoiceAllocationsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerAddContactParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerAddContactParams.java new file mode 100644 index 00000000..ea3cb495 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerAddContactParams.java @@ -0,0 +1,342 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerAddContactParams { + + private final ContactParams contact; + + private final Map consentFields; + + private CustomerAddContactParams(CustomerAddContactBuilder builder) { + + this.contact = builder.contact; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public ContactParams getContact() { + return contact; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.contact != null) { + + // Single object + Map nestedData = this.contact.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contact[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerAddContactParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerAddContactBuilder builder() { + return new CustomerAddContactBuilder(); + } + + public static final class CustomerAddContactBuilder { + + private ContactParams contact; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerAddContactBuilder() {} + + public CustomerAddContactBuilder contact(ContactParams value) { + this.contact = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerAddContactBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerAddContactBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerAddContactBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerAddContactParams build() { + return new CustomerAddContactParams(this); + } + } + + public static final class ContactParams { + + private final String id; + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String phone; + + private final String label; + + private final Boolean enabled; + + private final Boolean sendBillingEmail; + + private final Boolean sendAccountEmail; + + private ContactParams(ContactBuilder builder) { + + this.id = builder.id; + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.phone = builder.phone; + + this.label = builder.label; + + this.enabled = builder.enabled; + + this.sendBillingEmail = builder.sendBillingEmail; + + this.sendAccountEmail = builder.sendAccountEmail; + } + + public String getId() { + return id; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getPhone() { + return phone; + } + + public String getLabel() { + return label; + } + + public Boolean getEnabled() { + return enabled; + } + + public Boolean getSendBillingEmail() { + return sendBillingEmail; + } + + public Boolean getSendAccountEmail() { + return sendAccountEmail; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.label != null) { + + formData.put("label", this.label); + } + + if (this.enabled != null) { + + formData.put("enabled", this.enabled); + } + + if (this.sendBillingEmail != null) { + + formData.put("send_billing_email", this.sendBillingEmail); + } + + if (this.sendAccountEmail != null) { + + formData.put("send_account_email", this.sendAccountEmail); + } + + return formData; + } + + /** Create a new builder for ContactParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContactBuilder builder() { + return new ContactBuilder(); + } + + public static final class ContactBuilder { + + private String id; + + private String firstName; + + private String lastName; + + private String email; + + private String phone; + + private String label; + + private Boolean enabled; + + private Boolean sendBillingEmail; + + private Boolean sendAccountEmail; + + private ContactBuilder() {} + + public ContactBuilder id(String value) { + this.id = value; + return this; + } + + public ContactBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ContactBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ContactBuilder email(String value) { + this.email = value; + return this; + } + + public ContactBuilder phone(String value) { + this.phone = value; + return this; + } + + public ContactBuilder label(String value) { + this.label = value; + return this; + } + + public ContactBuilder enabled(Boolean value) { + this.enabled = value; + return this; + } + + public ContactBuilder sendBillingEmail(Boolean value) { + this.sendBillingEmail = value; + return this; + } + + public ContactBuilder sendAccountEmail(Boolean value) { + this.sendAccountEmail = value; + return this; + } + + public ContactParams build() { + return new ContactParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerAddPromotionalCreditsParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerAddPromotionalCreditsParams.java new file mode 100644 index 00000000..ad00bd35 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerAddPromotionalCreditsParams.java @@ -0,0 +1,239 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerAddPromotionalCreditsParams { + + private final Long amount; + + private final String currencyCode; + + private final String description; + + private final CreditType creditType; + + private final String reference; + + private final Map consentFields; + + private CustomerAddPromotionalCreditsParams(CustomerAddPromotionalCreditsBuilder builder) { + + this.amount = builder.amount; + + this.currencyCode = builder.currencyCode; + + this.description = builder.description; + + this.creditType = builder.creditType; + + this.reference = builder.reference; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public Long getAmount() { + return amount; + } + + public String getCurrencyCode() { + return currencyCode; + } + + public String getDescription() { + return description; + } + + public CreditType getCreditType() { + return creditType; + } + + public String getReference() { + return reference; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.currencyCode != null) { + + formData.put("currency_code", this.currencyCode); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.creditType != null) { + + formData.put("credit_type", this.creditType); + } + + if (this.reference != null) { + + formData.put("reference", this.reference); + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerAddPromotionalCreditsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerAddPromotionalCreditsBuilder builder() { + return new CustomerAddPromotionalCreditsBuilder(); + } + + public static final class CustomerAddPromotionalCreditsBuilder { + + private Long amount; + + private String currencyCode; + + private String description; + + private CreditType creditType; + + private String reference; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerAddPromotionalCreditsBuilder() {} + + public CustomerAddPromotionalCreditsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public CustomerAddPromotionalCreditsBuilder currencyCode(String value) { + this.currencyCode = value; + return this; + } + + public CustomerAddPromotionalCreditsBuilder description(String value) { + this.description = value; + return this; + } + + public CustomerAddPromotionalCreditsBuilder creditType(CreditType value) { + this.creditType = value; + return this; + } + + public CustomerAddPromotionalCreditsBuilder reference(String value) { + this.reference = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerAddPromotionalCreditsBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerAddPromotionalCreditsBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerAddPromotionalCreditsBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerAddPromotionalCreditsParams build() { + return new CustomerAddPromotionalCreditsParams(this); + } + } + + public enum CreditType { + LOYALTY_CREDITS("loyalty_credits"), + + REFERRAL_REWARDS("referral_rewards"), + + GENERAL("general"), + + /** An enum member indicating that CreditType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + CreditType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CreditType fromString(String value) { + if (value == null) return _UNKNOWN; + for (CreditType enumValue : CreditType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerAssignPaymentRoleParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerAssignPaymentRoleParams.java new file mode 100644 index 00000000..d60ad25a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerAssignPaymentRoleParams.java @@ -0,0 +1,179 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerAssignPaymentRoleParams { + + private final String paymentSourceId; + + private final Role role; + + private final Map consentFields; + + private CustomerAssignPaymentRoleParams(CustomerAssignPaymentRoleBuilder builder) { + + this.paymentSourceId = builder.paymentSourceId; + + this.role = builder.role; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public String getPaymentSourceId() { + return paymentSourceId; + } + + public Role getRole() { + return role; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.paymentSourceId != null) { + + formData.put("payment_source_id", this.paymentSourceId); + } + + if (this.role != null) { + + formData.put("role", this.role); + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerAssignPaymentRoleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerAssignPaymentRoleBuilder builder() { + return new CustomerAssignPaymentRoleBuilder(); + } + + public static final class CustomerAssignPaymentRoleBuilder { + + private String paymentSourceId; + + private Role role; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerAssignPaymentRoleBuilder() {} + + public CustomerAssignPaymentRoleBuilder paymentSourceId(String value) { + this.paymentSourceId = value; + return this; + } + + public CustomerAssignPaymentRoleBuilder role(Role value) { + this.role = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerAssignPaymentRoleBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerAssignPaymentRoleBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerAssignPaymentRoleBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerAssignPaymentRoleParams build() { + return new CustomerAssignPaymentRoleParams(this); + } + } + + public enum Role { + PRIMARY("primary"), + + BACKUP("backup"), + + NONE("none"), + + /** An enum member indicating that Role was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Role(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Role fromString(String value) { + if (value == null) return _UNKNOWN; + for (Role enumValue : Role.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerChangeBillingDateParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerChangeBillingDateParams.java new file mode 100644 index 00000000..b779903a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerChangeBillingDateParams.java @@ -0,0 +1,305 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerChangeBillingDateParams { + + private final Integer billingDate; + + private final Integer billingMonth; + + private final BillingDateMode billingDateMode; + + private final BillingDayOfWeek billingDayOfWeek; + + private final BillingDayOfWeekMode billingDayOfWeekMode; + + private final Map consentFields; + + private CustomerChangeBillingDateParams(CustomerChangeBillingDateBuilder builder) { + + this.billingDate = builder.billingDate; + + this.billingMonth = builder.billingMonth; + + this.billingDateMode = builder.billingDateMode; + + this.billingDayOfWeek = builder.billingDayOfWeek; + + this.billingDayOfWeekMode = builder.billingDayOfWeekMode; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public Integer getBillingDate() { + return billingDate; + } + + public Integer getBillingMonth() { + return billingMonth; + } + + public BillingDateMode getBillingDateMode() { + return billingDateMode; + } + + public BillingDayOfWeek getBillingDayOfWeek() { + return billingDayOfWeek; + } + + public BillingDayOfWeekMode getBillingDayOfWeekMode() { + return billingDayOfWeekMode; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.billingDate != null) { + + formData.put("billing_date", this.billingDate); + } + + if (this.billingMonth != null) { + + formData.put("billing_month", this.billingMonth); + } + + if (this.billingDateMode != null) { + + formData.put("billing_date_mode", this.billingDateMode); + } + + if (this.billingDayOfWeek != null) { + + formData.put("billing_day_of_week", this.billingDayOfWeek); + } + + if (this.billingDayOfWeekMode != null) { + + formData.put("billing_day_of_week_mode", this.billingDayOfWeekMode); + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerChangeBillingDateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerChangeBillingDateBuilder builder() { + return new CustomerChangeBillingDateBuilder(); + } + + public static final class CustomerChangeBillingDateBuilder { + + private Integer billingDate; + + private Integer billingMonth; + + private BillingDateMode billingDateMode; + + private BillingDayOfWeek billingDayOfWeek; + + private BillingDayOfWeekMode billingDayOfWeekMode; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerChangeBillingDateBuilder() {} + + public CustomerChangeBillingDateBuilder billingDate(Integer value) { + this.billingDate = value; + return this; + } + + public CustomerChangeBillingDateBuilder billingMonth(Integer value) { + this.billingMonth = value; + return this; + } + + public CustomerChangeBillingDateBuilder billingDateMode(BillingDateMode value) { + this.billingDateMode = value; + return this; + } + + public CustomerChangeBillingDateBuilder billingDayOfWeek(BillingDayOfWeek value) { + this.billingDayOfWeek = value; + return this; + } + + public CustomerChangeBillingDateBuilder billingDayOfWeekMode(BillingDayOfWeekMode value) { + this.billingDayOfWeekMode = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerChangeBillingDateBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerChangeBillingDateBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerChangeBillingDateBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerChangeBillingDateParams build() { + return new CustomerChangeBillingDateParams(this); + } + } + + public enum BillingDateMode { + USING_DEFAULTS("using_defaults"), + + MANUALLY_SET("manually_set"), + + /** An enum member indicating that BillingDateMode was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + BillingDateMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingDateMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingDateMode enumValue : BillingDateMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum BillingDayOfWeek { + SUNDAY("sunday"), + + MONDAY("monday"), + + TUESDAY("tuesday"), + + WEDNESDAY("wednesday"), + + THURSDAY("thursday"), + + FRIDAY("friday"), + + SATURDAY("saturday"), + + /** An enum member indicating that BillingDayOfWeek was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + BillingDayOfWeek(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingDayOfWeek fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingDayOfWeek enumValue : BillingDayOfWeek.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum BillingDayOfWeekMode { + USING_DEFAULTS("using_defaults"), + + MANUALLY_SET("manually_set"), + + /** + * An enum member indicating that BillingDayOfWeekMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingDayOfWeekMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingDayOfWeekMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingDayOfWeekMode enumValue : BillingDayOfWeekMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerClearPersonalDataParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerClearPersonalDataParams.java new file mode 100644 index 00000000..6db1f848 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerClearPersonalDataParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerClearPersonalDataParams { + + private CustomerClearPersonalDataParams(CustomerClearPersonalDataBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CustomerClearPersonalDataParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerClearPersonalDataBuilder builder() { + return new CustomerClearPersonalDataBuilder(); + } + + public static final class CustomerClearPersonalDataBuilder { + + private CustomerClearPersonalDataBuilder() {} + + public CustomerClearPersonalDataParams build() { + return new CustomerClearPersonalDataParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerCollectPaymentParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerCollectPaymentParams.java new file mode 100644 index 00000000..5f83ccbe --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerCollectPaymentParams.java @@ -0,0 +1,1269 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class CustomerCollectPaymentParams { + + private final Long amount; + + private final String paymentSourceId; + + private final String tokenId; + + private final Boolean replacePrimaryPaymentSource; + + private final Boolean retainPaymentSource; + + private final PaymentInitiator paymentInitiator; + + private final PaymentMethodParams paymentMethod; + + private final CardParams card; + + private final PaymentIntentParams paymentIntent; + + private final List invoiceAllocations; + + private final Map consentFields; + + private CustomerCollectPaymentParams(CustomerCollectPaymentBuilder builder) { + + this.amount = builder.amount; + + this.paymentSourceId = builder.paymentSourceId; + + this.tokenId = builder.tokenId; + + this.replacePrimaryPaymentSource = builder.replacePrimaryPaymentSource; + + this.retainPaymentSource = builder.retainPaymentSource; + + this.paymentInitiator = builder.paymentInitiator; + + this.paymentMethod = builder.paymentMethod; + + this.card = builder.card; + + this.paymentIntent = builder.paymentIntent; + + this.invoiceAllocations = builder.invoiceAllocations; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public Long getAmount() { + return amount; + } + + public String getPaymentSourceId() { + return paymentSourceId; + } + + public String getTokenId() { + return tokenId; + } + + public Boolean getReplacePrimaryPaymentSource() { + return replacePrimaryPaymentSource; + } + + public Boolean getRetainPaymentSource() { + return retainPaymentSource; + } + + public PaymentInitiator getPaymentInitiator() { + return paymentInitiator; + } + + public PaymentMethodParams getPaymentMethod() { + return paymentMethod; + } + + public CardParams getCard() { + return card; + } + + public PaymentIntentParams getPaymentIntent() { + return paymentIntent; + } + + public List getInvoiceAllocations() { + return invoiceAllocations; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.paymentSourceId != null) { + + formData.put("payment_source_id", this.paymentSourceId); + } + + if (this.tokenId != null) { + + formData.put("token_id", this.tokenId); + } + + if (this.replacePrimaryPaymentSource != null) { + + formData.put("replace_primary_payment_source", this.replacePrimaryPaymentSource); + } + + if (this.retainPaymentSource != null) { + + formData.put("retain_payment_source", this.retainPaymentSource); + } + + if (this.paymentInitiator != null) { + + formData.put("payment_initiator", this.paymentInitiator); + } + + if (this.paymentMethod != null) { + + // Single object + Map nestedData = this.paymentMethod.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "payment_method[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.card != null) { + + // Single object + Map nestedData = this.card.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "card[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.paymentIntent != null) { + + // Single object + Map nestedData = this.paymentIntent.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "payment_intent[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.invoiceAllocations != null) { + + // List of objects + for (int i = 0; i < this.invoiceAllocations.size(); i++) { + InvoiceAllocationsParams item = this.invoiceAllocations.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "invoice_allocations[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerCollectPaymentParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerCollectPaymentBuilder builder() { + return new CustomerCollectPaymentBuilder(); + } + + public static final class CustomerCollectPaymentBuilder { + + private Long amount; + + private String paymentSourceId; + + private String tokenId; + + private Boolean replacePrimaryPaymentSource; + + private Boolean retainPaymentSource; + + private PaymentInitiator paymentInitiator; + + private PaymentMethodParams paymentMethod; + + private CardParams card; + + private PaymentIntentParams paymentIntent; + + private List invoiceAllocations; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerCollectPaymentBuilder() {} + + public CustomerCollectPaymentBuilder amount(Long value) { + this.amount = value; + return this; + } + + public CustomerCollectPaymentBuilder paymentSourceId(String value) { + this.paymentSourceId = value; + return this; + } + + public CustomerCollectPaymentBuilder tokenId(String value) { + this.tokenId = value; + return this; + } + + public CustomerCollectPaymentBuilder replacePrimaryPaymentSource(Boolean value) { + this.replacePrimaryPaymentSource = value; + return this; + } + + public CustomerCollectPaymentBuilder retainPaymentSource(Boolean value) { + this.retainPaymentSource = value; + return this; + } + + public CustomerCollectPaymentBuilder paymentInitiator(PaymentInitiator value) { + this.paymentInitiator = value; + return this; + } + + public CustomerCollectPaymentBuilder paymentMethod(PaymentMethodParams value) { + this.paymentMethod = value; + return this; + } + + public CustomerCollectPaymentBuilder card(CardParams value) { + this.card = value; + return this; + } + + public CustomerCollectPaymentBuilder paymentIntent(PaymentIntentParams value) { + this.paymentIntent = value; + return this; + } + + public CustomerCollectPaymentBuilder invoiceAllocations(List value) { + this.invoiceAllocations = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerCollectPaymentBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerCollectPaymentBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerCollectPaymentBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerCollectPaymentParams build() { + return new CustomerCollectPaymentParams(this); + } + } + + public enum PaymentInitiator { + CUSTOMER("customer"), + + MERCHANT("merchant"), + + /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentInitiator(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentInitiator fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentInitiator enumValue : PaymentInitiator.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class PaymentMethodParams { + + private final Type type; + + private final String gatewayAccountId; + + private final String referenceId; + + private final String tmpToken; + + private final java.util.Map additionalInformation; + + private PaymentMethodParams(PaymentMethodBuilder builder) { + + this.type = builder.type; + + this.gatewayAccountId = builder.gatewayAccountId; + + this.referenceId = builder.referenceId; + + this.tmpToken = builder.tmpToken; + + this.additionalInformation = builder.additionalInformation; + } + + public Type getType() { + return type; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getReferenceId() { + return referenceId; + } + + public String getTmpToken() { + return tmpToken; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.type != null) { + + formData.put("type", this.type); + } + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.referenceId != null) { + + formData.put("reference_id", this.referenceId); + } + + if (this.tmpToken != null) { + + formData.put("tmp_token", this.tmpToken); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for PaymentMethodParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentMethodBuilder builder() { + return new PaymentMethodBuilder(); + } + + public static final class PaymentMethodBuilder { + + private Type type; + + private String gatewayAccountId; + + private String referenceId; + + private String tmpToken; + + private java.util.Map additionalInformation; + + private PaymentMethodBuilder() {} + + public PaymentMethodBuilder type(Type value) { + this.type = value; + return this; + } + + public PaymentMethodBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public PaymentMethodBuilder referenceId(String value) { + this.referenceId = value; + return this; + } + + public PaymentMethodBuilder tmpToken(String value) { + this.tmpToken = value; + return this; + } + + public PaymentMethodBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public PaymentMethodParams build() { + return new PaymentMethodParams(this); + } + } + + public enum Type { + CARD("card"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + AMAZON_PAYMENTS("amazon_payments"), + + DIRECT_DEBIT("direct_debit"), + + GENERIC("generic"), + + ALIPAY("alipay"), + + UNIONPAY("unionpay"), + + APPLE_PAY("apple_pay"), + + WECHAT_PAY("wechat_pay"), + + IDEAL("ideal"), + + GOOGLE_PAY("google_pay"), + + SOFORT("sofort"), + + BANCONTACT("bancontact"), + + GIROPAY("giropay"), + + DOTPAY("dotpay"), + + UPI("upi"), + + NETBANKING_EMANDATES("netbanking_emandates"), + + VENMO("venmo"), + + PAY_TO("pay_to"), + + FASTER_PAYMENTS("faster_payments"), + + SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), + + AUTOMATED_BANK_TRANSFER("automated_bank_transfer"), + + KLARNA_PAY_NOW("klarna_pay_now"), + + ONLINE_BANKING_POLAND("online_banking_poland"), + + PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), + + ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), + + KBC_PAYMENT_BUTTON("kbc_payment_button"), + + PAY_BY_BANK("pay_by_bank"), + + TRUSTLY("trustly"), + + STABLECOIN("stablecoin"), + + /** An enum member indicating that Type was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Type(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Type fromString(String value) { + if (value == null) return _UNKNOWN; + for (Type enumValue : Type.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CardParams { + + private final String gatewayAccountId; + + private final String firstName; + + private final String lastName; + + private final String number; + + private final Integer expiryMonth; + + private final Integer expiryYear; + + private final String cvv; + + private final PreferredScheme preferredScheme; + + private final String billingAddr1; + + private final String billingAddr2; + + private final String billingCity; + + private final String billingStateCode; + + private final String billingState; + + private final String billingZip; + + private final String billingCountry; + + private final java.util.Map additionalInformation; + + private CardParams(CardBuilder builder) { + + this.gatewayAccountId = builder.gatewayAccountId; + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.number = builder.number; + + this.expiryMonth = builder.expiryMonth; + + this.expiryYear = builder.expiryYear; + + this.cvv = builder.cvv; + + this.preferredScheme = builder.preferredScheme; + + this.billingAddr1 = builder.billingAddr1; + + this.billingAddr2 = builder.billingAddr2; + + this.billingCity = builder.billingCity; + + this.billingStateCode = builder.billingStateCode; + + this.billingState = builder.billingState; + + this.billingZip = builder.billingZip; + + this.billingCountry = builder.billingCountry; + + this.additionalInformation = builder.additionalInformation; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getNumber() { + return number; + } + + public Integer getExpiryMonth() { + return expiryMonth; + } + + public Integer getExpiryYear() { + return expiryYear; + } + + public String getCvv() { + return cvv; + } + + public PreferredScheme getPreferredScheme() { + return preferredScheme; + } + + public String getBillingAddr1() { + return billingAddr1; + } + + public String getBillingAddr2() { + return billingAddr2; + } + + public String getBillingCity() { + return billingCity; + } + + public String getBillingStateCode() { + return billingStateCode; + } + + public String getBillingState() { + return billingState; + } + + public String getBillingZip() { + return billingZip; + } + + public String getBillingCountry() { + return billingCountry; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.number != null) { + + formData.put("number", this.number); + } + + if (this.expiryMonth != null) { + + formData.put("expiry_month", this.expiryMonth); + } + + if (this.expiryYear != null) { + + formData.put("expiry_year", this.expiryYear); + } + + if (this.cvv != null) { + + formData.put("cvv", this.cvv); + } + + if (this.preferredScheme != null) { + + formData.put("preferred_scheme", this.preferredScheme); + } + + if (this.billingAddr1 != null) { + + formData.put("billing_addr1", this.billingAddr1); + } + + if (this.billingAddr2 != null) { + + formData.put("billing_addr2", this.billingAddr2); + } + + if (this.billingCity != null) { + + formData.put("billing_city", this.billingCity); + } + + if (this.billingStateCode != null) { + + formData.put("billing_state_code", this.billingStateCode); + } + + if (this.billingState != null) { + + formData.put("billing_state", this.billingState); + } + + if (this.billingZip != null) { + + formData.put("billing_zip", this.billingZip); + } + + if (this.billingCountry != null) { + + formData.put("billing_country", this.billingCountry); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for CardParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CardBuilder builder() { + return new CardBuilder(); + } + + public static final class CardBuilder { + + private String gatewayAccountId; + + private String firstName; + + private String lastName; + + private String number; + + private Integer expiryMonth; + + private Integer expiryYear; + + private String cvv; + + private PreferredScheme preferredScheme; + + private String billingAddr1; + + private String billingAddr2; + + private String billingCity; + + private String billingStateCode; + + private String billingState; + + private String billingZip; + + private String billingCountry; + + private java.util.Map additionalInformation; + + private CardBuilder() {} + + public CardBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public CardBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public CardBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public CardBuilder number(String value) { + this.number = value; + return this; + } + + public CardBuilder expiryMonth(Integer value) { + this.expiryMonth = value; + return this; + } + + public CardBuilder expiryYear(Integer value) { + this.expiryYear = value; + return this; + } + + public CardBuilder cvv(String value) { + this.cvv = value; + return this; + } + + public CardBuilder preferredScheme(PreferredScheme value) { + this.preferredScheme = value; + return this; + } + + public CardBuilder billingAddr1(String value) { + this.billingAddr1 = value; + return this; + } + + public CardBuilder billingAddr2(String value) { + this.billingAddr2 = value; + return this; + } + + public CardBuilder billingCity(String value) { + this.billingCity = value; + return this; + } + + public CardBuilder billingStateCode(String value) { + this.billingStateCode = value; + return this; + } + + public CardBuilder billingState(String value) { + this.billingState = value; + return this; + } + + public CardBuilder billingZip(String value) { + this.billingZip = value; + return this; + } + + public CardBuilder billingCountry(String value) { + this.billingCountry = value; + return this; + } + + public CardBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public CardParams build() { + return new CardParams(this); + } + } + + public enum PreferredScheme { + CARTES_BANCAIRES("cartes_bancaires"), + + MASTERCARD("mastercard"), + + VISA("visa"), + + /** An enum member indicating that PreferredScheme was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PreferredScheme(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PreferredScheme fromString(String value) { + if (value == null) return _UNKNOWN; + for (PreferredScheme enumValue : PreferredScheme.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class PaymentIntentParams { + + private final String id; + + private final String gatewayAccountId; + + private final String gwToken; + + private final PaymentMethodType paymentMethodType; + + private final String gwPaymentMethodId; + + private final String referenceId; + + private final java.util.Map additionalInformation; + + private PaymentIntentParams(PaymentIntentBuilder builder) { + + this.id = builder.id; + + this.gatewayAccountId = builder.gatewayAccountId; + + this.gwToken = builder.gwToken; + + this.paymentMethodType = builder.paymentMethodType; + + this.gwPaymentMethodId = builder.gwPaymentMethodId; + + this.referenceId = builder.referenceId; + + this.additionalInformation = builder.additionalInformation; + } + + public String getId() { + return id; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getGwToken() { + return gwToken; + } + + public PaymentMethodType getPaymentMethodType() { + return paymentMethodType; + } + + public String getGwPaymentMethodId() { + return gwPaymentMethodId; + } + + public String getReferenceId() { + return referenceId; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.gwToken != null) { + + formData.put("gw_token", this.gwToken); + } + + if (this.paymentMethodType != null) { + + formData.put("payment_method_type", this.paymentMethodType); + } + + if (this.gwPaymentMethodId != null) { + + formData.put("gw_payment_method_id", this.gwPaymentMethodId); + } + + if (this.referenceId != null) { + + formData.put("reference_id", this.referenceId); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for PaymentIntentParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentIntentBuilder builder() { + return new PaymentIntentBuilder(); + } + + public static final class PaymentIntentBuilder { + + private String id; + + private String gatewayAccountId; + + private String gwToken; + + private PaymentMethodType paymentMethodType; + + private String gwPaymentMethodId; + + private String referenceId; + + private java.util.Map additionalInformation; + + private PaymentIntentBuilder() {} + + public PaymentIntentBuilder id(String value) { + this.id = value; + return this; + } + + public PaymentIntentBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public PaymentIntentBuilder gwToken(String value) { + this.gwToken = value; + return this; + } + + public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { + this.paymentMethodType = value; + return this; + } + + @Deprecated + public PaymentIntentBuilder gwPaymentMethodId(String value) { + this.gwPaymentMethodId = value; + return this; + } + + public PaymentIntentBuilder referenceId(String value) { + this.referenceId = value; + return this; + } + + public PaymentIntentBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public PaymentIntentParams build() { + return new PaymentIntentParams(this); + } + } + + public enum PaymentMethodType { + CARD("card"), + + IDEAL("ideal"), + + SOFORT("sofort"), + + BANCONTACT("bancontact"), + + GOOGLE_PAY("google_pay"), + + DOTPAY("dotpay"), + + GIROPAY("giropay"), + + APPLE_PAY("apple_pay"), + + UPI("upi"), + + NETBANKING_EMANDATES("netbanking_emandates"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + DIRECT_DEBIT("direct_debit"), + + BOLETO("boleto"), + + VENMO("venmo"), + + AMAZON_PAYMENTS("amazon_payments"), + + PAY_TO("pay_to"), + + FASTER_PAYMENTS("faster_payments"), + + SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), + + KLARNA_PAY_NOW("klarna_pay_now"), + + ONLINE_BANKING_POLAND("online_banking_poland"), + + PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), + + ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), + + KBC_PAYMENT_BUTTON("kbc_payment_button"), + + PAY_BY_BANK("pay_by_bank"), + + TRUSTLY("trustly"), + + STABLECOIN("stablecoin"), + + /** + * An enum member indicating that PaymentMethodType was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + PaymentMethodType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethodType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethodType enumValue : PaymentMethodType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class InvoiceAllocationsParams { + + private final String invoiceId; + + private final Long allocationAmount; + + private InvoiceAllocationsParams(InvoiceAllocationsBuilder builder) { + + this.invoiceId = builder.invoiceId; + + this.allocationAmount = builder.allocationAmount; + } + + public String getInvoiceId() { + return invoiceId; + } + + public Long getAllocationAmount() { + return allocationAmount; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.invoiceId != null) { + + formData.put("invoice_id", this.invoiceId); + } + + if (this.allocationAmount != null) { + + formData.put("allocation_amount", this.allocationAmount); + } + + return formData; + } + + /** Create a new builder for InvoiceAllocationsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceAllocationsBuilder builder() { + return new InvoiceAllocationsBuilder(); + } + + public static final class InvoiceAllocationsBuilder { + + private String invoiceId; + + private Long allocationAmount; + + private InvoiceAllocationsBuilder() {} + + public InvoiceAllocationsBuilder invoiceId(String value) { + this.invoiceId = value; + return this; + } + + public InvoiceAllocationsBuilder allocationAmount(Long value) { + this.allocationAmount = value; + return this; + } + + public InvoiceAllocationsParams build() { + return new InvoiceAllocationsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeductPromotionalCreditsParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeductPromotionalCreditsParams.java new file mode 100644 index 00000000..a63a1d67 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeductPromotionalCreditsParams.java @@ -0,0 +1,240 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerDeductPromotionalCreditsParams { + + private final Long amount; + + private final String currencyCode; + + private final String description; + + private final CreditType creditType; + + private final String reference; + + private final Map consentFields; + + private CustomerDeductPromotionalCreditsParams(CustomerDeductPromotionalCreditsBuilder builder) { + + this.amount = builder.amount; + + this.currencyCode = builder.currencyCode; + + this.description = builder.description; + + this.creditType = builder.creditType; + + this.reference = builder.reference; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public Long getAmount() { + return amount; + } + + public String getCurrencyCode() { + return currencyCode; + } + + public String getDescription() { + return description; + } + + public CreditType getCreditType() { + return creditType; + } + + public String getReference() { + return reference; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.currencyCode != null) { + + formData.put("currency_code", this.currencyCode); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.creditType != null) { + + formData.put("credit_type", this.creditType); + } + + if (this.reference != null) { + + formData.put("reference", this.reference); + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerDeductPromotionalCreditsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerDeductPromotionalCreditsBuilder builder() { + return new CustomerDeductPromotionalCreditsBuilder(); + } + + public static final class CustomerDeductPromotionalCreditsBuilder { + + private Long amount; + + private String currencyCode; + + private String description; + + private CreditType creditType; + + private String reference; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerDeductPromotionalCreditsBuilder() {} + + public CustomerDeductPromotionalCreditsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public CustomerDeductPromotionalCreditsBuilder currencyCode(String value) { + this.currencyCode = value; + return this; + } + + public CustomerDeductPromotionalCreditsBuilder description(String value) { + this.description = value; + return this; + } + + public CustomerDeductPromotionalCreditsBuilder creditType(CreditType value) { + this.creditType = value; + return this; + } + + public CustomerDeductPromotionalCreditsBuilder reference(String value) { + this.reference = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerDeductPromotionalCreditsBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerDeductPromotionalCreditsBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerDeductPromotionalCreditsBuilder consentFields( + Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerDeductPromotionalCreditsParams build() { + return new CustomerDeductPromotionalCreditsParams(this); + } + } + + public enum CreditType { + LOYALTY_CREDITS("loyalty_credits"), + + REFERRAL_REWARDS("referral_rewards"), + + GENERAL("general"), + + /** An enum member indicating that CreditType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + CreditType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CreditType fromString(String value) { + if (value == null) return _UNKNOWN; + for (CreditType enumValue : CreditType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeleteContactParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeleteContactParams.java new file mode 100644 index 00000000..e4538054 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeleteContactParams.java @@ -0,0 +1,182 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerDeleteContactParams { + + private final ContactParams contact; + + private final Map consentFields; + + private CustomerDeleteContactParams(CustomerDeleteContactBuilder builder) { + + this.contact = builder.contact; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public ContactParams getContact() { + return contact; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.contact != null) { + + // Single object + Map nestedData = this.contact.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contact[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerDeleteContactParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerDeleteContactBuilder builder() { + return new CustomerDeleteContactBuilder(); + } + + public static final class CustomerDeleteContactBuilder { + + private ContactParams contact; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerDeleteContactBuilder() {} + + public CustomerDeleteContactBuilder contact(ContactParams value) { + this.contact = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerDeleteContactBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerDeleteContactBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerDeleteContactBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerDeleteContactParams build() { + return new CustomerDeleteContactParams(this); + } + } + + public static final class ContactParams { + + private final String id; + + private ContactParams(ContactBuilder builder) { + + this.id = builder.id; + } + + public String getId() { + return id; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + return formData; + } + + /** Create a new builder for ContactParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContactBuilder builder() { + return new ContactBuilder(); + } + + public static final class ContactBuilder { + + private String id; + + private ContactBuilder() {} + + public ContactBuilder id(String value) { + this.id = value; + return this; + } + + public ContactParams build() { + return new ContactParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeleteParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeleteParams.java new file mode 100644 index 00000000..b2e587d0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeleteParams.java @@ -0,0 +1,129 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerDeleteParams { + + private final Boolean deletePaymentMethod; + + private final Map consentFields; + + private CustomerDeleteParams(CustomerDeleteBuilder builder) { + + this.deletePaymentMethod = builder.deletePaymentMethod; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public Boolean getDeletePaymentMethod() { + return deletePaymentMethod; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.deletePaymentMethod != null) { + + formData.put("delete_payment_method", this.deletePaymentMethod); + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerDeleteBuilder builder() { + return new CustomerDeleteBuilder(); + } + + public static final class CustomerDeleteBuilder { + + private Boolean deletePaymentMethod; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerDeleteBuilder() {} + + public CustomerDeleteBuilder deletePaymentMethod(Boolean value) { + this.deletePaymentMethod = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerDeleteBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerDeleteBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerDeleteBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerDeleteParams build() { + return new CustomerDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeleteRelationshipParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeleteRelationshipParams.java new file mode 100644 index 00000000..dd91fbd9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerDeleteRelationshipParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerDeleteRelationshipParams { + + private CustomerDeleteRelationshipParams(CustomerDeleteRelationshipBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CustomerDeleteRelationshipParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerDeleteRelationshipBuilder builder() { + return new CustomerDeleteRelationshipBuilder(); + } + + public static final class CustomerDeleteRelationshipBuilder { + + private CustomerDeleteRelationshipBuilder() {} + + public CustomerDeleteRelationshipParams build() { + return new CustomerDeleteRelationshipParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerHierarchyParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerHierarchyParams.java new file mode 100644 index 00000000..dec61533 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerHierarchyParams.java @@ -0,0 +1,92 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerHierarchyParams { + + private final Map queryParams; + + private CustomerHierarchyParams(CustomerHierarchyBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public CustomerHierarchyBuilder toBuilder() { + CustomerHierarchyBuilder builder = new CustomerHierarchyBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for CustomerHierarchyParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerHierarchyBuilder builder() { + return new CustomerHierarchyBuilder(); + } + + public static final class CustomerHierarchyBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private CustomerHierarchyBuilder() {} + + public CustomerHierarchyBuilder hierarchyOperationType(HierarchyOperationType value) { + queryParams.put("hierarchy_operation_type", value); + return this; + } + + public CustomerHierarchyParams build() { + return new CustomerHierarchyParams(this); + } + } + + public enum HierarchyOperationType { + COMPLETE_HIERARCHY("complete_hierarchy"), + + SUBORDINATES("subordinates"), + + PATH_TO_ROOT("path_to_root"), + + SUBORDINATES_WITH_UNBILLED_CHARGES_PAYABLE_BY_PARENT( + "subordinates_with_unbilled_charges_payable_by_parent"), + + IMMEDIATE_CHILDREN("immediate_children"), + + /** + * An enum member indicating that HierarchyOperationType was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + HierarchyOperationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static HierarchyOperationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (HierarchyOperationType enumValue : HierarchyOperationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerListHierarchyDetailParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerListHierarchyDetailParams.java new file mode 100644 index 00000000..b1e75d38 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerListHierarchyDetailParams.java @@ -0,0 +1,102 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerListHierarchyDetailParams { + + private final Map queryParams; + + private CustomerListHierarchyDetailParams(CustomerListHierarchyDetailBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public CustomerListHierarchyDetailBuilder toBuilder() { + CustomerListHierarchyDetailBuilder builder = new CustomerListHierarchyDetailBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for CustomerListHierarchyDetailParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerListHierarchyDetailBuilder builder() { + return new CustomerListHierarchyDetailBuilder(); + } + + public static final class CustomerListHierarchyDetailBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private CustomerListHierarchyDetailBuilder() {} + + public CustomerListHierarchyDetailBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public CustomerListHierarchyDetailBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + public CustomerListHierarchyDetailBuilder hierarchyOperationType(HierarchyOperationType value) { + queryParams.put("hierarchy_operation_type", value); + return this; + } + + public CustomerListHierarchyDetailParams build() { + return new CustomerListHierarchyDetailParams(this); + } + } + + public enum HierarchyOperationType { + COMPLETE_HIERARCHY("complete_hierarchy"), + + SUBORDINATES("subordinates"), + + PATH_TO_ROOT("path_to_root"), + + SUBORDINATES_WITH_UNBILLED_CHARGES_PAYABLE_BY_PARENT( + "subordinates_with_unbilled_charges_payable_by_parent"), + + IMMEDIATE_CHILDREN("immediate_children"), + + /** + * An enum member indicating that HierarchyOperationType was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + HierarchyOperationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static HierarchyOperationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (HierarchyOperationType enumValue : HierarchyOperationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerRecordExcessPaymentParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerRecordExcessPaymentParams.java new file mode 100644 index 00000000..7598b007 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerRecordExcessPaymentParams.java @@ -0,0 +1,361 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class CustomerRecordExcessPaymentParams { + + private final String comment; + + private final TransactionParams transaction; + + private final Map consentFields; + + private CustomerRecordExcessPaymentParams(CustomerRecordExcessPaymentBuilder builder) { + + this.comment = builder.comment; + + this.transaction = builder.transaction; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public String getComment() { + return comment; + } + + public TransactionParams getTransaction() { + return transaction; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.transaction != null) { + + // Single object + Map nestedData = this.transaction.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "transaction[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerRecordExcessPaymentParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerRecordExcessPaymentBuilder builder() { + return new CustomerRecordExcessPaymentBuilder(); + } + + public static final class CustomerRecordExcessPaymentBuilder { + + private String comment; + + private TransactionParams transaction; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerRecordExcessPaymentBuilder() {} + + public CustomerRecordExcessPaymentBuilder comment(String value) { + this.comment = value; + return this; + } + + public CustomerRecordExcessPaymentBuilder transaction(TransactionParams value) { + this.transaction = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerRecordExcessPaymentBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerRecordExcessPaymentBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerRecordExcessPaymentBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerRecordExcessPaymentParams build() { + return new CustomerRecordExcessPaymentParams(this); + } + } + + public static final class TransactionParams { + + private final String id; + + private final Long amount; + + private final String currencyCode; + + private final Timestamp date; + + private final PaymentMethod paymentMethod; + + private final String referenceNumber; + + private final String customPaymentMethodId; + + private TransactionParams(TransactionBuilder builder) { + + this.id = builder.id; + + this.amount = builder.amount; + + this.currencyCode = builder.currencyCode; + + this.date = builder.date; + + this.paymentMethod = builder.paymentMethod; + + this.referenceNumber = builder.referenceNumber; + + this.customPaymentMethodId = builder.customPaymentMethodId; + } + + public String getId() { + return id; + } + + public Long getAmount() { + return amount; + } + + public String getCurrencyCode() { + return currencyCode; + } + + public Timestamp getDate() { + return date; + } + + public PaymentMethod getPaymentMethod() { + return paymentMethod; + } + + public String getReferenceNumber() { + return referenceNumber; + } + + public String getCustomPaymentMethodId() { + return customPaymentMethodId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.currencyCode != null) { + + formData.put("currency_code", this.currencyCode); + } + + if (this.date != null) { + + formData.put("date", this.date); + } + + if (this.paymentMethod != null) { + + formData.put("payment_method", this.paymentMethod); + } + + if (this.referenceNumber != null) { + + formData.put("reference_number", this.referenceNumber); + } + + if (this.customPaymentMethodId != null) { + + formData.put("custom_payment_method_id", this.customPaymentMethodId); + } + + return formData; + } + + /** Create a new builder for TransactionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TransactionBuilder builder() { + return new TransactionBuilder(); + } + + public static final class TransactionBuilder { + + private String id; + + private Long amount; + + private String currencyCode; + + private Timestamp date; + + private PaymentMethod paymentMethod; + + private String referenceNumber; + + private String customPaymentMethodId; + + private TransactionBuilder() {} + + public TransactionBuilder id(String value) { + this.id = value; + return this; + } + + public TransactionBuilder amount(Long value) { + this.amount = value; + return this; + } + + public TransactionBuilder currencyCode(String value) { + this.currencyCode = value; + return this; + } + + public TransactionBuilder date(Timestamp value) { + this.date = value; + return this; + } + + public TransactionBuilder paymentMethod(PaymentMethod value) { + this.paymentMethod = value; + return this; + } + + public TransactionBuilder referenceNumber(String value) { + this.referenceNumber = value; + return this; + } + + public TransactionBuilder customPaymentMethodId(String value) { + this.customPaymentMethodId = value; + return this; + } + + public TransactionParams build() { + return new TransactionParams(this); + } + } + + public enum PaymentMethod { + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + OTHER("other"), + + APP_STORE("app_store"), + + PLAY_STORE("play_store"), + + CUSTOM("custom"), + + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethod enumValue : PaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerRelationshipsParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerRelationshipsParams.java new file mode 100644 index 00000000..154a893f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerRelationshipsParams.java @@ -0,0 +1,627 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerRelationshipsParams { + + private final String parentId; + + private final String paymentOwnerId; + + private final String invoiceOwnerId; + + private final Boolean useDefaultHierarchySettings; + + private final ParentAccountAccessParams parentAccountAccess; + + private final ChildAccountAccessParams childAccountAccess; + + private final Map consentFields; + + private CustomerRelationshipsParams(CustomerRelationshipsBuilder builder) { + + this.parentId = builder.parentId; + + this.paymentOwnerId = builder.paymentOwnerId; + + this.invoiceOwnerId = builder.invoiceOwnerId; + + this.useDefaultHierarchySettings = builder.useDefaultHierarchySettings; + + this.parentAccountAccess = builder.parentAccountAccess; + + this.childAccountAccess = builder.childAccountAccess; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public String getParentId() { + return parentId; + } + + public String getPaymentOwnerId() { + return paymentOwnerId; + } + + public String getInvoiceOwnerId() { + return invoiceOwnerId; + } + + public Boolean getUseDefaultHierarchySettings() { + return useDefaultHierarchySettings; + } + + public ParentAccountAccessParams getParentAccountAccess() { + return parentAccountAccess; + } + + public ChildAccountAccessParams getChildAccountAccess() { + return childAccountAccess; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.parentId != null) { + + formData.put("parent_id", this.parentId); + } + + if (this.paymentOwnerId != null) { + + formData.put("payment_owner_id", this.paymentOwnerId); + } + + if (this.invoiceOwnerId != null) { + + formData.put("invoice_owner_id", this.invoiceOwnerId); + } + + if (this.useDefaultHierarchySettings != null) { + + formData.put("use_default_hierarchy_settings", this.useDefaultHierarchySettings); + } + + if (this.parentAccountAccess != null) { + + // Single object + Map nestedData = this.parentAccountAccess.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "parent_account_access[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.childAccountAccess != null) { + + // Single object + Map nestedData = this.childAccountAccess.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "child_account_access[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerRelationshipsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerRelationshipsBuilder builder() { + return new CustomerRelationshipsBuilder(); + } + + public static final class CustomerRelationshipsBuilder { + + private String parentId; + + private String paymentOwnerId; + + private String invoiceOwnerId; + + private Boolean useDefaultHierarchySettings; + + private ParentAccountAccessParams parentAccountAccess; + + private ChildAccountAccessParams childAccountAccess; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerRelationshipsBuilder() {} + + public CustomerRelationshipsBuilder parentId(String value) { + this.parentId = value; + return this; + } + + public CustomerRelationshipsBuilder paymentOwnerId(String value) { + this.paymentOwnerId = value; + return this; + } + + public CustomerRelationshipsBuilder invoiceOwnerId(String value) { + this.invoiceOwnerId = value; + return this; + } + + public CustomerRelationshipsBuilder useDefaultHierarchySettings(Boolean value) { + this.useDefaultHierarchySettings = value; + return this; + } + + public CustomerRelationshipsBuilder parentAccountAccess(ParentAccountAccessParams value) { + this.parentAccountAccess = value; + return this; + } + + public CustomerRelationshipsBuilder childAccountAccess(ChildAccountAccessParams value) { + this.childAccountAccess = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerRelationshipsBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerRelationshipsBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerRelationshipsBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerRelationshipsParams build() { + return new CustomerRelationshipsParams(this); + } + } + + public static final class ParentAccountAccessParams { + + private final PortalEditChildSubscriptions portalEditChildSubscriptions; + + private final PortalDownloadChildInvoices portalDownloadChildInvoices; + + private final Boolean sendSubscriptionEmails; + + private final Boolean sendPaymentEmails; + + private final Boolean sendInvoiceEmails; + + private ParentAccountAccessParams(ParentAccountAccessBuilder builder) { + + this.portalEditChildSubscriptions = builder.portalEditChildSubscriptions; + + this.portalDownloadChildInvoices = builder.portalDownloadChildInvoices; + + this.sendSubscriptionEmails = builder.sendSubscriptionEmails; + + this.sendPaymentEmails = builder.sendPaymentEmails; + + this.sendInvoiceEmails = builder.sendInvoiceEmails; + } + + public PortalEditChildSubscriptions getPortalEditChildSubscriptions() { + return portalEditChildSubscriptions; + } + + public PortalDownloadChildInvoices getPortalDownloadChildInvoices() { + return portalDownloadChildInvoices; + } + + public Boolean getSendSubscriptionEmails() { + return sendSubscriptionEmails; + } + + public Boolean getSendPaymentEmails() { + return sendPaymentEmails; + } + + public Boolean getSendInvoiceEmails() { + return sendInvoiceEmails; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.portalEditChildSubscriptions != null) { + + formData.put("portal_edit_child_subscriptions", this.portalEditChildSubscriptions); + } + + if (this.portalDownloadChildInvoices != null) { + + formData.put("portal_download_child_invoices", this.portalDownloadChildInvoices); + } + + if (this.sendSubscriptionEmails != null) { + + formData.put("send_subscription_emails", this.sendSubscriptionEmails); + } + + if (this.sendPaymentEmails != null) { + + formData.put("send_payment_emails", this.sendPaymentEmails); + } + + if (this.sendInvoiceEmails != null) { + + formData.put("send_invoice_emails", this.sendInvoiceEmails); + } + + return formData; + } + + /** Create a new builder for ParentAccountAccessParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ParentAccountAccessBuilder builder() { + return new ParentAccountAccessBuilder(); + } + + public static final class ParentAccountAccessBuilder { + + private PortalEditChildSubscriptions portalEditChildSubscriptions; + + private PortalDownloadChildInvoices portalDownloadChildInvoices; + + private Boolean sendSubscriptionEmails; + + private Boolean sendPaymentEmails; + + private Boolean sendInvoiceEmails; + + private ParentAccountAccessBuilder() {} + + public ParentAccountAccessBuilder portalEditChildSubscriptions( + PortalEditChildSubscriptions value) { + this.portalEditChildSubscriptions = value; + return this; + } + + public ParentAccountAccessBuilder portalDownloadChildInvoices( + PortalDownloadChildInvoices value) { + this.portalDownloadChildInvoices = value; + return this; + } + + public ParentAccountAccessBuilder sendSubscriptionEmails(Boolean value) { + this.sendSubscriptionEmails = value; + return this; + } + + public ParentAccountAccessBuilder sendPaymentEmails(Boolean value) { + this.sendPaymentEmails = value; + return this; + } + + public ParentAccountAccessBuilder sendInvoiceEmails(Boolean value) { + this.sendInvoiceEmails = value; + return this; + } + + public ParentAccountAccessParams build() { + return new ParentAccountAccessParams(this); + } + } + + public enum PortalEditChildSubscriptions { + YES("yes"), + + VIEW_ONLY("view_only"), + + NO("no"), + + /** + * An enum member indicating that PortalEditChildSubscriptions was instantiated with an + * unknown value. + */ + _UNKNOWN(null); + private final String value; + + PortalEditChildSubscriptions(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PortalEditChildSubscriptions fromString(String value) { + if (value == null) return _UNKNOWN; + for (PortalEditChildSubscriptions enumValue : PortalEditChildSubscriptions.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PortalDownloadChildInvoices { + YES("yes"), + + VIEW_ONLY("view_only"), + + NO("no"), + + /** + * An enum member indicating that PortalDownloadChildInvoices was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + PortalDownloadChildInvoices(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PortalDownloadChildInvoices fromString(String value) { + if (value == null) return _UNKNOWN; + for (PortalDownloadChildInvoices enumValue : PortalDownloadChildInvoices.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ChildAccountAccessParams { + + private final PortalEditSubscriptions portalEditSubscriptions; + + private final PortalDownloadInvoices portalDownloadInvoices; + + private final Boolean sendSubscriptionEmails; + + private final Boolean sendPaymentEmails; + + private final Boolean sendInvoiceEmails; + + private ChildAccountAccessParams(ChildAccountAccessBuilder builder) { + + this.portalEditSubscriptions = builder.portalEditSubscriptions; + + this.portalDownloadInvoices = builder.portalDownloadInvoices; + + this.sendSubscriptionEmails = builder.sendSubscriptionEmails; + + this.sendPaymentEmails = builder.sendPaymentEmails; + + this.sendInvoiceEmails = builder.sendInvoiceEmails; + } + + public PortalEditSubscriptions getPortalEditSubscriptions() { + return portalEditSubscriptions; + } + + public PortalDownloadInvoices getPortalDownloadInvoices() { + return portalDownloadInvoices; + } + + public Boolean getSendSubscriptionEmails() { + return sendSubscriptionEmails; + } + + public Boolean getSendPaymentEmails() { + return sendPaymentEmails; + } + + public Boolean getSendInvoiceEmails() { + return sendInvoiceEmails; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.portalEditSubscriptions != null) { + + formData.put("portal_edit_subscriptions", this.portalEditSubscriptions); + } + + if (this.portalDownloadInvoices != null) { + + formData.put("portal_download_invoices", this.portalDownloadInvoices); + } + + if (this.sendSubscriptionEmails != null) { + + formData.put("send_subscription_emails", this.sendSubscriptionEmails); + } + + if (this.sendPaymentEmails != null) { + + formData.put("send_payment_emails", this.sendPaymentEmails); + } + + if (this.sendInvoiceEmails != null) { + + formData.put("send_invoice_emails", this.sendInvoiceEmails); + } + + return formData; + } + + /** Create a new builder for ChildAccountAccessParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ChildAccountAccessBuilder builder() { + return new ChildAccountAccessBuilder(); + } + + public static final class ChildAccountAccessBuilder { + + private PortalEditSubscriptions portalEditSubscriptions; + + private PortalDownloadInvoices portalDownloadInvoices; + + private Boolean sendSubscriptionEmails; + + private Boolean sendPaymentEmails; + + private Boolean sendInvoiceEmails; + + private ChildAccountAccessBuilder() {} + + public ChildAccountAccessBuilder portalEditSubscriptions(PortalEditSubscriptions value) { + this.portalEditSubscriptions = value; + return this; + } + + public ChildAccountAccessBuilder portalDownloadInvoices(PortalDownloadInvoices value) { + this.portalDownloadInvoices = value; + return this; + } + + public ChildAccountAccessBuilder sendSubscriptionEmails(Boolean value) { + this.sendSubscriptionEmails = value; + return this; + } + + public ChildAccountAccessBuilder sendPaymentEmails(Boolean value) { + this.sendPaymentEmails = value; + return this; + } + + public ChildAccountAccessBuilder sendInvoiceEmails(Boolean value) { + this.sendInvoiceEmails = value; + return this; + } + + public ChildAccountAccessParams build() { + return new ChildAccountAccessParams(this); + } + } + + public enum PortalEditSubscriptions { + YES("yes"), + + VIEW_ONLY("view_only"), + + /** + * An enum member indicating that PortalEditSubscriptions was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + PortalEditSubscriptions(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PortalEditSubscriptions fromString(String value) { + if (value == null) return _UNKNOWN; + for (PortalEditSubscriptions enumValue : PortalEditSubscriptions.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PortalDownloadInvoices { + YES("yes"), + + VIEW_ONLY("view_only"), + + NO("no"), + + /** + * An enum member indicating that PortalDownloadInvoices was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + PortalDownloadInvoices(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PortalDownloadInvoices fromString(String value) { + if (value == null) return _UNKNOWN; + for (PortalDownloadInvoices enumValue : PortalDownloadInvoices.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerSetPromotionalCreditsParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerSetPromotionalCreditsParams.java new file mode 100644 index 00000000..34cbcef0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerSetPromotionalCreditsParams.java @@ -0,0 +1,239 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerSetPromotionalCreditsParams { + + private final Long amount; + + private final String currencyCode; + + private final String description; + + private final CreditType creditType; + + private final String reference; + + private final Map consentFields; + + private CustomerSetPromotionalCreditsParams(CustomerSetPromotionalCreditsBuilder builder) { + + this.amount = builder.amount; + + this.currencyCode = builder.currencyCode; + + this.description = builder.description; + + this.creditType = builder.creditType; + + this.reference = builder.reference; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public Long getAmount() { + return amount; + } + + public String getCurrencyCode() { + return currencyCode; + } + + public String getDescription() { + return description; + } + + public CreditType getCreditType() { + return creditType; + } + + public String getReference() { + return reference; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.currencyCode != null) { + + formData.put("currency_code", this.currencyCode); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.creditType != null) { + + formData.put("credit_type", this.creditType); + } + + if (this.reference != null) { + + formData.put("reference", this.reference); + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerSetPromotionalCreditsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerSetPromotionalCreditsBuilder builder() { + return new CustomerSetPromotionalCreditsBuilder(); + } + + public static final class CustomerSetPromotionalCreditsBuilder { + + private Long amount; + + private String currencyCode; + + private String description; + + private CreditType creditType; + + private String reference; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerSetPromotionalCreditsBuilder() {} + + public CustomerSetPromotionalCreditsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public CustomerSetPromotionalCreditsBuilder currencyCode(String value) { + this.currencyCode = value; + return this; + } + + public CustomerSetPromotionalCreditsBuilder description(String value) { + this.description = value; + return this; + } + + public CustomerSetPromotionalCreditsBuilder creditType(CreditType value) { + this.creditType = value; + return this; + } + + public CustomerSetPromotionalCreditsBuilder reference(String value) { + this.reference = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerSetPromotionalCreditsBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerSetPromotionalCreditsBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerSetPromotionalCreditsBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerSetPromotionalCreditsParams build() { + return new CustomerSetPromotionalCreditsParams(this); + } + } + + public enum CreditType { + LOYALTY_CREDITS("loyalty_credits"), + + REFERRAL_REWARDS("referral_rewards"), + + GENERAL("general"), + + /** An enum member indicating that CreditType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + CreditType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CreditType fromString(String value) { + if (value == null) return _UNKNOWN; + for (CreditType enumValue : CreditType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdateBillingInfoParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdateBillingInfoParams.java new file mode 100644 index 00000000..398f0be3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdateBillingInfoParams.java @@ -0,0 +1,972 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class CustomerUpdateBillingInfoParams { + + private final String vatNumber; + + private final String vatNumberPrefix; + + private final String entityIdentifierScheme; + + private final String entityIdentifierStandard; + + private final Boolean registeredForGst; + + private final Boolean businessCustomerWithoutVatNumber; + + private final Boolean isEinvoiceEnabled; + + private final EinvoicingMethod einvoicingMethod; + + private final BillingAddressParams billingAddress; + + private final List entityIdentifiers; + + private final List taxProvidersFields; + + private final Map consentFields; + + private CustomerUpdateBillingInfoParams(CustomerUpdateBillingInfoBuilder builder) { + + this.vatNumber = builder.vatNumber; + + this.vatNumberPrefix = builder.vatNumberPrefix; + + this.entityIdentifierScheme = builder.entityIdentifierScheme; + + this.entityIdentifierStandard = builder.entityIdentifierStandard; + + this.registeredForGst = builder.registeredForGst; + + this.businessCustomerWithoutVatNumber = builder.businessCustomerWithoutVatNumber; + + this.isEinvoiceEnabled = builder.isEinvoiceEnabled; + + this.einvoicingMethod = builder.einvoicingMethod; + + this.billingAddress = builder.billingAddress; + + this.entityIdentifiers = builder.entityIdentifiers; + + this.taxProvidersFields = builder.taxProvidersFields; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public String getVatNumber() { + return vatNumber; + } + + public String getVatNumberPrefix() { + return vatNumberPrefix; + } + + public String getEntityIdentifierScheme() { + return entityIdentifierScheme; + } + + public String getEntityIdentifierStandard() { + return entityIdentifierStandard; + } + + public Boolean getRegisteredForGst() { + return registeredForGst; + } + + public Boolean getBusinessCustomerWithoutVatNumber() { + return businessCustomerWithoutVatNumber; + } + + public Boolean getIsEinvoiceEnabled() { + return isEinvoiceEnabled; + } + + public EinvoicingMethod getEinvoicingMethod() { + return einvoicingMethod; + } + + public BillingAddressParams getBillingAddress() { + return billingAddress; + } + + public List getEntityIdentifiers() { + return entityIdentifiers; + } + + public List getTaxProvidersFields() { + return taxProvidersFields; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.vatNumber != null) { + + formData.put("vat_number", this.vatNumber); + } + + if (this.vatNumberPrefix != null) { + + formData.put("vat_number_prefix", this.vatNumberPrefix); + } + + if (this.entityIdentifierScheme != null) { + + formData.put("entity_identifier_scheme", this.entityIdentifierScheme); + } + + if (this.entityIdentifierStandard != null) { + + formData.put("entity_identifier_standard", this.entityIdentifierStandard); + } + + if (this.registeredForGst != null) { + + formData.put("registered_for_gst", this.registeredForGst); + } + + if (this.businessCustomerWithoutVatNumber != null) { + + formData.put("business_customer_without_vat_number", this.businessCustomerWithoutVatNumber); + } + + if (this.isEinvoiceEnabled != null) { + + formData.put("is_einvoice_enabled", this.isEinvoiceEnabled); + } + + if (this.einvoicingMethod != null) { + + formData.put("einvoicing_method", this.einvoicingMethod); + } + + if (this.billingAddress != null) { + + // Single object + Map nestedData = this.billingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.entityIdentifiers != null) { + + // List of objects + for (int i = 0; i < this.entityIdentifiers.size(); i++) { + EntityIdentifiersParams item = this.entityIdentifiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "entity_identifiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.taxProvidersFields != null) { + + // List of objects + for (int i = 0; i < this.taxProvidersFields.size(); i++) { + TaxProvidersFieldsParams item = this.taxProvidersFields.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "tax_providers_fields[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerUpdateBillingInfoParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerUpdateBillingInfoBuilder builder() { + return new CustomerUpdateBillingInfoBuilder(); + } + + public static final class CustomerUpdateBillingInfoBuilder { + + private String vatNumber; + + private String vatNumberPrefix; + + private String entityIdentifierScheme; + + private String entityIdentifierStandard; + + private Boolean registeredForGst; + + private Boolean businessCustomerWithoutVatNumber; + + private Boolean isEinvoiceEnabled; + + private EinvoicingMethod einvoicingMethod; + + private BillingAddressParams billingAddress; + + private List entityIdentifiers; + + private List taxProvidersFields; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerUpdateBillingInfoBuilder() {} + + public CustomerUpdateBillingInfoBuilder vatNumber(String value) { + this.vatNumber = value; + return this; + } + + public CustomerUpdateBillingInfoBuilder vatNumberPrefix(String value) { + this.vatNumberPrefix = value; + return this; + } + + public CustomerUpdateBillingInfoBuilder entityIdentifierScheme(String value) { + this.entityIdentifierScheme = value; + return this; + } + + public CustomerUpdateBillingInfoBuilder entityIdentifierStandard(String value) { + this.entityIdentifierStandard = value; + return this; + } + + public CustomerUpdateBillingInfoBuilder registeredForGst(Boolean value) { + this.registeredForGst = value; + return this; + } + + public CustomerUpdateBillingInfoBuilder businessCustomerWithoutVatNumber(Boolean value) { + this.businessCustomerWithoutVatNumber = value; + return this; + } + + public CustomerUpdateBillingInfoBuilder isEinvoiceEnabled(Boolean value) { + this.isEinvoiceEnabled = value; + return this; + } + + public CustomerUpdateBillingInfoBuilder einvoicingMethod(EinvoicingMethod value) { + this.einvoicingMethod = value; + return this; + } + + public CustomerUpdateBillingInfoBuilder billingAddress(BillingAddressParams value) { + this.billingAddress = value; + return this; + } + + public CustomerUpdateBillingInfoBuilder entityIdentifiers(List value) { + this.entityIdentifiers = value; + return this; + } + + public CustomerUpdateBillingInfoBuilder taxProvidersFields( + List value) { + this.taxProvidersFields = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerUpdateBillingInfoBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerUpdateBillingInfoBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerUpdateBillingInfoBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerUpdateBillingInfoParams build() { + return new CustomerUpdateBillingInfoParams(this); + } + } + + public enum EinvoicingMethod { + AUTOMATIC("automatic"), + + MANUAL("manual"), + + SITE_DEFAULT("site_default"), + + /** An enum member indicating that EinvoicingMethod was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + EinvoicingMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EinvoicingMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (EinvoicingMethod enumValue : EinvoicingMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class BillingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private BillingAddressParams(BillingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for BillingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingAddressBuilder builder() { + return new BillingAddressBuilder(); + } + + public static final class BillingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private BillingAddressBuilder() {} + + public BillingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public BillingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public BillingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public BillingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public BillingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public BillingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public BillingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public BillingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public BillingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public BillingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public BillingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public BillingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public BillingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public BillingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public BillingAddressParams build() { + return new BillingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class EntityIdentifiersParams { + + private final String id; + + private final String scheme; + + private final String value; + + private final Operation operation; + + private final String standard; + + private EntityIdentifiersParams(EntityIdentifiersBuilder builder) { + + this.id = builder.id; + + this.scheme = builder.scheme; + + this.value = builder.value; + + this.operation = builder.operation; + + this.standard = builder.standard; + } + + public String getId() { + return id; + } + + public String getScheme() { + return scheme; + } + + public String getValue() { + return value; + } + + public Operation getOperation() { + return operation; + } + + public String getStandard() { + return standard; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.scheme != null) { + + formData.put("scheme", this.scheme); + } + + if (this.value != null) { + + formData.put("value", this.value); + } + + if (this.operation != null) { + + formData.put("operation", this.operation); + } + + if (this.standard != null) { + + formData.put("standard", this.standard); + } + + return formData; + } + + /** Create a new builder for EntityIdentifiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EntityIdentifiersBuilder builder() { + return new EntityIdentifiersBuilder(); + } + + public static final class EntityIdentifiersBuilder { + + private String id; + + private String scheme; + + private String value; + + private Operation operation; + + private String standard; + + private EntityIdentifiersBuilder() {} + + public EntityIdentifiersBuilder id(String value) { + this.id = value; + return this; + } + + public EntityIdentifiersBuilder scheme(String value) { + this.scheme = value; + return this; + } + + public EntityIdentifiersBuilder value(String value) { + this.value = value; + return this; + } + + public EntityIdentifiersBuilder operation(Operation value) { + this.operation = value; + return this; + } + + public EntityIdentifiersBuilder standard(String value) { + this.standard = value; + return this; + } + + public EntityIdentifiersParams build() { + return new EntityIdentifiersParams(this); + } + } + + public enum Operation { + CREATE("create"), + + UPDATE("update"), + + DELETE("delete"), + + /** An enum member indicating that Operation was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Operation(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Operation fromString(String value) { + if (value == null) return _UNKNOWN; + for (Operation enumValue : Operation.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class TaxProvidersFieldsParams { + + private final String providerName; + + private final String fieldId; + + private final String fieldValue; + + private TaxProvidersFieldsParams(TaxProvidersFieldsBuilder builder) { + + this.providerName = builder.providerName; + + this.fieldId = builder.fieldId; + + this.fieldValue = builder.fieldValue; + } + + public String getProviderName() { + return providerName; + } + + public String getFieldId() { + return fieldId; + } + + public String getFieldValue() { + return fieldValue; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.providerName != null) { + + formData.put("provider_name", this.providerName); + } + + if (this.fieldId != null) { + + formData.put("field_id", this.fieldId); + } + + if (this.fieldValue != null) { + + formData.put("field_value", this.fieldValue); + } + + return formData; + } + + /** Create a new builder for TaxProvidersFieldsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TaxProvidersFieldsBuilder builder() { + return new TaxProvidersFieldsBuilder(); + } + + public static final class TaxProvidersFieldsBuilder { + + private String providerName; + + private String fieldId; + + private String fieldValue; + + private TaxProvidersFieldsBuilder() {} + + public TaxProvidersFieldsBuilder providerName(String value) { + this.providerName = value; + return this; + } + + public TaxProvidersFieldsBuilder fieldId(String value) { + this.fieldId = value; + return this; + } + + public TaxProvidersFieldsBuilder fieldValue(String value) { + this.fieldValue = value; + return this; + } + + public TaxProvidersFieldsParams build() { + return new TaxProvidersFieldsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdateContactParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdateContactParams.java new file mode 100644 index 00000000..ae017960 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdateContactParams.java @@ -0,0 +1,342 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerUpdateContactParams { + + private final ContactParams contact; + + private final Map consentFields; + + private CustomerUpdateContactParams(CustomerUpdateContactBuilder builder) { + + this.contact = builder.contact; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public ContactParams getContact() { + return contact; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.contact != null) { + + // Single object + Map nestedData = this.contact.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contact[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerUpdateContactParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerUpdateContactBuilder builder() { + return new CustomerUpdateContactBuilder(); + } + + public static final class CustomerUpdateContactBuilder { + + private ContactParams contact; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerUpdateContactBuilder() {} + + public CustomerUpdateContactBuilder contact(ContactParams value) { + this.contact = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerUpdateContactBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerUpdateContactBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerUpdateContactBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerUpdateContactParams build() { + return new CustomerUpdateContactParams(this); + } + } + + public static final class ContactParams { + + private final String id; + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String phone; + + private final String label; + + private final Boolean enabled; + + private final Boolean sendBillingEmail; + + private final Boolean sendAccountEmail; + + private ContactParams(ContactBuilder builder) { + + this.id = builder.id; + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.phone = builder.phone; + + this.label = builder.label; + + this.enabled = builder.enabled; + + this.sendBillingEmail = builder.sendBillingEmail; + + this.sendAccountEmail = builder.sendAccountEmail; + } + + public String getId() { + return id; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getPhone() { + return phone; + } + + public String getLabel() { + return label; + } + + public Boolean getEnabled() { + return enabled; + } + + public Boolean getSendBillingEmail() { + return sendBillingEmail; + } + + public Boolean getSendAccountEmail() { + return sendAccountEmail; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.label != null) { + + formData.put("label", this.label); + } + + if (this.enabled != null) { + + formData.put("enabled", this.enabled); + } + + if (this.sendBillingEmail != null) { + + formData.put("send_billing_email", this.sendBillingEmail); + } + + if (this.sendAccountEmail != null) { + + formData.put("send_account_email", this.sendAccountEmail); + } + + return formData; + } + + /** Create a new builder for ContactParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContactBuilder builder() { + return new ContactBuilder(); + } + + public static final class ContactBuilder { + + private String id; + + private String firstName; + + private String lastName; + + private String email; + + private String phone; + + private String label; + + private Boolean enabled; + + private Boolean sendBillingEmail; + + private Boolean sendAccountEmail; + + private ContactBuilder() {} + + public ContactBuilder id(String value) { + this.id = value; + return this; + } + + public ContactBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ContactBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ContactBuilder email(String value) { + this.email = value; + return this; + } + + public ContactBuilder phone(String value) { + this.phone = value; + return this; + } + + public ContactBuilder label(String value) { + this.label = value; + return this; + } + + public ContactBuilder enabled(Boolean value) { + this.enabled = value; + return this; + } + + public ContactBuilder sendBillingEmail(Boolean value) { + this.sendBillingEmail = value; + return this; + } + + public ContactBuilder sendAccountEmail(Boolean value) { + this.sendAccountEmail = value; + return this; + } + + public ContactParams build() { + return new ContactParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdateHierarchySettingsParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdateHierarchySettingsParams.java new file mode 100644 index 00000000..44e42919 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdateHierarchySettingsParams.java @@ -0,0 +1,569 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerUpdateHierarchySettingsParams { + + private final Boolean useDefaultHierarchySettings; + + private final ParentAccountAccessParams parentAccountAccess; + + private final ChildAccountAccessParams childAccountAccess; + + private final Map consentFields; + + private CustomerUpdateHierarchySettingsParams(CustomerUpdateHierarchySettingsBuilder builder) { + + this.useDefaultHierarchySettings = builder.useDefaultHierarchySettings; + + this.parentAccountAccess = builder.parentAccountAccess; + + this.childAccountAccess = builder.childAccountAccess; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public Boolean getUseDefaultHierarchySettings() { + return useDefaultHierarchySettings; + } + + public ParentAccountAccessParams getParentAccountAccess() { + return parentAccountAccess; + } + + public ChildAccountAccessParams getChildAccountAccess() { + return childAccountAccess; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.useDefaultHierarchySettings != null) { + + formData.put("use_default_hierarchy_settings", this.useDefaultHierarchySettings); + } + + if (this.parentAccountAccess != null) { + + // Single object + Map nestedData = this.parentAccountAccess.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "parent_account_access[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.childAccountAccess != null) { + + // Single object + Map nestedData = this.childAccountAccess.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "child_account_access[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerUpdateHierarchySettingsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerUpdateHierarchySettingsBuilder builder() { + return new CustomerUpdateHierarchySettingsBuilder(); + } + + public static final class CustomerUpdateHierarchySettingsBuilder { + + private Boolean useDefaultHierarchySettings; + + private ParentAccountAccessParams parentAccountAccess; + + private ChildAccountAccessParams childAccountAccess; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerUpdateHierarchySettingsBuilder() {} + + public CustomerUpdateHierarchySettingsBuilder useDefaultHierarchySettings(Boolean value) { + this.useDefaultHierarchySettings = value; + return this; + } + + public CustomerUpdateHierarchySettingsBuilder parentAccountAccess( + ParentAccountAccessParams value) { + this.parentAccountAccess = value; + return this; + } + + public CustomerUpdateHierarchySettingsBuilder childAccountAccess( + ChildAccountAccessParams value) { + this.childAccountAccess = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerUpdateHierarchySettingsBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerUpdateHierarchySettingsBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerUpdateHierarchySettingsBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerUpdateHierarchySettingsParams build() { + return new CustomerUpdateHierarchySettingsParams(this); + } + } + + public static final class ParentAccountAccessParams { + + private final PortalEditChildSubscriptions portalEditChildSubscriptions; + + private final PortalDownloadChildInvoices portalDownloadChildInvoices; + + private final Boolean sendSubscriptionEmails; + + private final Boolean sendPaymentEmails; + + private final Boolean sendInvoiceEmails; + + private ParentAccountAccessParams(ParentAccountAccessBuilder builder) { + + this.portalEditChildSubscriptions = builder.portalEditChildSubscriptions; + + this.portalDownloadChildInvoices = builder.portalDownloadChildInvoices; + + this.sendSubscriptionEmails = builder.sendSubscriptionEmails; + + this.sendPaymentEmails = builder.sendPaymentEmails; + + this.sendInvoiceEmails = builder.sendInvoiceEmails; + } + + public PortalEditChildSubscriptions getPortalEditChildSubscriptions() { + return portalEditChildSubscriptions; + } + + public PortalDownloadChildInvoices getPortalDownloadChildInvoices() { + return portalDownloadChildInvoices; + } + + public Boolean getSendSubscriptionEmails() { + return sendSubscriptionEmails; + } + + public Boolean getSendPaymentEmails() { + return sendPaymentEmails; + } + + public Boolean getSendInvoiceEmails() { + return sendInvoiceEmails; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.portalEditChildSubscriptions != null) { + + formData.put("portal_edit_child_subscriptions", this.portalEditChildSubscriptions); + } + + if (this.portalDownloadChildInvoices != null) { + + formData.put("portal_download_child_invoices", this.portalDownloadChildInvoices); + } + + if (this.sendSubscriptionEmails != null) { + + formData.put("send_subscription_emails", this.sendSubscriptionEmails); + } + + if (this.sendPaymentEmails != null) { + + formData.put("send_payment_emails", this.sendPaymentEmails); + } + + if (this.sendInvoiceEmails != null) { + + formData.put("send_invoice_emails", this.sendInvoiceEmails); + } + + return formData; + } + + /** Create a new builder for ParentAccountAccessParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ParentAccountAccessBuilder builder() { + return new ParentAccountAccessBuilder(); + } + + public static final class ParentAccountAccessBuilder { + + private PortalEditChildSubscriptions portalEditChildSubscriptions; + + private PortalDownloadChildInvoices portalDownloadChildInvoices; + + private Boolean sendSubscriptionEmails; + + private Boolean sendPaymentEmails; + + private Boolean sendInvoiceEmails; + + private ParentAccountAccessBuilder() {} + + public ParentAccountAccessBuilder portalEditChildSubscriptions( + PortalEditChildSubscriptions value) { + this.portalEditChildSubscriptions = value; + return this; + } + + public ParentAccountAccessBuilder portalDownloadChildInvoices( + PortalDownloadChildInvoices value) { + this.portalDownloadChildInvoices = value; + return this; + } + + public ParentAccountAccessBuilder sendSubscriptionEmails(Boolean value) { + this.sendSubscriptionEmails = value; + return this; + } + + public ParentAccountAccessBuilder sendPaymentEmails(Boolean value) { + this.sendPaymentEmails = value; + return this; + } + + public ParentAccountAccessBuilder sendInvoiceEmails(Boolean value) { + this.sendInvoiceEmails = value; + return this; + } + + public ParentAccountAccessParams build() { + return new ParentAccountAccessParams(this); + } + } + + public enum PortalEditChildSubscriptions { + YES("yes"), + + VIEW_ONLY("view_only"), + + NO("no"), + + /** + * An enum member indicating that PortalEditChildSubscriptions was instantiated with an + * unknown value. + */ + _UNKNOWN(null); + private final String value; + + PortalEditChildSubscriptions(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PortalEditChildSubscriptions fromString(String value) { + if (value == null) return _UNKNOWN; + for (PortalEditChildSubscriptions enumValue : PortalEditChildSubscriptions.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PortalDownloadChildInvoices { + YES("yes"), + + VIEW_ONLY("view_only"), + + NO("no"), + + /** + * An enum member indicating that PortalDownloadChildInvoices was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + PortalDownloadChildInvoices(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PortalDownloadChildInvoices fromString(String value) { + if (value == null) return _UNKNOWN; + for (PortalDownloadChildInvoices enumValue : PortalDownloadChildInvoices.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ChildAccountAccessParams { + + private final PortalEditSubscriptions portalEditSubscriptions; + + private final PortalDownloadInvoices portalDownloadInvoices; + + private final Boolean sendSubscriptionEmails; + + private final Boolean sendPaymentEmails; + + private final Boolean sendInvoiceEmails; + + private ChildAccountAccessParams(ChildAccountAccessBuilder builder) { + + this.portalEditSubscriptions = builder.portalEditSubscriptions; + + this.portalDownloadInvoices = builder.portalDownloadInvoices; + + this.sendSubscriptionEmails = builder.sendSubscriptionEmails; + + this.sendPaymentEmails = builder.sendPaymentEmails; + + this.sendInvoiceEmails = builder.sendInvoiceEmails; + } + + public PortalEditSubscriptions getPortalEditSubscriptions() { + return portalEditSubscriptions; + } + + public PortalDownloadInvoices getPortalDownloadInvoices() { + return portalDownloadInvoices; + } + + public Boolean getSendSubscriptionEmails() { + return sendSubscriptionEmails; + } + + public Boolean getSendPaymentEmails() { + return sendPaymentEmails; + } + + public Boolean getSendInvoiceEmails() { + return sendInvoiceEmails; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.portalEditSubscriptions != null) { + + formData.put("portal_edit_subscriptions", this.portalEditSubscriptions); + } + + if (this.portalDownloadInvoices != null) { + + formData.put("portal_download_invoices", this.portalDownloadInvoices); + } + + if (this.sendSubscriptionEmails != null) { + + formData.put("send_subscription_emails", this.sendSubscriptionEmails); + } + + if (this.sendPaymentEmails != null) { + + formData.put("send_payment_emails", this.sendPaymentEmails); + } + + if (this.sendInvoiceEmails != null) { + + formData.put("send_invoice_emails", this.sendInvoiceEmails); + } + + return formData; + } + + /** Create a new builder for ChildAccountAccessParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ChildAccountAccessBuilder builder() { + return new ChildAccountAccessBuilder(); + } + + public static final class ChildAccountAccessBuilder { + + private PortalEditSubscriptions portalEditSubscriptions; + + private PortalDownloadInvoices portalDownloadInvoices; + + private Boolean sendSubscriptionEmails; + + private Boolean sendPaymentEmails; + + private Boolean sendInvoiceEmails; + + private ChildAccountAccessBuilder() {} + + public ChildAccountAccessBuilder portalEditSubscriptions(PortalEditSubscriptions value) { + this.portalEditSubscriptions = value; + return this; + } + + public ChildAccountAccessBuilder portalDownloadInvoices(PortalDownloadInvoices value) { + this.portalDownloadInvoices = value; + return this; + } + + public ChildAccountAccessBuilder sendSubscriptionEmails(Boolean value) { + this.sendSubscriptionEmails = value; + return this; + } + + public ChildAccountAccessBuilder sendPaymentEmails(Boolean value) { + this.sendPaymentEmails = value; + return this; + } + + public ChildAccountAccessBuilder sendInvoiceEmails(Boolean value) { + this.sendInvoiceEmails = value; + return this; + } + + public ChildAccountAccessParams build() { + return new ChildAccountAccessParams(this); + } + } + + public enum PortalEditSubscriptions { + YES("yes"), + + VIEW_ONLY("view_only"), + + /** + * An enum member indicating that PortalEditSubscriptions was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + PortalEditSubscriptions(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PortalEditSubscriptions fromString(String value) { + if (value == null) return _UNKNOWN; + for (PortalEditSubscriptions enumValue : PortalEditSubscriptions.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PortalDownloadInvoices { + YES("yes"), + + VIEW_ONLY("view_only"), + + NO("no"), + + /** + * An enum member indicating that PortalDownloadInvoices was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + PortalDownloadInvoices(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PortalDownloadInvoices fromString(String value) { + if (value == null) return _UNKNOWN; + for (PortalDownloadInvoices enumValue : PortalDownloadInvoices.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdatePaymentMethodParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdatePaymentMethodParams.java new file mode 100644 index 00000000..395abe22 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdatePaymentMethodParams.java @@ -0,0 +1,520 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.customer.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerUpdatePaymentMethodParams { + + private final PaymentMethodParams paymentMethod; + + private final Map consentFields; + + private CustomerUpdatePaymentMethodParams(CustomerUpdatePaymentMethodBuilder builder) { + + this.paymentMethod = builder.paymentMethod; + + this.consentFields = + builder.consentFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); + } + + public PaymentMethodParams getPaymentMethod() { + return paymentMethod; + } + + public Map consentFields() { + return consentFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.paymentMethod != null) { + + // Single object + Map nestedData = this.paymentMethod.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "payment_method[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + formData.putAll(consentFields); + + return formData; + } + + /** Create a new builder for CustomerUpdatePaymentMethodParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerUpdatePaymentMethodBuilder builder() { + return new CustomerUpdatePaymentMethodBuilder(); + } + + public static final class CustomerUpdatePaymentMethodBuilder { + + private PaymentMethodParams paymentMethod; + + private Map consentFields = new LinkedHashMap<>(); + + private CustomerUpdatePaymentMethodBuilder() {} + + public CustomerUpdatePaymentMethodBuilder paymentMethod(PaymentMethodParams value) { + this.paymentMethod = value; + return this; + } + + /** + * Add a consent field to the request. Consent fields must start with "cs_". Consent fields + * typically hold boolean values or options. + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the value of the consent field (typically Boolean or String for options) + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerUpdatePaymentMethodBuilder consentField(String fieldName, Object value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add a boolean consent field to the request. Consent fields must start with "cs_". + * + * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") + * @param value the boolean value of the consent field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cs_" + */ + public CustomerUpdatePaymentMethodBuilder consentField(String fieldName, Boolean value) { + if (fieldName == null || !fieldName.startsWith("cs_")) { + throw new IllegalArgumentException("Consent field name must start with 'cs_'"); + } + this.consentFields.put(fieldName, value); + return this; + } + + /** + * Add multiple consent fields to the request. All field names must start with "cs_". + * + * @param consentFields map of consent field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cs_" + */ + public CustomerUpdatePaymentMethodBuilder consentFields(Map consentFields) { + if (consentFields != null) { + for (Map.Entry entry : consentFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { + throw new IllegalArgumentException( + "Consent field name must start with 'cs_': " + entry.getKey()); + } + this.consentFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CustomerUpdatePaymentMethodParams build() { + return new CustomerUpdatePaymentMethodParams(this); + } + } + + public static final class PaymentMethodParams { + + private final Type type; + + private final Gateway gateway; + + private final String gatewayAccountId; + + private final String referenceId; + + private final String tmpToken; + + private final String issuingCountry; + + private final java.util.Map additionalInformation; + + private PaymentMethodParams(PaymentMethodBuilder builder) { + + this.type = builder.type; + + this.gateway = builder.gateway; + + this.gatewayAccountId = builder.gatewayAccountId; + + this.referenceId = builder.referenceId; + + this.tmpToken = builder.tmpToken; + + this.issuingCountry = builder.issuingCountry; + + this.additionalInformation = builder.additionalInformation; + } + + public Type getType() { + return type; + } + + public Gateway getGateway() { + return gateway; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getReferenceId() { + return referenceId; + } + + public String getTmpToken() { + return tmpToken; + } + + public String getIssuingCountry() { + return issuingCountry; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.type != null) { + + formData.put("type", this.type); + } + + if (this.gateway != null) { + + formData.put("gateway", this.gateway); + } + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.referenceId != null) { + + formData.put("reference_id", this.referenceId); + } + + if (this.tmpToken != null) { + + formData.put("tmp_token", this.tmpToken); + } + + if (this.issuingCountry != null) { + + formData.put("issuing_country", this.issuingCountry); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for PaymentMethodParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentMethodBuilder builder() { + return new PaymentMethodBuilder(); + } + + public static final class PaymentMethodBuilder { + + private Type type; + + private Gateway gateway; + + private String gatewayAccountId; + + private String referenceId; + + private String tmpToken; + + private String issuingCountry; + + private java.util.Map additionalInformation; + + private PaymentMethodBuilder() {} + + public PaymentMethodBuilder type(Type value) { + this.type = value; + return this; + } + + @Deprecated + public PaymentMethodBuilder gateway(Gateway value) { + this.gateway = value; + return this; + } + + public PaymentMethodBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public PaymentMethodBuilder referenceId(String value) { + this.referenceId = value; + return this; + } + + public PaymentMethodBuilder tmpToken(String value) { + this.tmpToken = value; + return this; + } + + public PaymentMethodBuilder issuingCountry(String value) { + this.issuingCountry = value; + return this; + } + + public PaymentMethodBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public PaymentMethodParams build() { + return new PaymentMethodParams(this); + } + } + + public enum Type { + CARD("card"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + AMAZON_PAYMENTS("amazon_payments"), + + DIRECT_DEBIT("direct_debit"), + + GENERIC("generic"), + + ALIPAY("alipay"), + + UNIONPAY("unionpay"), + + WECHAT_PAY("wechat_pay"), + + IDEAL("ideal"), + + GOOGLE_PAY("google_pay"), + + SOFORT("sofort"), + + BANCONTACT("bancontact"), + + GIROPAY("giropay"), + + DOTPAY("dotpay"), + + UPI("upi"), + + NETBANKING_EMANDATES("netbanking_emandates"), + + VENMO("venmo"), + + PAY_TO("pay_to"), + + FASTER_PAYMENTS("faster_payments"), + + SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), + + AUTOMATED_BANK_TRANSFER("automated_bank_transfer"), + + KLARNA_PAY_NOW("klarna_pay_now"), + + ONLINE_BANKING_POLAND("online_banking_poland"), + + PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), + + ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), + + KBC_PAYMENT_BUTTON("kbc_payment_button"), + + PAY_BY_BANK("pay_by_bank"), + + TRUSTLY("trustly"), + + STABLECOIN("stablecoin"), + + /** An enum member indicating that Type was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Type(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Type fromString(String value) { + if (value == null) return _UNKNOWN; + for (Type enumValue : Type.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum Gateway { + CHARGEBEE_PAYMENTS("chargebee_payments"), + + ADYEN("adyen"), + + STRIPE("stripe"), + + WEPAY("wepay"), + + BRAINTREE("braintree"), + + AUTHORIZE_NET("authorize_net"), + + PAYPAL_PRO("paypal_pro"), + + PIN("pin"), + + EWAY("eway"), + + EWAY_RAPID("eway_rapid"), + + WORLDPAY("worldpay"), + + BALANCED_PAYMENTS("balanced_payments"), + + BEANSTREAM("beanstream"), + + BLUEPAY("bluepay"), + + ELAVON("elavon"), + + FIRST_DATA_GLOBAL("first_data_global"), + + HDFC("hdfc"), + + MIGS("migs"), + + NMI("nmi"), + + OGONE("ogone"), + + PAYMILL("paymill"), + + PAYPAL_PAYFLOW_PRO("paypal_payflow_pro"), + + SAGE_PAY("sage_pay"), + + TCO("tco"), + + WIRECARD("wirecard"), + + AMAZON_PAYMENTS("amazon_payments"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + GOCARDLESS("gocardless"), + + ORBITAL("orbital"), + + MONERIS_US("moneris_us"), + + MONERIS("moneris"), + + BLUESNAP("bluesnap"), + + CYBERSOURCE("cybersource"), + + VANTIV("vantiv"), + + CHECKOUT_COM("checkout_com"), + + PAYPAL("paypal"), + + INGENICO_DIRECT("ingenico_direct"), + + EXACT("exact"), + + MOLLIE("mollie"), + + QUICKBOOKS("quickbooks"), + + RAZORPAY("razorpay"), + + GLOBAL_PAYMENTS("global_payments"), + + BANK_OF_AMERICA("bank_of_america"), + + ECENTRIC("ecentric"), + + METRICS_GLOBAL("metrics_global"), + + WINDCAVE("windcave"), + + PAY_COM("pay_com"), + + EBANX("ebanx"), + + DLOCAL("dlocal"), + + NUVEI("nuvei"), + + SOLIDGATE("solidgate"), + + PAYSTACK("paystack"), + + JP_MORGAN("jp_morgan"), + + DEUTSCHE_BANK("deutsche_bank"), + + EZIDEBIT("ezidebit"), + + /** An enum member indicating that Gateway was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Gateway(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Gateway fromString(String value) { + if (value == null) return _UNKNOWN; + for (Gateway enumValue : Gateway.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/DeductPromotionalCreditsForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/DeductPromotionalCreditsForCustomerParams.java deleted file mode 100644 index 16f9d823..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/DeductPromotionalCreditsForCustomerParams.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeductPromotionalCreditsForCustomerParams { - - private final Long amount; - - private final String currencyCode; - - private final String description; - - private final CreditType creditType; - - private final String reference; - - private final Map consentFields; - - private DeductPromotionalCreditsForCustomerParams( - DeductPromotionalCreditsForCustomerBuilder builder) { - - this.amount = builder.amount; - - this.currencyCode = builder.currencyCode; - - this.description = builder.description; - - this.creditType = builder.creditType; - - this.reference = builder.reference; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public Long getAmount() { - return amount; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public String getDescription() { - return description; - } - - public CreditType getCreditType() { - return creditType; - } - - public String getReference() { - return reference; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.currencyCode != null) { - - formData.put("currency_code", this.currencyCode); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.creditType != null) { - - formData.put("credit_type", this.creditType); - } - - if (this.reference != null) { - - formData.put("reference", this.reference); - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for DeductPromotionalCreditsForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeductPromotionalCreditsForCustomerBuilder builder() { - return new DeductPromotionalCreditsForCustomerBuilder(); - } - - public static final class DeductPromotionalCreditsForCustomerBuilder { - - private Long amount; - - private String currencyCode; - - private String description; - - private CreditType creditType; - - private String reference; - - private Map consentFields = new LinkedHashMap<>(); - - private DeductPromotionalCreditsForCustomerBuilder() {} - - public DeductPromotionalCreditsForCustomerBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DeductPromotionalCreditsForCustomerBuilder currencyCode(String value) { - this.currencyCode = value; - return this; - } - - public DeductPromotionalCreditsForCustomerBuilder description(String value) { - this.description = value; - return this; - } - - public DeductPromotionalCreditsForCustomerBuilder creditType(CreditType value) { - this.creditType = value; - return this; - } - - public DeductPromotionalCreditsForCustomerBuilder reference(String value) { - this.reference = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public DeductPromotionalCreditsForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public DeductPromotionalCreditsForCustomerBuilder consentField( - String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public DeductPromotionalCreditsForCustomerBuilder consentFields( - Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public DeductPromotionalCreditsForCustomerParams build() { - return new DeductPromotionalCreditsForCustomerParams(this); - } - } - - public enum CreditType { - LOYALTY_CREDITS("loyalty_credits"), - - REFERRAL_REWARDS("referral_rewards"), - - GENERAL("general"), - - /** An enum member indicating that CreditType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - CreditType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CreditType fromString(String value) { - if (value == null) return _UNKNOWN; - for (CreditType enumValue : CreditType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/DeleteContactForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/DeleteContactForCustomerParams.java deleted file mode 100644 index 88d37f26..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/DeleteContactForCustomerParams.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteContactForCustomerParams { - - private final ContactParams contact; - - private final Map consentFields; - - private DeleteContactForCustomerParams(DeleteContactForCustomerBuilder builder) { - - this.contact = builder.contact; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public ContactParams getContact() { - return contact; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.contact != null) { - - // Single object - Map nestedData = this.contact.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contact[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for DeleteContactForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteContactForCustomerBuilder builder() { - return new DeleteContactForCustomerBuilder(); - } - - public static final class DeleteContactForCustomerBuilder { - - private ContactParams contact; - - private Map consentFields = new LinkedHashMap<>(); - - private DeleteContactForCustomerBuilder() {} - - public DeleteContactForCustomerBuilder contact(ContactParams value) { - this.contact = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public DeleteContactForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public DeleteContactForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public DeleteContactForCustomerBuilder consentFields(Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public DeleteContactForCustomerParams build() { - return new DeleteContactForCustomerParams(this); - } - } - - public static final class ContactParams { - - private final String id; - - private ContactParams(ContactBuilder builder) { - - this.id = builder.id; - } - - public String getId() { - return id; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - return formData; - } - - /** Create a new builder for ContactParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContactBuilder builder() { - return new ContactBuilder(); - } - - public static final class ContactBuilder { - - private String id; - - private ContactBuilder() {} - - public ContactBuilder id(String value) { - this.id = value; - return this; - } - - public ContactParams build() { - return new ContactParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/DeleteCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/DeleteCustomerParams.java deleted file mode 100644 index 57570d69..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/DeleteCustomerParams.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteCustomerParams { - - private final Boolean deletePaymentMethod; - - private final Map consentFields; - - private DeleteCustomerParams(DeleteCustomerBuilder builder) { - - this.deletePaymentMethod = builder.deletePaymentMethod; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public Boolean getDeletePaymentMethod() { - return deletePaymentMethod; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.deletePaymentMethod != null) { - - formData.put("delete_payment_method", this.deletePaymentMethod); - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for DeleteCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteCustomerBuilder builder() { - return new DeleteCustomerBuilder(); - } - - public static final class DeleteCustomerBuilder { - - private Boolean deletePaymentMethod; - - private Map consentFields = new LinkedHashMap<>(); - - private DeleteCustomerBuilder() {} - - public DeleteCustomerBuilder deletePaymentMethod(Boolean value) { - this.deletePaymentMethod = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public DeleteCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public DeleteCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public DeleteCustomerBuilder consentFields(Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public DeleteCustomerParams build() { - return new DeleteCustomerParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/DeleteRelationshipForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/DeleteRelationshipForCustomerParams.java deleted file mode 100644 index d8d6ecb1..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/DeleteRelationshipForCustomerParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteRelationshipForCustomerParams { - - private DeleteRelationshipForCustomerParams(DeleteRelationshipForCustomerBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteRelationshipForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteRelationshipForCustomerBuilder builder() { - return new DeleteRelationshipForCustomerBuilder(); - } - - public static final class DeleteRelationshipForCustomerBuilder { - - private DeleteRelationshipForCustomerBuilder() {} - - public DeleteRelationshipForCustomerParams build() { - return new DeleteRelationshipForCustomerParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/HierarchyDetailForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/HierarchyDetailForCustomerParams.java deleted file mode 100644 index be5ceccc..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/HierarchyDetailForCustomerParams.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class HierarchyDetailForCustomerParams { - - private final Map queryParams; - - private HierarchyDetailForCustomerParams(HierarchyDetailForCustomerBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public HierarchyDetailForCustomerBuilder toBuilder() { - HierarchyDetailForCustomerBuilder builder = new HierarchyDetailForCustomerBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for HierarchyDetailForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static HierarchyDetailForCustomerBuilder builder() { - return new HierarchyDetailForCustomerBuilder(); - } - - public static final class HierarchyDetailForCustomerBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private HierarchyDetailForCustomerBuilder() {} - - public HierarchyDetailForCustomerBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public HierarchyDetailForCustomerBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - public HierarchyDetailForCustomerBuilder hierarchyOperationType(HierarchyOperationType value) { - queryParams.put("hierarchy_operation_type", value); - return this; - } - - public HierarchyDetailForCustomerParams build() { - return new HierarchyDetailForCustomerParams(this); - } - } - - public enum HierarchyOperationType { - COMPLETE_HIERARCHY("complete_hierarchy"), - - SUBORDINATES("subordinates"), - - PATH_TO_ROOT("path_to_root"), - - SUBORDINATES_WITH_UNBILLED_CHARGES_PAYABLE_BY_PARENT( - "subordinates_with_unbilled_charges_payable_by_parent"), - - IMMEDIATE_CHILDREN("immediate_children"), - - /** - * An enum member indicating that HierarchyOperationType was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - HierarchyOperationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static HierarchyOperationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (HierarchyOperationType enumValue : HierarchyOperationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/HierarchyForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/HierarchyForCustomerParams.java deleted file mode 100644 index 51a64c0f..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/HierarchyForCustomerParams.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class HierarchyForCustomerParams { - - private final Map queryParams; - - private HierarchyForCustomerParams(HierarchyForCustomerBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public HierarchyForCustomerBuilder toBuilder() { - HierarchyForCustomerBuilder builder = new HierarchyForCustomerBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for HierarchyForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static HierarchyForCustomerBuilder builder() { - return new HierarchyForCustomerBuilder(); - } - - public static final class HierarchyForCustomerBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private HierarchyForCustomerBuilder() {} - - public HierarchyForCustomerBuilder hierarchyOperationType(HierarchyOperationType value) { - queryParams.put("hierarchy_operation_type", value); - return this; - } - - public HierarchyForCustomerParams build() { - return new HierarchyForCustomerParams(this); - } - } - - public enum HierarchyOperationType { - COMPLETE_HIERARCHY("complete_hierarchy"), - - SUBORDINATES("subordinates"), - - PATH_TO_ROOT("path_to_root"), - - SUBORDINATES_WITH_UNBILLED_CHARGES_PAYABLE_BY_PARENT( - "subordinates_with_unbilled_charges_payable_by_parent"), - - IMMEDIATE_CHILDREN("immediate_children"), - - /** - * An enum member indicating that HierarchyOperationType was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - HierarchyOperationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static HierarchyOperationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (HierarchyOperationType enumValue : HierarchyOperationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/RecordExcessPaymentForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/RecordExcessPaymentForCustomerParams.java deleted file mode 100644 index 95948ff1..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/RecordExcessPaymentForCustomerParams.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class RecordExcessPaymentForCustomerParams { - - private final String comment; - - private final TransactionParams transaction; - - private final Map consentFields; - - private RecordExcessPaymentForCustomerParams(RecordExcessPaymentForCustomerBuilder builder) { - - this.comment = builder.comment; - - this.transaction = builder.transaction; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public String getComment() { - return comment; - } - - public TransactionParams getTransaction() { - return transaction; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.transaction != null) { - - // Single object - Map nestedData = this.transaction.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "transaction[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for RecordExcessPaymentForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RecordExcessPaymentForCustomerBuilder builder() { - return new RecordExcessPaymentForCustomerBuilder(); - } - - public static final class RecordExcessPaymentForCustomerBuilder { - - private String comment; - - private TransactionParams transaction; - - private Map consentFields = new LinkedHashMap<>(); - - private RecordExcessPaymentForCustomerBuilder() {} - - public RecordExcessPaymentForCustomerBuilder comment(String value) { - this.comment = value; - return this; - } - - public RecordExcessPaymentForCustomerBuilder transaction(TransactionParams value) { - this.transaction = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public RecordExcessPaymentForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public RecordExcessPaymentForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public RecordExcessPaymentForCustomerBuilder consentFields(Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public RecordExcessPaymentForCustomerParams build() { - return new RecordExcessPaymentForCustomerParams(this); - } - } - - public static final class TransactionParams { - - private final String id; - - private final Long amount; - - private final String currencyCode; - - private final Timestamp date; - - private final PaymentMethod paymentMethod; - - private final String referenceNumber; - - private final String customPaymentMethodId; - - private TransactionParams(TransactionBuilder builder) { - - this.id = builder.id; - - this.amount = builder.amount; - - this.currencyCode = builder.currencyCode; - - this.date = builder.date; - - this.paymentMethod = builder.paymentMethod; - - this.referenceNumber = builder.referenceNumber; - - this.customPaymentMethodId = builder.customPaymentMethodId; - } - - public String getId() { - return id; - } - - public Long getAmount() { - return amount; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public Timestamp getDate() { - return date; - } - - public PaymentMethod getPaymentMethod() { - return paymentMethod; - } - - public String getReferenceNumber() { - return referenceNumber; - } - - public String getCustomPaymentMethodId() { - return customPaymentMethodId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.currencyCode != null) { - - formData.put("currency_code", this.currencyCode); - } - - if (this.date != null) { - - formData.put("date", this.date); - } - - if (this.paymentMethod != null) { - - formData.put("payment_method", this.paymentMethod); - } - - if (this.referenceNumber != null) { - - formData.put("reference_number", this.referenceNumber); - } - - if (this.customPaymentMethodId != null) { - - formData.put("custom_payment_method_id", this.customPaymentMethodId); - } - - return formData; - } - - /** Create a new builder for TransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TransactionBuilder builder() { - return new TransactionBuilder(); - } - - public static final class TransactionBuilder { - - private String id; - - private Long amount; - - private String currencyCode; - - private Timestamp date; - - private PaymentMethod paymentMethod; - - private String referenceNumber; - - private String customPaymentMethodId; - - private TransactionBuilder() {} - - public TransactionBuilder id(String value) { - this.id = value; - return this; - } - - public TransactionBuilder amount(Long value) { - this.amount = value; - return this; - } - - public TransactionBuilder currencyCode(String value) { - this.currencyCode = value; - return this; - } - - public TransactionBuilder date(Timestamp value) { - this.date = value; - return this; - } - - public TransactionBuilder paymentMethod(PaymentMethod value) { - this.paymentMethod = value; - return this; - } - - public TransactionBuilder referenceNumber(String value) { - this.referenceNumber = value; - return this; - } - - public TransactionBuilder customPaymentMethodId(String value) { - this.customPaymentMethodId = value; - return this; - } - - public TransactionParams build() { - return new TransactionParams(this); - } - } - - public enum PaymentMethod { - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - OTHER("other"), - - APP_STORE("app_store"), - - PLAY_STORE("play_store"), - - CUSTOM("custom"), - - /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethod enumValue : PaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/RelationshipsForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/RelationshipsForCustomerParams.java deleted file mode 100644 index 4394f48d..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/RelationshipsForCustomerParams.java +++ /dev/null @@ -1,627 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RelationshipsForCustomerParams { - - private final String parentId; - - private final String paymentOwnerId; - - private final String invoiceOwnerId; - - private final Boolean useDefaultHierarchySettings; - - private final ParentAccountAccessParams parentAccountAccess; - - private final ChildAccountAccessParams childAccountAccess; - - private final Map consentFields; - - private RelationshipsForCustomerParams(RelationshipsForCustomerBuilder builder) { - - this.parentId = builder.parentId; - - this.paymentOwnerId = builder.paymentOwnerId; - - this.invoiceOwnerId = builder.invoiceOwnerId; - - this.useDefaultHierarchySettings = builder.useDefaultHierarchySettings; - - this.parentAccountAccess = builder.parentAccountAccess; - - this.childAccountAccess = builder.childAccountAccess; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public String getParentId() { - return parentId; - } - - public String getPaymentOwnerId() { - return paymentOwnerId; - } - - public String getInvoiceOwnerId() { - return invoiceOwnerId; - } - - public Boolean getUseDefaultHierarchySettings() { - return useDefaultHierarchySettings; - } - - public ParentAccountAccessParams getParentAccountAccess() { - return parentAccountAccess; - } - - public ChildAccountAccessParams getChildAccountAccess() { - return childAccountAccess; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.parentId != null) { - - formData.put("parent_id", this.parentId); - } - - if (this.paymentOwnerId != null) { - - formData.put("payment_owner_id", this.paymentOwnerId); - } - - if (this.invoiceOwnerId != null) { - - formData.put("invoice_owner_id", this.invoiceOwnerId); - } - - if (this.useDefaultHierarchySettings != null) { - - formData.put("use_default_hierarchy_settings", this.useDefaultHierarchySettings); - } - - if (this.parentAccountAccess != null) { - - // Single object - Map nestedData = this.parentAccountAccess.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "parent_account_access[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.childAccountAccess != null) { - - // Single object - Map nestedData = this.childAccountAccess.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "child_account_access[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for RelationshipsForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RelationshipsForCustomerBuilder builder() { - return new RelationshipsForCustomerBuilder(); - } - - public static final class RelationshipsForCustomerBuilder { - - private String parentId; - - private String paymentOwnerId; - - private String invoiceOwnerId; - - private Boolean useDefaultHierarchySettings; - - private ParentAccountAccessParams parentAccountAccess; - - private ChildAccountAccessParams childAccountAccess; - - private Map consentFields = new LinkedHashMap<>(); - - private RelationshipsForCustomerBuilder() {} - - public RelationshipsForCustomerBuilder parentId(String value) { - this.parentId = value; - return this; - } - - public RelationshipsForCustomerBuilder paymentOwnerId(String value) { - this.paymentOwnerId = value; - return this; - } - - public RelationshipsForCustomerBuilder invoiceOwnerId(String value) { - this.invoiceOwnerId = value; - return this; - } - - public RelationshipsForCustomerBuilder useDefaultHierarchySettings(Boolean value) { - this.useDefaultHierarchySettings = value; - return this; - } - - public RelationshipsForCustomerBuilder parentAccountAccess(ParentAccountAccessParams value) { - this.parentAccountAccess = value; - return this; - } - - public RelationshipsForCustomerBuilder childAccountAccess(ChildAccountAccessParams value) { - this.childAccountAccess = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public RelationshipsForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public RelationshipsForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public RelationshipsForCustomerBuilder consentFields(Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public RelationshipsForCustomerParams build() { - return new RelationshipsForCustomerParams(this); - } - } - - public static final class ParentAccountAccessParams { - - private final PortalEditChildSubscriptions portalEditChildSubscriptions; - - private final PortalDownloadChildInvoices portalDownloadChildInvoices; - - private final Boolean sendSubscriptionEmails; - - private final Boolean sendPaymentEmails; - - private final Boolean sendInvoiceEmails; - - private ParentAccountAccessParams(ParentAccountAccessBuilder builder) { - - this.portalEditChildSubscriptions = builder.portalEditChildSubscriptions; - - this.portalDownloadChildInvoices = builder.portalDownloadChildInvoices; - - this.sendSubscriptionEmails = builder.sendSubscriptionEmails; - - this.sendPaymentEmails = builder.sendPaymentEmails; - - this.sendInvoiceEmails = builder.sendInvoiceEmails; - } - - public PortalEditChildSubscriptions getPortalEditChildSubscriptions() { - return portalEditChildSubscriptions; - } - - public PortalDownloadChildInvoices getPortalDownloadChildInvoices() { - return portalDownloadChildInvoices; - } - - public Boolean getSendSubscriptionEmails() { - return sendSubscriptionEmails; - } - - public Boolean getSendPaymentEmails() { - return sendPaymentEmails; - } - - public Boolean getSendInvoiceEmails() { - return sendInvoiceEmails; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.portalEditChildSubscriptions != null) { - - formData.put("portal_edit_child_subscriptions", this.portalEditChildSubscriptions); - } - - if (this.portalDownloadChildInvoices != null) { - - formData.put("portal_download_child_invoices", this.portalDownloadChildInvoices); - } - - if (this.sendSubscriptionEmails != null) { - - formData.put("send_subscription_emails", this.sendSubscriptionEmails); - } - - if (this.sendPaymentEmails != null) { - - formData.put("send_payment_emails", this.sendPaymentEmails); - } - - if (this.sendInvoiceEmails != null) { - - formData.put("send_invoice_emails", this.sendInvoiceEmails); - } - - return formData; - } - - /** Create a new builder for ParentAccountAccessParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ParentAccountAccessBuilder builder() { - return new ParentAccountAccessBuilder(); - } - - public static final class ParentAccountAccessBuilder { - - private PortalEditChildSubscriptions portalEditChildSubscriptions; - - private PortalDownloadChildInvoices portalDownloadChildInvoices; - - private Boolean sendSubscriptionEmails; - - private Boolean sendPaymentEmails; - - private Boolean sendInvoiceEmails; - - private ParentAccountAccessBuilder() {} - - public ParentAccountAccessBuilder portalEditChildSubscriptions( - PortalEditChildSubscriptions value) { - this.portalEditChildSubscriptions = value; - return this; - } - - public ParentAccountAccessBuilder portalDownloadChildInvoices( - PortalDownloadChildInvoices value) { - this.portalDownloadChildInvoices = value; - return this; - } - - public ParentAccountAccessBuilder sendSubscriptionEmails(Boolean value) { - this.sendSubscriptionEmails = value; - return this; - } - - public ParentAccountAccessBuilder sendPaymentEmails(Boolean value) { - this.sendPaymentEmails = value; - return this; - } - - public ParentAccountAccessBuilder sendInvoiceEmails(Boolean value) { - this.sendInvoiceEmails = value; - return this; - } - - public ParentAccountAccessParams build() { - return new ParentAccountAccessParams(this); - } - } - - public enum PortalEditChildSubscriptions { - YES("yes"), - - VIEW_ONLY("view_only"), - - NO("no"), - - /** - * An enum member indicating that PortalEditChildSubscriptions was instantiated with an - * unknown value. - */ - _UNKNOWN(null); - private final String value; - - PortalEditChildSubscriptions(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PortalEditChildSubscriptions fromString(String value) { - if (value == null) return _UNKNOWN; - for (PortalEditChildSubscriptions enumValue : PortalEditChildSubscriptions.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PortalDownloadChildInvoices { - YES("yes"), - - VIEW_ONLY("view_only"), - - NO("no"), - - /** - * An enum member indicating that PortalDownloadChildInvoices was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - PortalDownloadChildInvoices(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PortalDownloadChildInvoices fromString(String value) { - if (value == null) return _UNKNOWN; - for (PortalDownloadChildInvoices enumValue : PortalDownloadChildInvoices.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ChildAccountAccessParams { - - private final PortalEditSubscriptions portalEditSubscriptions; - - private final PortalDownloadInvoices portalDownloadInvoices; - - private final Boolean sendSubscriptionEmails; - - private final Boolean sendPaymentEmails; - - private final Boolean sendInvoiceEmails; - - private ChildAccountAccessParams(ChildAccountAccessBuilder builder) { - - this.portalEditSubscriptions = builder.portalEditSubscriptions; - - this.portalDownloadInvoices = builder.portalDownloadInvoices; - - this.sendSubscriptionEmails = builder.sendSubscriptionEmails; - - this.sendPaymentEmails = builder.sendPaymentEmails; - - this.sendInvoiceEmails = builder.sendInvoiceEmails; - } - - public PortalEditSubscriptions getPortalEditSubscriptions() { - return portalEditSubscriptions; - } - - public PortalDownloadInvoices getPortalDownloadInvoices() { - return portalDownloadInvoices; - } - - public Boolean getSendSubscriptionEmails() { - return sendSubscriptionEmails; - } - - public Boolean getSendPaymentEmails() { - return sendPaymentEmails; - } - - public Boolean getSendInvoiceEmails() { - return sendInvoiceEmails; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.portalEditSubscriptions != null) { - - formData.put("portal_edit_subscriptions", this.portalEditSubscriptions); - } - - if (this.portalDownloadInvoices != null) { - - formData.put("portal_download_invoices", this.portalDownloadInvoices); - } - - if (this.sendSubscriptionEmails != null) { - - formData.put("send_subscription_emails", this.sendSubscriptionEmails); - } - - if (this.sendPaymentEmails != null) { - - formData.put("send_payment_emails", this.sendPaymentEmails); - } - - if (this.sendInvoiceEmails != null) { - - formData.put("send_invoice_emails", this.sendInvoiceEmails); - } - - return formData; - } - - /** Create a new builder for ChildAccountAccessParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ChildAccountAccessBuilder builder() { - return new ChildAccountAccessBuilder(); - } - - public static final class ChildAccountAccessBuilder { - - private PortalEditSubscriptions portalEditSubscriptions; - - private PortalDownloadInvoices portalDownloadInvoices; - - private Boolean sendSubscriptionEmails; - - private Boolean sendPaymentEmails; - - private Boolean sendInvoiceEmails; - - private ChildAccountAccessBuilder() {} - - public ChildAccountAccessBuilder portalEditSubscriptions(PortalEditSubscriptions value) { - this.portalEditSubscriptions = value; - return this; - } - - public ChildAccountAccessBuilder portalDownloadInvoices(PortalDownloadInvoices value) { - this.portalDownloadInvoices = value; - return this; - } - - public ChildAccountAccessBuilder sendSubscriptionEmails(Boolean value) { - this.sendSubscriptionEmails = value; - return this; - } - - public ChildAccountAccessBuilder sendPaymentEmails(Boolean value) { - this.sendPaymentEmails = value; - return this; - } - - public ChildAccountAccessBuilder sendInvoiceEmails(Boolean value) { - this.sendInvoiceEmails = value; - return this; - } - - public ChildAccountAccessParams build() { - return new ChildAccountAccessParams(this); - } - } - - public enum PortalEditSubscriptions { - YES("yes"), - - VIEW_ONLY("view_only"), - - /** - * An enum member indicating that PortalEditSubscriptions was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - PortalEditSubscriptions(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PortalEditSubscriptions fromString(String value) { - if (value == null) return _UNKNOWN; - for (PortalEditSubscriptions enumValue : PortalEditSubscriptions.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PortalDownloadInvoices { - YES("yes"), - - VIEW_ONLY("view_only"), - - NO("no"), - - /** - * An enum member indicating that PortalDownloadInvoices was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - PortalDownloadInvoices(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PortalDownloadInvoices fromString(String value) { - if (value == null) return _UNKNOWN; - for (PortalDownloadInvoices enumValue : PortalDownloadInvoices.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/SetPromotionalCreditsForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/SetPromotionalCreditsForCustomerParams.java deleted file mode 100644 index 9fe418f8..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/SetPromotionalCreditsForCustomerParams.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class SetPromotionalCreditsForCustomerParams { - - private final Long amount; - - private final String currencyCode; - - private final String description; - - private final CreditType creditType; - - private final String reference; - - private final Map consentFields; - - private SetPromotionalCreditsForCustomerParams(SetPromotionalCreditsForCustomerBuilder builder) { - - this.amount = builder.amount; - - this.currencyCode = builder.currencyCode; - - this.description = builder.description; - - this.creditType = builder.creditType; - - this.reference = builder.reference; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public Long getAmount() { - return amount; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public String getDescription() { - return description; - } - - public CreditType getCreditType() { - return creditType; - } - - public String getReference() { - return reference; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.currencyCode != null) { - - formData.put("currency_code", this.currencyCode); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.creditType != null) { - - formData.put("credit_type", this.creditType); - } - - if (this.reference != null) { - - formData.put("reference", this.reference); - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for SetPromotionalCreditsForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SetPromotionalCreditsForCustomerBuilder builder() { - return new SetPromotionalCreditsForCustomerBuilder(); - } - - public static final class SetPromotionalCreditsForCustomerBuilder { - - private Long amount; - - private String currencyCode; - - private String description; - - private CreditType creditType; - - private String reference; - - private Map consentFields = new LinkedHashMap<>(); - - private SetPromotionalCreditsForCustomerBuilder() {} - - public SetPromotionalCreditsForCustomerBuilder amount(Long value) { - this.amount = value; - return this; - } - - public SetPromotionalCreditsForCustomerBuilder currencyCode(String value) { - this.currencyCode = value; - return this; - } - - public SetPromotionalCreditsForCustomerBuilder description(String value) { - this.description = value; - return this; - } - - public SetPromotionalCreditsForCustomerBuilder creditType(CreditType value) { - this.creditType = value; - return this; - } - - public SetPromotionalCreditsForCustomerBuilder reference(String value) { - this.reference = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public SetPromotionalCreditsForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public SetPromotionalCreditsForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public SetPromotionalCreditsForCustomerBuilder consentFields( - Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public SetPromotionalCreditsForCustomerParams build() { - return new SetPromotionalCreditsForCustomerParams(this); - } - } - - public enum CreditType { - LOYALTY_CREDITS("loyalty_credits"), - - REFERRAL_REWARDS("referral_rewards"), - - GENERAL("general"), - - /** An enum member indicating that CreditType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - CreditType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CreditType fromString(String value) { - if (value == null) return _UNKNOWN; - for (CreditType enumValue : CreditType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/UpdateBillingInfoForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/UpdateBillingInfoForCustomerParams.java deleted file mode 100644 index b62e0626..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/UpdateBillingInfoForCustomerParams.java +++ /dev/null @@ -1,973 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class UpdateBillingInfoForCustomerParams { - - private final String vatNumber; - - private final String vatNumberPrefix; - - private final String entityIdentifierScheme; - - private final String entityIdentifierStandard; - - private final Boolean registeredForGst; - - private final Boolean businessCustomerWithoutVatNumber; - - private final Boolean isEinvoiceEnabled; - - private final EinvoicingMethod einvoicingMethod; - - private final BillingAddressParams billingAddress; - - private final List entityIdentifiers; - - private final List taxProvidersFields; - - private final Map consentFields; - - private UpdateBillingInfoForCustomerParams(UpdateBillingInfoForCustomerBuilder builder) { - - this.vatNumber = builder.vatNumber; - - this.vatNumberPrefix = builder.vatNumberPrefix; - - this.entityIdentifierScheme = builder.entityIdentifierScheme; - - this.entityIdentifierStandard = builder.entityIdentifierStandard; - - this.registeredForGst = builder.registeredForGst; - - this.businessCustomerWithoutVatNumber = builder.businessCustomerWithoutVatNumber; - - this.isEinvoiceEnabled = builder.isEinvoiceEnabled; - - this.einvoicingMethod = builder.einvoicingMethod; - - this.billingAddress = builder.billingAddress; - - this.entityIdentifiers = builder.entityIdentifiers; - - this.taxProvidersFields = builder.taxProvidersFields; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public String getVatNumber() { - return vatNumber; - } - - public String getVatNumberPrefix() { - return vatNumberPrefix; - } - - public String getEntityIdentifierScheme() { - return entityIdentifierScheme; - } - - public String getEntityIdentifierStandard() { - return entityIdentifierStandard; - } - - public Boolean getRegisteredForGst() { - return registeredForGst; - } - - public Boolean getBusinessCustomerWithoutVatNumber() { - return businessCustomerWithoutVatNumber; - } - - public Boolean getIsEinvoiceEnabled() { - return isEinvoiceEnabled; - } - - public EinvoicingMethod getEinvoicingMethod() { - return einvoicingMethod; - } - - public BillingAddressParams getBillingAddress() { - return billingAddress; - } - - public List getEntityIdentifiers() { - return entityIdentifiers; - } - - public List getTaxProvidersFields() { - return taxProvidersFields; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.vatNumber != null) { - - formData.put("vat_number", this.vatNumber); - } - - if (this.vatNumberPrefix != null) { - - formData.put("vat_number_prefix", this.vatNumberPrefix); - } - - if (this.entityIdentifierScheme != null) { - - formData.put("entity_identifier_scheme", this.entityIdentifierScheme); - } - - if (this.entityIdentifierStandard != null) { - - formData.put("entity_identifier_standard", this.entityIdentifierStandard); - } - - if (this.registeredForGst != null) { - - formData.put("registered_for_gst", this.registeredForGst); - } - - if (this.businessCustomerWithoutVatNumber != null) { - - formData.put("business_customer_without_vat_number", this.businessCustomerWithoutVatNumber); - } - - if (this.isEinvoiceEnabled != null) { - - formData.put("is_einvoice_enabled", this.isEinvoiceEnabled); - } - - if (this.einvoicingMethod != null) { - - formData.put("einvoicing_method", this.einvoicingMethod); - } - - if (this.billingAddress != null) { - - // Single object - Map nestedData = this.billingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.entityIdentifiers != null) { - - // List of objects - for (int i = 0; i < this.entityIdentifiers.size(); i++) { - EntityIdentifiersParams item = this.entityIdentifiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "entity_identifiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.taxProvidersFields != null) { - - // List of objects - for (int i = 0; i < this.taxProvidersFields.size(); i++) { - TaxProvidersFieldsParams item = this.taxProvidersFields.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "tax_providers_fields[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for UpdateBillingInfoForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateBillingInfoForCustomerBuilder builder() { - return new UpdateBillingInfoForCustomerBuilder(); - } - - public static final class UpdateBillingInfoForCustomerBuilder { - - private String vatNumber; - - private String vatNumberPrefix; - - private String entityIdentifierScheme; - - private String entityIdentifierStandard; - - private Boolean registeredForGst; - - private Boolean businessCustomerWithoutVatNumber; - - private Boolean isEinvoiceEnabled; - - private EinvoicingMethod einvoicingMethod; - - private BillingAddressParams billingAddress; - - private List entityIdentifiers; - - private List taxProvidersFields; - - private Map consentFields = new LinkedHashMap<>(); - - private UpdateBillingInfoForCustomerBuilder() {} - - public UpdateBillingInfoForCustomerBuilder vatNumber(String value) { - this.vatNumber = value; - return this; - } - - public UpdateBillingInfoForCustomerBuilder vatNumberPrefix(String value) { - this.vatNumberPrefix = value; - return this; - } - - public UpdateBillingInfoForCustomerBuilder entityIdentifierScheme(String value) { - this.entityIdentifierScheme = value; - return this; - } - - public UpdateBillingInfoForCustomerBuilder entityIdentifierStandard(String value) { - this.entityIdentifierStandard = value; - return this; - } - - public UpdateBillingInfoForCustomerBuilder registeredForGst(Boolean value) { - this.registeredForGst = value; - return this; - } - - public UpdateBillingInfoForCustomerBuilder businessCustomerWithoutVatNumber(Boolean value) { - this.businessCustomerWithoutVatNumber = value; - return this; - } - - public UpdateBillingInfoForCustomerBuilder isEinvoiceEnabled(Boolean value) { - this.isEinvoiceEnabled = value; - return this; - } - - public UpdateBillingInfoForCustomerBuilder einvoicingMethod(EinvoicingMethod value) { - this.einvoicingMethod = value; - return this; - } - - public UpdateBillingInfoForCustomerBuilder billingAddress(BillingAddressParams value) { - this.billingAddress = value; - return this; - } - - public UpdateBillingInfoForCustomerBuilder entityIdentifiers( - List value) { - this.entityIdentifiers = value; - return this; - } - - public UpdateBillingInfoForCustomerBuilder taxProvidersFields( - List value) { - this.taxProvidersFields = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public UpdateBillingInfoForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public UpdateBillingInfoForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public UpdateBillingInfoForCustomerBuilder consentFields(Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public UpdateBillingInfoForCustomerParams build() { - return new UpdateBillingInfoForCustomerParams(this); - } - } - - public enum EinvoicingMethod { - AUTOMATIC("automatic"), - - MANUAL("manual"), - - SITE_DEFAULT("site_default"), - - /** An enum member indicating that EinvoicingMethod was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - EinvoicingMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static EinvoicingMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (EinvoicingMethod enumValue : EinvoicingMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class BillingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private BillingAddressParams(BillingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for BillingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingAddressBuilder builder() { - return new BillingAddressBuilder(); - } - - public static final class BillingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private BillingAddressBuilder() {} - - public BillingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public BillingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public BillingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public BillingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public BillingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public BillingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public BillingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public BillingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public BillingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public BillingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public BillingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public BillingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public BillingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public BillingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public BillingAddressParams build() { - return new BillingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class EntityIdentifiersParams { - - private final String id; - - private final String scheme; - - private final String value; - - private final Operation operation; - - private final String standard; - - private EntityIdentifiersParams(EntityIdentifiersBuilder builder) { - - this.id = builder.id; - - this.scheme = builder.scheme; - - this.value = builder.value; - - this.operation = builder.operation; - - this.standard = builder.standard; - } - - public String getId() { - return id; - } - - public String getScheme() { - return scheme; - } - - public String getValue() { - return value; - } - - public Operation getOperation() { - return operation; - } - - public String getStandard() { - return standard; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.scheme != null) { - - formData.put("scheme", this.scheme); - } - - if (this.value != null) { - - formData.put("value", this.value); - } - - if (this.operation != null) { - - formData.put("operation", this.operation); - } - - if (this.standard != null) { - - formData.put("standard", this.standard); - } - - return formData; - } - - /** Create a new builder for EntityIdentifiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EntityIdentifiersBuilder builder() { - return new EntityIdentifiersBuilder(); - } - - public static final class EntityIdentifiersBuilder { - - private String id; - - private String scheme; - - private String value; - - private Operation operation; - - private String standard; - - private EntityIdentifiersBuilder() {} - - public EntityIdentifiersBuilder id(String value) { - this.id = value; - return this; - } - - public EntityIdentifiersBuilder scheme(String value) { - this.scheme = value; - return this; - } - - public EntityIdentifiersBuilder value(String value) { - this.value = value; - return this; - } - - public EntityIdentifiersBuilder operation(Operation value) { - this.operation = value; - return this; - } - - public EntityIdentifiersBuilder standard(String value) { - this.standard = value; - return this; - } - - public EntityIdentifiersParams build() { - return new EntityIdentifiersParams(this); - } - } - - public enum Operation { - CREATE("create"), - - UPDATE("update"), - - DELETE("delete"), - - /** An enum member indicating that Operation was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Operation(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Operation fromString(String value) { - if (value == null) return _UNKNOWN; - for (Operation enumValue : Operation.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class TaxProvidersFieldsParams { - - private final String providerName; - - private final String fieldId; - - private final String fieldValue; - - private TaxProvidersFieldsParams(TaxProvidersFieldsBuilder builder) { - - this.providerName = builder.providerName; - - this.fieldId = builder.fieldId; - - this.fieldValue = builder.fieldValue; - } - - public String getProviderName() { - return providerName; - } - - public String getFieldId() { - return fieldId; - } - - public String getFieldValue() { - return fieldValue; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.providerName != null) { - - formData.put("provider_name", this.providerName); - } - - if (this.fieldId != null) { - - formData.put("field_id", this.fieldId); - } - - if (this.fieldValue != null) { - - formData.put("field_value", this.fieldValue); - } - - return formData; - } - - /** Create a new builder for TaxProvidersFieldsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TaxProvidersFieldsBuilder builder() { - return new TaxProvidersFieldsBuilder(); - } - - public static final class TaxProvidersFieldsBuilder { - - private String providerName; - - private String fieldId; - - private String fieldValue; - - private TaxProvidersFieldsBuilder() {} - - public TaxProvidersFieldsBuilder providerName(String value) { - this.providerName = value; - return this; - } - - public TaxProvidersFieldsBuilder fieldId(String value) { - this.fieldId = value; - return this; - } - - public TaxProvidersFieldsBuilder fieldValue(String value) { - this.fieldValue = value; - return this; - } - - public TaxProvidersFieldsParams build() { - return new TaxProvidersFieldsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/UpdateContactForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/UpdateContactForCustomerParams.java deleted file mode 100644 index 514cfa58..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/UpdateContactForCustomerParams.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UpdateContactForCustomerParams { - - private final ContactParams contact; - - private final Map consentFields; - - private UpdateContactForCustomerParams(UpdateContactForCustomerBuilder builder) { - - this.contact = builder.contact; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public ContactParams getContact() { - return contact; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.contact != null) { - - // Single object - Map nestedData = this.contact.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contact[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for UpdateContactForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateContactForCustomerBuilder builder() { - return new UpdateContactForCustomerBuilder(); - } - - public static final class UpdateContactForCustomerBuilder { - - private ContactParams contact; - - private Map consentFields = new LinkedHashMap<>(); - - private UpdateContactForCustomerBuilder() {} - - public UpdateContactForCustomerBuilder contact(ContactParams value) { - this.contact = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public UpdateContactForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public UpdateContactForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public UpdateContactForCustomerBuilder consentFields(Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public UpdateContactForCustomerParams build() { - return new UpdateContactForCustomerParams(this); - } - } - - public static final class ContactParams { - - private final String id; - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String phone; - - private final String label; - - private final Boolean enabled; - - private final Boolean sendBillingEmail; - - private final Boolean sendAccountEmail; - - private ContactParams(ContactBuilder builder) { - - this.id = builder.id; - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.phone = builder.phone; - - this.label = builder.label; - - this.enabled = builder.enabled; - - this.sendBillingEmail = builder.sendBillingEmail; - - this.sendAccountEmail = builder.sendAccountEmail; - } - - public String getId() { - return id; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getPhone() { - return phone; - } - - public String getLabel() { - return label; - } - - public Boolean getEnabled() { - return enabled; - } - - public Boolean getSendBillingEmail() { - return sendBillingEmail; - } - - public Boolean getSendAccountEmail() { - return sendAccountEmail; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.label != null) { - - formData.put("label", this.label); - } - - if (this.enabled != null) { - - formData.put("enabled", this.enabled); - } - - if (this.sendBillingEmail != null) { - - formData.put("send_billing_email", this.sendBillingEmail); - } - - if (this.sendAccountEmail != null) { - - formData.put("send_account_email", this.sendAccountEmail); - } - - return formData; - } - - /** Create a new builder for ContactParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContactBuilder builder() { - return new ContactBuilder(); - } - - public static final class ContactBuilder { - - private String id; - - private String firstName; - - private String lastName; - - private String email; - - private String phone; - - private String label; - - private Boolean enabled; - - private Boolean sendBillingEmail; - - private Boolean sendAccountEmail; - - private ContactBuilder() {} - - public ContactBuilder id(String value) { - this.id = value; - return this; - } - - public ContactBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ContactBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ContactBuilder email(String value) { - this.email = value; - return this; - } - - public ContactBuilder phone(String value) { - this.phone = value; - return this; - } - - public ContactBuilder label(String value) { - this.label = value; - return this; - } - - public ContactBuilder enabled(Boolean value) { - this.enabled = value; - return this; - } - - public ContactBuilder sendBillingEmail(Boolean value) { - this.sendBillingEmail = value; - return this; - } - - public ContactBuilder sendAccountEmail(Boolean value) { - this.sendAccountEmail = value; - return this; - } - - public ContactParams build() { - return new ContactParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/UpdateHierarchySettingsForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/UpdateHierarchySettingsForCustomerParams.java deleted file mode 100644 index 073acd6b..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/UpdateHierarchySettingsForCustomerParams.java +++ /dev/null @@ -1,571 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UpdateHierarchySettingsForCustomerParams { - - private final Boolean useDefaultHierarchySettings; - - private final ParentAccountAccessParams parentAccountAccess; - - private final ChildAccountAccessParams childAccountAccess; - - private final Map consentFields; - - private UpdateHierarchySettingsForCustomerParams( - UpdateHierarchySettingsForCustomerBuilder builder) { - - this.useDefaultHierarchySettings = builder.useDefaultHierarchySettings; - - this.parentAccountAccess = builder.parentAccountAccess; - - this.childAccountAccess = builder.childAccountAccess; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public Boolean getUseDefaultHierarchySettings() { - return useDefaultHierarchySettings; - } - - public ParentAccountAccessParams getParentAccountAccess() { - return parentAccountAccess; - } - - public ChildAccountAccessParams getChildAccountAccess() { - return childAccountAccess; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.useDefaultHierarchySettings != null) { - - formData.put("use_default_hierarchy_settings", this.useDefaultHierarchySettings); - } - - if (this.parentAccountAccess != null) { - - // Single object - Map nestedData = this.parentAccountAccess.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "parent_account_access[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.childAccountAccess != null) { - - // Single object - Map nestedData = this.childAccountAccess.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "child_account_access[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for UpdateHierarchySettingsForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateHierarchySettingsForCustomerBuilder builder() { - return new UpdateHierarchySettingsForCustomerBuilder(); - } - - public static final class UpdateHierarchySettingsForCustomerBuilder { - - private Boolean useDefaultHierarchySettings; - - private ParentAccountAccessParams parentAccountAccess; - - private ChildAccountAccessParams childAccountAccess; - - private Map consentFields = new LinkedHashMap<>(); - - private UpdateHierarchySettingsForCustomerBuilder() {} - - public UpdateHierarchySettingsForCustomerBuilder useDefaultHierarchySettings(Boolean value) { - this.useDefaultHierarchySettings = value; - return this; - } - - public UpdateHierarchySettingsForCustomerBuilder parentAccountAccess( - ParentAccountAccessParams value) { - this.parentAccountAccess = value; - return this; - } - - public UpdateHierarchySettingsForCustomerBuilder childAccountAccess( - ChildAccountAccessParams value) { - this.childAccountAccess = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public UpdateHierarchySettingsForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public UpdateHierarchySettingsForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public UpdateHierarchySettingsForCustomerBuilder consentFields( - Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public UpdateHierarchySettingsForCustomerParams build() { - return new UpdateHierarchySettingsForCustomerParams(this); - } - } - - public static final class ParentAccountAccessParams { - - private final PortalEditChildSubscriptions portalEditChildSubscriptions; - - private final PortalDownloadChildInvoices portalDownloadChildInvoices; - - private final Boolean sendSubscriptionEmails; - - private final Boolean sendPaymentEmails; - - private final Boolean sendInvoiceEmails; - - private ParentAccountAccessParams(ParentAccountAccessBuilder builder) { - - this.portalEditChildSubscriptions = builder.portalEditChildSubscriptions; - - this.portalDownloadChildInvoices = builder.portalDownloadChildInvoices; - - this.sendSubscriptionEmails = builder.sendSubscriptionEmails; - - this.sendPaymentEmails = builder.sendPaymentEmails; - - this.sendInvoiceEmails = builder.sendInvoiceEmails; - } - - public PortalEditChildSubscriptions getPortalEditChildSubscriptions() { - return portalEditChildSubscriptions; - } - - public PortalDownloadChildInvoices getPortalDownloadChildInvoices() { - return portalDownloadChildInvoices; - } - - public Boolean getSendSubscriptionEmails() { - return sendSubscriptionEmails; - } - - public Boolean getSendPaymentEmails() { - return sendPaymentEmails; - } - - public Boolean getSendInvoiceEmails() { - return sendInvoiceEmails; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.portalEditChildSubscriptions != null) { - - formData.put("portal_edit_child_subscriptions", this.portalEditChildSubscriptions); - } - - if (this.portalDownloadChildInvoices != null) { - - formData.put("portal_download_child_invoices", this.portalDownloadChildInvoices); - } - - if (this.sendSubscriptionEmails != null) { - - formData.put("send_subscription_emails", this.sendSubscriptionEmails); - } - - if (this.sendPaymentEmails != null) { - - formData.put("send_payment_emails", this.sendPaymentEmails); - } - - if (this.sendInvoiceEmails != null) { - - formData.put("send_invoice_emails", this.sendInvoiceEmails); - } - - return formData; - } - - /** Create a new builder for ParentAccountAccessParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ParentAccountAccessBuilder builder() { - return new ParentAccountAccessBuilder(); - } - - public static final class ParentAccountAccessBuilder { - - private PortalEditChildSubscriptions portalEditChildSubscriptions; - - private PortalDownloadChildInvoices portalDownloadChildInvoices; - - private Boolean sendSubscriptionEmails; - - private Boolean sendPaymentEmails; - - private Boolean sendInvoiceEmails; - - private ParentAccountAccessBuilder() {} - - public ParentAccountAccessBuilder portalEditChildSubscriptions( - PortalEditChildSubscriptions value) { - this.portalEditChildSubscriptions = value; - return this; - } - - public ParentAccountAccessBuilder portalDownloadChildInvoices( - PortalDownloadChildInvoices value) { - this.portalDownloadChildInvoices = value; - return this; - } - - public ParentAccountAccessBuilder sendSubscriptionEmails(Boolean value) { - this.sendSubscriptionEmails = value; - return this; - } - - public ParentAccountAccessBuilder sendPaymentEmails(Boolean value) { - this.sendPaymentEmails = value; - return this; - } - - public ParentAccountAccessBuilder sendInvoiceEmails(Boolean value) { - this.sendInvoiceEmails = value; - return this; - } - - public ParentAccountAccessParams build() { - return new ParentAccountAccessParams(this); - } - } - - public enum PortalEditChildSubscriptions { - YES("yes"), - - VIEW_ONLY("view_only"), - - NO("no"), - - /** - * An enum member indicating that PortalEditChildSubscriptions was instantiated with an - * unknown value. - */ - _UNKNOWN(null); - private final String value; - - PortalEditChildSubscriptions(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PortalEditChildSubscriptions fromString(String value) { - if (value == null) return _UNKNOWN; - for (PortalEditChildSubscriptions enumValue : PortalEditChildSubscriptions.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PortalDownloadChildInvoices { - YES("yes"), - - VIEW_ONLY("view_only"), - - NO("no"), - - /** - * An enum member indicating that PortalDownloadChildInvoices was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - PortalDownloadChildInvoices(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PortalDownloadChildInvoices fromString(String value) { - if (value == null) return _UNKNOWN; - for (PortalDownloadChildInvoices enumValue : PortalDownloadChildInvoices.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ChildAccountAccessParams { - - private final PortalEditSubscriptions portalEditSubscriptions; - - private final PortalDownloadInvoices portalDownloadInvoices; - - private final Boolean sendSubscriptionEmails; - - private final Boolean sendPaymentEmails; - - private final Boolean sendInvoiceEmails; - - private ChildAccountAccessParams(ChildAccountAccessBuilder builder) { - - this.portalEditSubscriptions = builder.portalEditSubscriptions; - - this.portalDownloadInvoices = builder.portalDownloadInvoices; - - this.sendSubscriptionEmails = builder.sendSubscriptionEmails; - - this.sendPaymentEmails = builder.sendPaymentEmails; - - this.sendInvoiceEmails = builder.sendInvoiceEmails; - } - - public PortalEditSubscriptions getPortalEditSubscriptions() { - return portalEditSubscriptions; - } - - public PortalDownloadInvoices getPortalDownloadInvoices() { - return portalDownloadInvoices; - } - - public Boolean getSendSubscriptionEmails() { - return sendSubscriptionEmails; - } - - public Boolean getSendPaymentEmails() { - return sendPaymentEmails; - } - - public Boolean getSendInvoiceEmails() { - return sendInvoiceEmails; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.portalEditSubscriptions != null) { - - formData.put("portal_edit_subscriptions", this.portalEditSubscriptions); - } - - if (this.portalDownloadInvoices != null) { - - formData.put("portal_download_invoices", this.portalDownloadInvoices); - } - - if (this.sendSubscriptionEmails != null) { - - formData.put("send_subscription_emails", this.sendSubscriptionEmails); - } - - if (this.sendPaymentEmails != null) { - - formData.put("send_payment_emails", this.sendPaymentEmails); - } - - if (this.sendInvoiceEmails != null) { - - formData.put("send_invoice_emails", this.sendInvoiceEmails); - } - - return formData; - } - - /** Create a new builder for ChildAccountAccessParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ChildAccountAccessBuilder builder() { - return new ChildAccountAccessBuilder(); - } - - public static final class ChildAccountAccessBuilder { - - private PortalEditSubscriptions portalEditSubscriptions; - - private PortalDownloadInvoices portalDownloadInvoices; - - private Boolean sendSubscriptionEmails; - - private Boolean sendPaymentEmails; - - private Boolean sendInvoiceEmails; - - private ChildAccountAccessBuilder() {} - - public ChildAccountAccessBuilder portalEditSubscriptions(PortalEditSubscriptions value) { - this.portalEditSubscriptions = value; - return this; - } - - public ChildAccountAccessBuilder portalDownloadInvoices(PortalDownloadInvoices value) { - this.portalDownloadInvoices = value; - return this; - } - - public ChildAccountAccessBuilder sendSubscriptionEmails(Boolean value) { - this.sendSubscriptionEmails = value; - return this; - } - - public ChildAccountAccessBuilder sendPaymentEmails(Boolean value) { - this.sendPaymentEmails = value; - return this; - } - - public ChildAccountAccessBuilder sendInvoiceEmails(Boolean value) { - this.sendInvoiceEmails = value; - return this; - } - - public ChildAccountAccessParams build() { - return new ChildAccountAccessParams(this); - } - } - - public enum PortalEditSubscriptions { - YES("yes"), - - VIEW_ONLY("view_only"), - - /** - * An enum member indicating that PortalEditSubscriptions was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - PortalEditSubscriptions(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PortalEditSubscriptions fromString(String value) { - if (value == null) return _UNKNOWN; - for (PortalEditSubscriptions enumValue : PortalEditSubscriptions.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PortalDownloadInvoices { - YES("yes"), - - VIEW_ONLY("view_only"), - - NO("no"), - - /** - * An enum member indicating that PortalDownloadInvoices was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - PortalDownloadInvoices(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PortalDownloadInvoices fromString(String value) { - if (value == null) return _UNKNOWN; - for (PortalDownloadInvoices enumValue : PortalDownloadInvoices.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/params/UpdatePaymentMethodForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customer/params/UpdatePaymentMethodForCustomerParams.java deleted file mode 100644 index 3f54ed29..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/params/UpdatePaymentMethodForCustomerParams.java +++ /dev/null @@ -1,520 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.customer.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UpdatePaymentMethodForCustomerParams { - - private final PaymentMethodParams paymentMethod; - - private final Map consentFields; - - private UpdatePaymentMethodForCustomerParams(UpdatePaymentMethodForCustomerBuilder builder) { - - this.paymentMethod = builder.paymentMethod; - - this.consentFields = - builder.consentFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.consentFields)); - } - - public PaymentMethodParams getPaymentMethod() { - return paymentMethod; - } - - public Map consentFields() { - return consentFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.paymentMethod != null) { - - // Single object - Map nestedData = this.paymentMethod.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "payment_method[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - formData.putAll(consentFields); - - return formData; - } - - /** Create a new builder for UpdatePaymentMethodForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdatePaymentMethodForCustomerBuilder builder() { - return new UpdatePaymentMethodForCustomerBuilder(); - } - - public static final class UpdatePaymentMethodForCustomerBuilder { - - private PaymentMethodParams paymentMethod; - - private Map consentFields = new LinkedHashMap<>(); - - private UpdatePaymentMethodForCustomerBuilder() {} - - public UpdatePaymentMethodForCustomerBuilder paymentMethod(PaymentMethodParams value) { - this.paymentMethod = value; - return this; - } - - /** - * Add a consent field to the request. Consent fields must start with "cs_". Consent fields - * typically hold boolean values or options. - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the value of the consent field (typically Boolean or String for options) - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public UpdatePaymentMethodForCustomerBuilder consentField(String fieldName, Object value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add a boolean consent field to the request. Consent fields must start with "cs_". - * - * @param fieldName the name of the consent field (e.g., "cs_marketing_consent") - * @param value the boolean value of the consent field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cs_" - */ - public UpdatePaymentMethodForCustomerBuilder consentField(String fieldName, Boolean value) { - if (fieldName == null || !fieldName.startsWith("cs_")) { - throw new IllegalArgumentException("Consent field name must start with 'cs_'"); - } - this.consentFields.put(fieldName, value); - return this; - } - - /** - * Add multiple consent fields to the request. All field names must start with "cs_". - * - * @param consentFields map of consent field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cs_" - */ - public UpdatePaymentMethodForCustomerBuilder consentFields(Map consentFields) { - if (consentFields != null) { - for (Map.Entry entry : consentFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cs_")) { - throw new IllegalArgumentException( - "Consent field name must start with 'cs_': " + entry.getKey()); - } - this.consentFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public UpdatePaymentMethodForCustomerParams build() { - return new UpdatePaymentMethodForCustomerParams(this); - } - } - - public static final class PaymentMethodParams { - - private final Type type; - - private final Gateway gateway; - - private final String gatewayAccountId; - - private final String referenceId; - - private final String tmpToken; - - private final String issuingCountry; - - private final java.util.Map additionalInformation; - - private PaymentMethodParams(PaymentMethodBuilder builder) { - - this.type = builder.type; - - this.gateway = builder.gateway; - - this.gatewayAccountId = builder.gatewayAccountId; - - this.referenceId = builder.referenceId; - - this.tmpToken = builder.tmpToken; - - this.issuingCountry = builder.issuingCountry; - - this.additionalInformation = builder.additionalInformation; - } - - public Type getType() { - return type; - } - - public Gateway getGateway() { - return gateway; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getReferenceId() { - return referenceId; - } - - public String getTmpToken() { - return tmpToken; - } - - public String getIssuingCountry() { - return issuingCountry; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.type != null) { - - formData.put("type", this.type); - } - - if (this.gateway != null) { - - formData.put("gateway", this.gateway); - } - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.referenceId != null) { - - formData.put("reference_id", this.referenceId); - } - - if (this.tmpToken != null) { - - formData.put("tmp_token", this.tmpToken); - } - - if (this.issuingCountry != null) { - - formData.put("issuing_country", this.issuingCountry); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for PaymentMethodParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PaymentMethodBuilder builder() { - return new PaymentMethodBuilder(); - } - - public static final class PaymentMethodBuilder { - - private Type type; - - private Gateway gateway; - - private String gatewayAccountId; - - private String referenceId; - - private String tmpToken; - - private String issuingCountry; - - private java.util.Map additionalInformation; - - private PaymentMethodBuilder() {} - - public PaymentMethodBuilder type(Type value) { - this.type = value; - return this; - } - - @Deprecated - public PaymentMethodBuilder gateway(Gateway value) { - this.gateway = value; - return this; - } - - public PaymentMethodBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public PaymentMethodBuilder referenceId(String value) { - this.referenceId = value; - return this; - } - - public PaymentMethodBuilder tmpToken(String value) { - this.tmpToken = value; - return this; - } - - public PaymentMethodBuilder issuingCountry(String value) { - this.issuingCountry = value; - return this; - } - - public PaymentMethodBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public PaymentMethodParams build() { - return new PaymentMethodParams(this); - } - } - - public enum Type { - CARD("card"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - AMAZON_PAYMENTS("amazon_payments"), - - DIRECT_DEBIT("direct_debit"), - - GENERIC("generic"), - - ALIPAY("alipay"), - - UNIONPAY("unionpay"), - - WECHAT_PAY("wechat_pay"), - - IDEAL("ideal"), - - GOOGLE_PAY("google_pay"), - - SOFORT("sofort"), - - BANCONTACT("bancontact"), - - GIROPAY("giropay"), - - DOTPAY("dotpay"), - - UPI("upi"), - - NETBANKING_EMANDATES("netbanking_emandates"), - - VENMO("venmo"), - - PAY_TO("pay_to"), - - FASTER_PAYMENTS("faster_payments"), - - SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), - - AUTOMATED_BANK_TRANSFER("automated_bank_transfer"), - - KLARNA_PAY_NOW("klarna_pay_now"), - - ONLINE_BANKING_POLAND("online_banking_poland"), - - PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), - - ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), - - KBC_PAYMENT_BUTTON("kbc_payment_button"), - - PAY_BY_BANK("pay_by_bank"), - - TRUSTLY("trustly"), - - STABLECOIN("stablecoin"), - - /** An enum member indicating that Type was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Type(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Type fromString(String value) { - if (value == null) return _UNKNOWN; - for (Type enumValue : Type.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum Gateway { - CHARGEBEE_PAYMENTS("chargebee_payments"), - - ADYEN("adyen"), - - STRIPE("stripe"), - - WEPAY("wepay"), - - BRAINTREE("braintree"), - - AUTHORIZE_NET("authorize_net"), - - PAYPAL_PRO("paypal_pro"), - - PIN("pin"), - - EWAY("eway"), - - EWAY_RAPID("eway_rapid"), - - WORLDPAY("worldpay"), - - BALANCED_PAYMENTS("balanced_payments"), - - BEANSTREAM("beanstream"), - - BLUEPAY("bluepay"), - - ELAVON("elavon"), - - FIRST_DATA_GLOBAL("first_data_global"), - - HDFC("hdfc"), - - MIGS("migs"), - - NMI("nmi"), - - OGONE("ogone"), - - PAYMILL("paymill"), - - PAYPAL_PAYFLOW_PRO("paypal_payflow_pro"), - - SAGE_PAY("sage_pay"), - - TCO("tco"), - - WIRECARD("wirecard"), - - AMAZON_PAYMENTS("amazon_payments"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - GOCARDLESS("gocardless"), - - ORBITAL("orbital"), - - MONERIS_US("moneris_us"), - - MONERIS("moneris"), - - BLUESNAP("bluesnap"), - - CYBERSOURCE("cybersource"), - - VANTIV("vantiv"), - - CHECKOUT_COM("checkout_com"), - - PAYPAL("paypal"), - - INGENICO_DIRECT("ingenico_direct"), - - EXACT("exact"), - - MOLLIE("mollie"), - - QUICKBOOKS("quickbooks"), - - RAZORPAY("razorpay"), - - GLOBAL_PAYMENTS("global_payments"), - - BANK_OF_AMERICA("bank_of_america"), - - ECENTRIC("ecentric"), - - METRICS_GLOBAL("metrics_global"), - - WINDCAVE("windcave"), - - PAY_COM("pay_com"), - - EBANX("ebanx"), - - DLOCAL("dlocal"), - - NUVEI("nuvei"), - - SOLIDGATE("solidgate"), - - PAYSTACK("paystack"), - - JP_MORGAN("jp_morgan"), - - DEUTSCHE_BANK("deutsche_bank"), - - EZIDEBIT("ezidebit"), - - /** An enum member indicating that Gateway was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Gateway(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Gateway fromString(String value) { - if (value == null) return _UNKNOWN; - for (Gateway enumValue : Gateway.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/AddContactForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/AddContactForCustomerResponse.java deleted file mode 100644 index f54c60dc..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/AddContactForCustomerResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddContactForCustomer operation. Contains the response data from - * the API. - */ -public final class AddContactForCustomerResponse extends BaseResponse { - private final Customer customer; - - private final Card card; - - private AddContactForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into AddContactForCustomerResponse object. */ - public static AddContactForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddContactForCustomerResponse object with HTTP response. */ - public static AddContactForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddContactForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for AddContactForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddContactForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddContactForCustomerResponse build() { - return new AddContactForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/AddPromotionalCreditsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/AddPromotionalCreditsForCustomerResponse.java deleted file mode 100644 index bc796d1a..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/AddPromotionalCreditsForCustomerResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddPromotionalCreditsForCustomer operation. Contains the response - * data from the API. - */ -public final class AddPromotionalCreditsForCustomerResponse extends BaseResponse { - private final Customer customer; - - private AddPromotionalCreditsForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - } - - /** Parse JSON response into AddPromotionalCreditsForCustomerResponse object. */ - public static AddPromotionalCreditsForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into AddPromotionalCreditsForCustomerResponse object with HTTP response. - */ - public static AddPromotionalCreditsForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse AddPromotionalCreditsForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for AddPromotionalCreditsForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddPromotionalCreditsForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddPromotionalCreditsForCustomerResponse build() { - return new AddPromotionalCreditsForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/AssignPaymentRoleForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/AssignPaymentRoleForCustomerResponse.java deleted file mode 100644 index 422c056c..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/AssignPaymentRoleForCustomerResponse.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.paymentSource.PaymentSource; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AssignPaymentRoleForCustomer operation. Contains the response data - * from the API. - */ -public final class AssignPaymentRoleForCustomerResponse extends BaseResponse { - private final Customer customer; - - private final PaymentSource paymentSource; - - private AssignPaymentRoleForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.paymentSource = builder.paymentSource; - } - - /** Parse JSON response into AssignPaymentRoleForCustomerResponse object. */ - public static AssignPaymentRoleForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AssignPaymentRoleForCustomerResponse object with HTTP response. */ - public static AssignPaymentRoleForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); - if (__paymentSourceJson != null) { - builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse AssignPaymentRoleForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for AssignPaymentRoleForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AssignPaymentRoleForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private PaymentSource paymentSource; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder paymentSource(PaymentSource paymentSource) { - this.paymentSource = paymentSource; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AssignPaymentRoleForCustomerResponse build() { - return new AssignPaymentRoleForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the paymentSource from the response. */ - public PaymentSource getPaymentSource() { - return paymentSource; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/ChangeBillingDateForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/ChangeBillingDateForCustomerResponse.java deleted file mode 100644 index b8a9d655..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/ChangeBillingDateForCustomerResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ChangeBillingDateForCustomer operation. Contains the response data - * from the API. - */ -public final class ChangeBillingDateForCustomerResponse extends BaseResponse { - private final Customer customer; - - private ChangeBillingDateForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - } - - /** Parse JSON response into ChangeBillingDateForCustomerResponse object. */ - public static ChangeBillingDateForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ChangeBillingDateForCustomerResponse object with HTTP response. */ - public static ChangeBillingDateForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ChangeBillingDateForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for ChangeBillingDateForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ChangeBillingDateForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ChangeBillingDateForCustomerResponse build() { - return new ChangeBillingDateForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/ClearPersonalDataForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/ClearPersonalDataForCustomerResponse.java deleted file mode 100644 index acacbb87..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/ClearPersonalDataForCustomerResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ClearPersonalDataForCustomer operation. Contains the response data - * from the API. - */ -public final class ClearPersonalDataForCustomerResponse extends BaseResponse { - private final Customer customer; - - private ClearPersonalDataForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - } - - /** Parse JSON response into ClearPersonalDataForCustomerResponse object. */ - public static ClearPersonalDataForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ClearPersonalDataForCustomerResponse object with HTTP response. */ - public static ClearPersonalDataForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ClearPersonalDataForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for ClearPersonalDataForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ClearPersonalDataForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ClearPersonalDataForCustomerResponse build() { - return new ClearPersonalDataForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CollectPaymentForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CollectPaymentForCustomerResponse.java deleted file mode 100644 index 1995c28b..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/CollectPaymentForCustomerResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CollectPaymentForCustomer operation. Contains the response data - * from the API. - */ -public final class CollectPaymentForCustomerResponse extends BaseResponse { - private final Customer customer; - - private final Transaction transaction; - - private CollectPaymentForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.transaction = builder.transaction; - } - - /** Parse JSON response into CollectPaymentForCustomerResponse object. */ - public static CollectPaymentForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into CollectPaymentForCustomerResponse object with HTTP response. */ - public static CollectPaymentForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse CollectPaymentForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for CollectPaymentForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CollectPaymentForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CollectPaymentForCustomerResponse build() { - return new CollectPaymentForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/ContactsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/ContactsForCustomerResponse.java index 478cbce0..f0d282f4 100644 --- a/src/main/java/com/chargebee/v4/models/customer/responses/ContactsForCustomerResponse.java +++ b/src/main/java/com/chargebee/v4/models/customer/responses/ContactsForCustomerResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.contact.Contact; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.CustomerService; @@ -105,9 +106,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public ContactsForCustomerResponse nextPage() throws Exception { + public ContactsForCustomerResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerAddContactResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerAddContactResponse.java new file mode 100644 index 00000000..2c13b611 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerAddContactResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerAddContact operation. Contains the response data from the + * API. + */ +public final class CustomerAddContactResponse extends BaseResponse { + private final Customer customer; + + private final Card card; + + private CustomerAddContactResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into CustomerAddContactResponse object. */ + public static CustomerAddContactResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerAddContactResponse object with HTTP response. */ + public static CustomerAddContactResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerAddContactResponse from JSON", e); + } + } + + /** Create a new builder for CustomerAddContactResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerAddContactResponse. */ + public static class Builder { + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerAddContactResponse build() { + return new CustomerAddContactResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerAddPromotionalCreditsResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerAddPromotionalCreditsResponse.java new file mode 100644 index 00000000..ab762ae4 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerAddPromotionalCreditsResponse.java @@ -0,0 +1,78 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerAddPromotionalCredits operation. Contains the response data + * from the API. + */ +public final class CustomerAddPromotionalCreditsResponse extends BaseResponse { + private final Customer customer; + + private CustomerAddPromotionalCreditsResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + } + + /** Parse JSON response into CustomerAddPromotionalCreditsResponse object. */ + public static CustomerAddPromotionalCreditsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerAddPromotionalCreditsResponse object with HTTP response. */ + public static CustomerAddPromotionalCreditsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CustomerAddPromotionalCreditsResponse from JSON", e); + } + } + + /** Create a new builder for CustomerAddPromotionalCreditsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerAddPromotionalCreditsResponse. */ + public static class Builder { + + private Customer customer; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerAddPromotionalCreditsResponse build() { + return new CustomerAddPromotionalCreditsResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerAssignPaymentRoleResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerAssignPaymentRoleResponse.java new file mode 100644 index 00000000..63b50568 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerAssignPaymentRoleResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.paymentSource.PaymentSource; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerAssignPaymentRole operation. Contains the response data + * from the API. + */ +public final class CustomerAssignPaymentRoleResponse extends BaseResponse { + private final Customer customer; + + private final PaymentSource paymentSource; + + private CustomerAssignPaymentRoleResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.paymentSource = builder.paymentSource; + } + + /** Parse JSON response into CustomerAssignPaymentRoleResponse object. */ + public static CustomerAssignPaymentRoleResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerAssignPaymentRoleResponse object with HTTP response. */ + public static CustomerAssignPaymentRoleResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); + if (__paymentSourceJson != null) { + builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerAssignPaymentRoleResponse from JSON", e); + } + } + + /** Create a new builder for CustomerAssignPaymentRoleResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerAssignPaymentRoleResponse. */ + public static class Builder { + + private Customer customer; + + private PaymentSource paymentSource; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder paymentSource(PaymentSource paymentSource) { + this.paymentSource = paymentSource; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerAssignPaymentRoleResponse build() { + return new CustomerAssignPaymentRoleResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the paymentSource from the response. */ + public PaymentSource getPaymentSource() { + return paymentSource; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerChangeBillingDateResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerChangeBillingDateResponse.java new file mode 100644 index 00000000..6460c434 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerChangeBillingDateResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerChangeBillingDate operation. Contains the response data + * from the API. + */ +public final class CustomerChangeBillingDateResponse extends BaseResponse { + private final Customer customer; + + private CustomerChangeBillingDateResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + } + + /** Parse JSON response into CustomerChangeBillingDateResponse object. */ + public static CustomerChangeBillingDateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerChangeBillingDateResponse object with HTTP response. */ + public static CustomerChangeBillingDateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerChangeBillingDateResponse from JSON", e); + } + } + + /** Create a new builder for CustomerChangeBillingDateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerChangeBillingDateResponse. */ + public static class Builder { + + private Customer customer; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerChangeBillingDateResponse build() { + return new CustomerChangeBillingDateResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerClearPersonalDataResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerClearPersonalDataResponse.java new file mode 100644 index 00000000..47a928b5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerClearPersonalDataResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerClearPersonalData operation. Contains the response data + * from the API. + */ +public final class CustomerClearPersonalDataResponse extends BaseResponse { + private final Customer customer; + + private CustomerClearPersonalDataResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + } + + /** Parse JSON response into CustomerClearPersonalDataResponse object. */ + public static CustomerClearPersonalDataResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerClearPersonalDataResponse object with HTTP response. */ + public static CustomerClearPersonalDataResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerClearPersonalDataResponse from JSON", e); + } + } + + /** Create a new builder for CustomerClearPersonalDataResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerClearPersonalDataResponse. */ + public static class Builder { + + private Customer customer; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerClearPersonalDataResponse build() { + return new CustomerClearPersonalDataResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerCollectPaymentResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerCollectPaymentResponse.java new file mode 100644 index 00000000..5fa81417 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerCollectPaymentResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerCollectPayment operation. Contains the response data from + * the API. + */ +public final class CustomerCollectPaymentResponse extends BaseResponse { + private final Customer customer; + + private final Transaction transaction; + + private CustomerCollectPaymentResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.transaction = builder.transaction; + } + + /** Parse JSON response into CustomerCollectPaymentResponse object. */ + public static CustomerCollectPaymentResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerCollectPaymentResponse object with HTTP response. */ + public static CustomerCollectPaymentResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerCollectPaymentResponse from JSON", e); + } + } + + /** Create a new builder for CustomerCollectPaymentResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerCollectPaymentResponse. */ + public static class Builder { + + private Customer customer; + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerCollectPaymentResponse build() { + return new CustomerCollectPaymentResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeductPromotionalCreditsResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeductPromotionalCreditsResponse.java new file mode 100644 index 00000000..1ef3e629 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeductPromotionalCreditsResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerDeductPromotionalCredits operation. Contains the response + * data from the API. + */ +public final class CustomerDeductPromotionalCreditsResponse extends BaseResponse { + private final Customer customer; + + private CustomerDeductPromotionalCreditsResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + } + + /** Parse JSON response into CustomerDeductPromotionalCreditsResponse object. */ + public static CustomerDeductPromotionalCreditsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into CustomerDeductPromotionalCreditsResponse object with HTTP response. + */ + public static CustomerDeductPromotionalCreditsResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CustomerDeductPromotionalCreditsResponse from JSON", e); + } + } + + /** Create a new builder for CustomerDeductPromotionalCreditsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerDeductPromotionalCreditsResponse. */ + public static class Builder { + + private Customer customer; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerDeductPromotionalCreditsResponse build() { + return new CustomerDeductPromotionalCreditsResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeleteContactResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeleteContactResponse.java new file mode 100644 index 00000000..a2583241 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeleteContactResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerDeleteContact operation. Contains the response data from + * the API. + */ +public final class CustomerDeleteContactResponse extends BaseResponse { + private final Customer customer; + + private final Card card; + + private CustomerDeleteContactResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into CustomerDeleteContactResponse object. */ + public static CustomerDeleteContactResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerDeleteContactResponse object with HTTP response. */ + public static CustomerDeleteContactResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerDeleteContactResponse from JSON", e); + } + } + + /** Create a new builder for CustomerDeleteContactResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerDeleteContactResponse. */ + public static class Builder { + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerDeleteContactResponse build() { + return new CustomerDeleteContactResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeleteRelationshipResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeleteRelationshipResponse.java new file mode 100644 index 00000000..7ad797b6 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeleteRelationshipResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerDeleteRelationship operation. Contains the response data + * from the API. + */ +public final class CustomerDeleteRelationshipResponse extends BaseResponse { + private final Customer customer; + + private CustomerDeleteRelationshipResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + } + + /** Parse JSON response into CustomerDeleteRelationshipResponse object. */ + public static CustomerDeleteRelationshipResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerDeleteRelationshipResponse object with HTTP response. */ + public static CustomerDeleteRelationshipResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerDeleteRelationshipResponse from JSON", e); + } + } + + /** Create a new builder for CustomerDeleteRelationshipResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerDeleteRelationshipResponse. */ + public static class Builder { + + private Customer customer; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerDeleteRelationshipResponse build() { + return new CustomerDeleteRelationshipResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeleteResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeleteResponse.java new file mode 100644 index 00000000..f46369d7 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerDeleteResponse.java @@ -0,0 +1,99 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerDelete operation. Contains the response data from the API. + */ +public final class CustomerDeleteResponse extends BaseResponse { + private final Customer customer; + + private final Card card; + + private CustomerDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into CustomerDeleteResponse object. */ + public static CustomerDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerDeleteResponse object with HTTP response. */ + public static CustomerDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerDeleteResponse from JSON", e); + } + } + + /** Create a new builder for CustomerDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerDeleteResponse. */ + public static class Builder { + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerDeleteResponse build() { + return new CustomerDeleteResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerHierarchyResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerHierarchyResponse.java new file mode 100644 index 00000000..ff9a6d5e --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerHierarchyResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.hierarchy.Hierarchy; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import java.util.List; + +/** + * Immutable response object for CustomerHierarchy operation. Contains the response data from a + * single resource get operation. + */ +public final class CustomerHierarchyResponse extends BaseResponse { + private final List hierarchies; + + private CustomerHierarchyResponse(Builder builder) { + super(builder.httpResponse); + + this.hierarchies = builder.hierarchies; + } + + /** Parse JSON response into CustomerHierarchyResponse object. */ + public static CustomerHierarchyResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerHierarchyResponse object with HTTP response. */ + public static CustomerHierarchyResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __hierarchiesJson = JsonUtil.getArray(json, "hierarchies"); + if (__hierarchiesJson != null) { + builder.hierarchies( + JsonUtil.parseObjectArray(__hierarchiesJson).stream() + .map(Hierarchy::fromJson) + .collect(java.util.stream.Collectors.toList())); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerHierarchyResponse from JSON", e); + } + } + + /** Create a new builder for CustomerHierarchyResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerHierarchyResponse. */ + public static class Builder { + + private List hierarchies; + + private Response httpResponse; + + private Builder() {} + + public Builder hierarchies(List hierarchies) { + this.hierarchies = hierarchies; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerHierarchyResponse build() { + return new CustomerHierarchyResponse(this); + } + } + + /** Get the hierarchies from the response. */ + public List getHierarchies() { + return hierarchies; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerListHierarchyDetailResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerListHierarchyDetailResponse.java new file mode 100644 index 00000000..1f953bc8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerListHierarchyDetailResponse.java @@ -0,0 +1,179 @@ +package com.chargebee.v4.models.customer.responses; + +import java.util.List; + +import com.chargebee.v4.models.hierarchy.Hierarchy; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.CustomerService; +import com.chargebee.v4.models.customer.params.CustomerListHierarchyDetailParams; + +/** + * Immutable response object for CustomerListHierarchyDetail operation. Contains paginated list + * data. + */ +public final class CustomerListHierarchyDetailResponse { + + private final List list; + + private final String nextOffset; + + private final String customerId; + + private final CustomerService service; + private final CustomerListHierarchyDetailParams originalParams; + private final Response httpResponse; + + private CustomerListHierarchyDetailResponse( + List list, + String nextOffset, + String customerId, + CustomerService service, + CustomerListHierarchyDetailParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.customerId = customerId; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into CustomerListHierarchyDetailResponse object (no service context). Use + * this when you only need to read a single page (no nextPage()). + */ + public static CustomerListHierarchyDetailResponse fromJson(String json) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(CustomerListHierarchyDetailItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new CustomerListHierarchyDetailResponse(list, nextOffset, null, null, null, null); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CustomerListHierarchyDetailResponse from JSON", e); + } + } + + /** + * Parse JSON response into CustomerListHierarchyDetailResponse object with service context for + * pagination (enables nextPage()). + */ + public static CustomerListHierarchyDetailResponse fromJson( + String json, + CustomerService service, + CustomerListHierarchyDetailParams originalParams, + String customerId, + Response httpResponse) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(CustomerListHierarchyDetailItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new CustomerListHierarchyDetailResponse( + list, nextOffset, customerId, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CustomerListHierarchyDetailResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public CustomerListHierarchyDetailResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + CustomerListHierarchyDetailParams nextParams = + (originalParams != null + ? originalParams.toBuilder() + : CustomerListHierarchyDetailParams.builder()) + .offset(nextOffset) + .build(); + + return service.listHierarchyDetail(customerId, nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + public static class CustomerListHierarchyDetailItem { + + private Hierarchy hierarchy; + + public Hierarchy getHierarchy() { + return hierarchy; + } + + public static CustomerListHierarchyDetailItem fromJson(String json) { + CustomerListHierarchyDetailItem item = new CustomerListHierarchyDetailItem(); + + String __hierarchyJson = JsonUtil.getObject(json, "hierarchy"); + if (__hierarchyJson != null) { + item.hierarchy = Hierarchy.fromJson(__hierarchyJson); + } + + return item; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerListResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerListResponse.java index b69bd2d2..69293dff 100644 --- a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerListResponse.java +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerListResponse.java @@ -6,6 +6,7 @@ import com.chargebee.v4.models.card.Card; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.CustomerService; @@ -100,9 +101,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public CustomerListResponse nextPage() throws Exception { + public CustomerListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerRecordExcessPaymentResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerRecordExcessPaymentResponse.java new file mode 100644 index 00000000..9f291599 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerRecordExcessPaymentResponse.java @@ -0,0 +1,101 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerRecordExcessPayment operation. Contains the response data + * from the API. + */ +public final class CustomerRecordExcessPaymentResponse extends BaseResponse { + private final Customer customer; + + private final Transaction transaction; + + private CustomerRecordExcessPaymentResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.transaction = builder.transaction; + } + + /** Parse JSON response into CustomerRecordExcessPaymentResponse object. */ + public static CustomerRecordExcessPaymentResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerRecordExcessPaymentResponse object with HTTP response. */ + public static CustomerRecordExcessPaymentResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CustomerRecordExcessPaymentResponse from JSON", e); + } + } + + /** Create a new builder for CustomerRecordExcessPaymentResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerRecordExcessPaymentResponse. */ + public static class Builder { + + private Customer customer; + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerRecordExcessPaymentResponse build() { + return new CustomerRecordExcessPaymentResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerRelationshipsResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerRelationshipsResponse.java new file mode 100644 index 00000000..d8b8bf2f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerRelationshipsResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerRelationships operation. Contains the response data from + * the API. + */ +public final class CustomerRelationshipsResponse extends BaseResponse { + private final Customer customer; + + private CustomerRelationshipsResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + } + + /** Parse JSON response into CustomerRelationshipsResponse object. */ + public static CustomerRelationshipsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerRelationshipsResponse object with HTTP response. */ + public static CustomerRelationshipsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerRelationshipsResponse from JSON", e); + } + } + + /** Create a new builder for CustomerRelationshipsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerRelationshipsResponse. */ + public static class Builder { + + private Customer customer; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerRelationshipsResponse build() { + return new CustomerRelationshipsResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerSetPromotionalCreditsResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerSetPromotionalCreditsResponse.java new file mode 100644 index 00000000..92aef8a3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerSetPromotionalCreditsResponse.java @@ -0,0 +1,78 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerSetPromotionalCredits operation. Contains the response data + * from the API. + */ +public final class CustomerSetPromotionalCreditsResponse extends BaseResponse { + private final Customer customer; + + private CustomerSetPromotionalCreditsResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + } + + /** Parse JSON response into CustomerSetPromotionalCreditsResponse object. */ + public static CustomerSetPromotionalCreditsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerSetPromotionalCreditsResponse object with HTTP response. */ + public static CustomerSetPromotionalCreditsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CustomerSetPromotionalCreditsResponse from JSON", e); + } + } + + /** Create a new builder for CustomerSetPromotionalCreditsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerSetPromotionalCreditsResponse. */ + public static class Builder { + + private Customer customer; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerSetPromotionalCreditsResponse build() { + return new CustomerSetPromotionalCreditsResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdateBillingInfoResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdateBillingInfoResponse.java new file mode 100644 index 00000000..bbff2076 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdateBillingInfoResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerUpdateBillingInfo operation. Contains the response data + * from the API. + */ +public final class CustomerUpdateBillingInfoResponse extends BaseResponse { + private final Customer customer; + + private final Card card; + + private CustomerUpdateBillingInfoResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into CustomerUpdateBillingInfoResponse object. */ + public static CustomerUpdateBillingInfoResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerUpdateBillingInfoResponse object with HTTP response. */ + public static CustomerUpdateBillingInfoResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerUpdateBillingInfoResponse from JSON", e); + } + } + + /** Create a new builder for CustomerUpdateBillingInfoResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerUpdateBillingInfoResponse. */ + public static class Builder { + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerUpdateBillingInfoResponse build() { + return new CustomerUpdateBillingInfoResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdateContactResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdateContactResponse.java new file mode 100644 index 00000000..067307ac --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdateContactResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerUpdateContact operation. Contains the response data from + * the API. + */ +public final class CustomerUpdateContactResponse extends BaseResponse { + private final Customer customer; + + private final Card card; + + private CustomerUpdateContactResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into CustomerUpdateContactResponse object. */ + public static CustomerUpdateContactResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerUpdateContactResponse object with HTTP response. */ + public static CustomerUpdateContactResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CustomerUpdateContactResponse from JSON", e); + } + } + + /** Create a new builder for CustomerUpdateContactResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerUpdateContactResponse. */ + public static class Builder { + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerUpdateContactResponse build() { + return new CustomerUpdateContactResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdateHierarchySettingsResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdateHierarchySettingsResponse.java new file mode 100644 index 00000000..ac33b828 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdateHierarchySettingsResponse.java @@ -0,0 +1,79 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerUpdateHierarchySettings operation. Contains the response + * data from the API. + */ +public final class CustomerUpdateHierarchySettingsResponse extends BaseResponse { + private final Customer customer; + + private CustomerUpdateHierarchySettingsResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + } + + /** Parse JSON response into CustomerUpdateHierarchySettingsResponse object. */ + public static CustomerUpdateHierarchySettingsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerUpdateHierarchySettingsResponse object with HTTP response. */ + public static CustomerUpdateHierarchySettingsResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CustomerUpdateHierarchySettingsResponse from JSON", e); + } + } + + /** Create a new builder for CustomerUpdateHierarchySettingsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerUpdateHierarchySettingsResponse. */ + public static class Builder { + + private Customer customer; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerUpdateHierarchySettingsResponse build() { + return new CustomerUpdateHierarchySettingsResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdatePaymentMethodResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdatePaymentMethodResponse.java new file mode 100644 index 00000000..6e44d899 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customer/responses/CustomerUpdatePaymentMethodResponse.java @@ -0,0 +1,101 @@ +package com.chargebee.v4.models.customer.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CustomerUpdatePaymentMethod operation. Contains the response data + * from the API. + */ +public final class CustomerUpdatePaymentMethodResponse extends BaseResponse { + private final Customer customer; + + private final Card card; + + private CustomerUpdatePaymentMethodResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into CustomerUpdatePaymentMethodResponse object. */ + public static CustomerUpdatePaymentMethodResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CustomerUpdatePaymentMethodResponse object with HTTP response. */ + public static CustomerUpdatePaymentMethodResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CustomerUpdatePaymentMethodResponse from JSON", e); + } + } + + /** Create a new builder for CustomerUpdatePaymentMethodResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CustomerUpdatePaymentMethodResponse. */ + public static class Builder { + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CustomerUpdatePaymentMethodResponse build() { + return new CustomerUpdatePaymentMethodResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/DeductPromotionalCreditsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/DeductPromotionalCreditsForCustomerResponse.java deleted file mode 100644 index ae6192ae..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/DeductPromotionalCreditsForCustomerResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeductPromotionalCreditsForCustomer operation. Contains the - * response data from the API. - */ -public final class DeductPromotionalCreditsForCustomerResponse extends BaseResponse { - private final Customer customer; - - private DeductPromotionalCreditsForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - } - - /** Parse JSON response into DeductPromotionalCreditsForCustomerResponse object. */ - public static DeductPromotionalCreditsForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into DeductPromotionalCreditsForCustomerResponse object with HTTP response. - */ - public static DeductPromotionalCreditsForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse DeductPromotionalCreditsForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for DeductPromotionalCreditsForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeductPromotionalCreditsForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeductPromotionalCreditsForCustomerResponse build() { - return new DeductPromotionalCreditsForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/DeleteContactForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/DeleteContactForCustomerResponse.java deleted file mode 100644 index 0055b573..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/DeleteContactForCustomerResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteContactForCustomer operation. Contains the response data from - * the API. - */ -public final class DeleteContactForCustomerResponse extends BaseResponse { - private final Customer customer; - - private final Card card; - - private DeleteContactForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into DeleteContactForCustomerResponse object. */ - public static DeleteContactForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteContactForCustomerResponse object with HTTP response. */ - public static DeleteContactForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteContactForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for DeleteContactForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteContactForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteContactForCustomerResponse build() { - return new DeleteContactForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/DeleteCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/DeleteCustomerResponse.java deleted file mode 100644 index 1810010b..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/DeleteCustomerResponse.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteCustomer operation. Contains the response data from the API. - */ -public final class DeleteCustomerResponse extends BaseResponse { - private final Customer customer; - - private final Card card; - - private DeleteCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into DeleteCustomerResponse object. */ - public static DeleteCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteCustomerResponse object with HTTP response. */ - public static DeleteCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteCustomerResponse from JSON", e); - } - } - - /** Create a new builder for DeleteCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteCustomerResponse build() { - return new DeleteCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/DeleteRelationshipForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/DeleteRelationshipForCustomerResponse.java deleted file mode 100644 index f49de9df..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/DeleteRelationshipForCustomerResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteRelationshipForCustomer operation. Contains the response data - * from the API. - */ -public final class DeleteRelationshipForCustomerResponse extends BaseResponse { - private final Customer customer; - - private DeleteRelationshipForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - } - - /** Parse JSON response into DeleteRelationshipForCustomerResponse object. */ - public static DeleteRelationshipForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteRelationshipForCustomerResponse object with HTTP response. */ - public static DeleteRelationshipForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse DeleteRelationshipForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for DeleteRelationshipForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteRelationshipForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteRelationshipForCustomerResponse build() { - return new DeleteRelationshipForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/HierarchyDetailForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/HierarchyDetailForCustomerResponse.java deleted file mode 100644 index ff44c478..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/HierarchyDetailForCustomerResponse.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import java.util.List; - -import com.chargebee.v4.models.hierarchy.Hierarchy; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.CustomerService; -import com.chargebee.v4.models.customer.params.HierarchyDetailForCustomerParams; - -/** - * Immutable response object for HierarchyDetailForCustomer operation. Contains paginated list data. - */ -public final class HierarchyDetailForCustomerResponse { - - private final List list; - - private final String nextOffset; - - private final String customerId; - - private final CustomerService service; - private final HierarchyDetailForCustomerParams originalParams; - private final Response httpResponse; - - private HierarchyDetailForCustomerResponse( - List list, - String nextOffset, - String customerId, - CustomerService service, - HierarchyDetailForCustomerParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.customerId = customerId; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into HierarchyDetailForCustomerResponse object (no service context). Use - * this when you only need to read a single page (no nextPage()). - */ - public static HierarchyDetailForCustomerResponse fromJson(String json) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(CustomerHierarchyDetailForCustomerItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new HierarchyDetailForCustomerResponse(list, nextOffset, null, null, null, null); - } catch (Exception e) { - throw new RuntimeException("Failed to parse HierarchyDetailForCustomerResponse from JSON", e); - } - } - - /** - * Parse JSON response into HierarchyDetailForCustomerResponse object with service context for - * pagination (enables nextPage()). - */ - public static HierarchyDetailForCustomerResponse fromJson( - String json, - CustomerService service, - HierarchyDetailForCustomerParams originalParams, - String customerId, - Response httpResponse) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(CustomerHierarchyDetailForCustomerItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new HierarchyDetailForCustomerResponse( - list, nextOffset, customerId, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException("Failed to parse HierarchyDetailForCustomerResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public HierarchyDetailForCustomerResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - HierarchyDetailForCustomerParams nextParams = - (originalParams != null - ? originalParams.toBuilder() - : HierarchyDetailForCustomerParams.builder()) - .offset(nextOffset) - .build(); - - return service.hierarchyDetailForCustomer(customerId, nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } - - public static class CustomerHierarchyDetailForCustomerItem { - - private Hierarchy hierarchy; - - public Hierarchy getHierarchy() { - return hierarchy; - } - - public static CustomerHierarchyDetailForCustomerItem fromJson(String json) { - CustomerHierarchyDetailForCustomerItem item = new CustomerHierarchyDetailForCustomerItem(); - - String __hierarchyJson = JsonUtil.getObject(json, "hierarchy"); - if (__hierarchyJson != null) { - item.hierarchy = Hierarchy.fromJson(__hierarchyJson); - } - - return item; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/HierarchyForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/HierarchyForCustomerResponse.java deleted file mode 100644 index 26b761ca..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/HierarchyForCustomerResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.hierarchy.Hierarchy; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import java.util.List; - -/** - * Immutable response object for HierarchyForCustomer operation. Contains the response data from a - * single resource get operation. - */ -public final class HierarchyForCustomerResponse extends BaseResponse { - private final List hierarchies; - - private HierarchyForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.hierarchies = builder.hierarchies; - } - - /** Parse JSON response into HierarchyForCustomerResponse object. */ - public static HierarchyForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into HierarchyForCustomerResponse object with HTTP response. */ - public static HierarchyForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __hierarchiesJson = JsonUtil.getArray(json, "hierarchies"); - if (__hierarchiesJson != null) { - builder.hierarchies( - JsonUtil.parseObjectArray(__hierarchiesJson).stream() - .map(Hierarchy::fromJson) - .collect(java.util.stream.Collectors.toList())); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse HierarchyForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for HierarchyForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for HierarchyForCustomerResponse. */ - public static class Builder { - - private List hierarchies; - - private Response httpResponse; - - private Builder() {} - - public Builder hierarchies(List hierarchies) { - this.hierarchies = hierarchies; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public HierarchyForCustomerResponse build() { - return new HierarchyForCustomerResponse(this); - } - } - - /** Get the hierarchies from the response. */ - public List getHierarchies() { - return hierarchies; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/RecordExcessPaymentForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/RecordExcessPaymentForCustomerResponse.java deleted file mode 100644 index 16f4bd92..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/RecordExcessPaymentForCustomerResponse.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RecordExcessPaymentForCustomer operation. Contains the response - * data from the API. - */ -public final class RecordExcessPaymentForCustomerResponse extends BaseResponse { - private final Customer customer; - - private final Transaction transaction; - - private RecordExcessPaymentForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.transaction = builder.transaction; - } - - /** Parse JSON response into RecordExcessPaymentForCustomerResponse object. */ - public static RecordExcessPaymentForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RecordExcessPaymentForCustomerResponse object with HTTP response. */ - public static RecordExcessPaymentForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RecordExcessPaymentForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for RecordExcessPaymentForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RecordExcessPaymentForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RecordExcessPaymentForCustomerResponse build() { - return new RecordExcessPaymentForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/RelationshipsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/RelationshipsForCustomerResponse.java deleted file mode 100644 index b5e508e2..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/RelationshipsForCustomerResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RelationshipsForCustomer operation. Contains the response data from - * the API. - */ -public final class RelationshipsForCustomerResponse extends BaseResponse { - private final Customer customer; - - private RelationshipsForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - } - - /** Parse JSON response into RelationshipsForCustomerResponse object. */ - public static RelationshipsForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RelationshipsForCustomerResponse object with HTTP response. */ - public static RelationshipsForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RelationshipsForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for RelationshipsForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RelationshipsForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RelationshipsForCustomerResponse build() { - return new RelationshipsForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/SetPromotionalCreditsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/SetPromotionalCreditsForCustomerResponse.java deleted file mode 100644 index 4cd154c8..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/SetPromotionalCreditsForCustomerResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for SetPromotionalCreditsForCustomer operation. Contains the response - * data from the API. - */ -public final class SetPromotionalCreditsForCustomerResponse extends BaseResponse { - private final Customer customer; - - private SetPromotionalCreditsForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - } - - /** Parse JSON response into SetPromotionalCreditsForCustomerResponse object. */ - public static SetPromotionalCreditsForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into SetPromotionalCreditsForCustomerResponse object with HTTP response. - */ - public static SetPromotionalCreditsForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse SetPromotionalCreditsForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for SetPromotionalCreditsForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for SetPromotionalCreditsForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public SetPromotionalCreditsForCustomerResponse build() { - return new SetPromotionalCreditsForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/UpdateBillingInfoForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/UpdateBillingInfoForCustomerResponse.java deleted file mode 100644 index e303ce6d..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/UpdateBillingInfoForCustomerResponse.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateBillingInfoForCustomer operation. Contains the response data - * from the API. - */ -public final class UpdateBillingInfoForCustomerResponse extends BaseResponse { - private final Customer customer; - - private final Card card; - - private UpdateBillingInfoForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into UpdateBillingInfoForCustomerResponse object. */ - public static UpdateBillingInfoForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdateBillingInfoForCustomerResponse object with HTTP response. */ - public static UpdateBillingInfoForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse UpdateBillingInfoForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for UpdateBillingInfoForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateBillingInfoForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateBillingInfoForCustomerResponse build() { - return new UpdateBillingInfoForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/UpdateContactForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/UpdateContactForCustomerResponse.java deleted file mode 100644 index 2c39e142..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/UpdateContactForCustomerResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateContactForCustomer operation. Contains the response data from - * the API. - */ -public final class UpdateContactForCustomerResponse extends BaseResponse { - private final Customer customer; - - private final Card card; - - private UpdateContactForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into UpdateContactForCustomerResponse object. */ - public static UpdateContactForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdateContactForCustomerResponse object with HTTP response. */ - public static UpdateContactForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UpdateContactForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for UpdateContactForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateContactForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateContactForCustomerResponse build() { - return new UpdateContactForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/UpdateHierarchySettingsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/UpdateHierarchySettingsForCustomerResponse.java deleted file mode 100644 index 59bd32d8..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/UpdateHierarchySettingsForCustomerResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateHierarchySettingsForCustomer operation. Contains the response - * data from the API. - */ -public final class UpdateHierarchySettingsForCustomerResponse extends BaseResponse { - private final Customer customer; - - private UpdateHierarchySettingsForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - } - - /** Parse JSON response into UpdateHierarchySettingsForCustomerResponse object. */ - public static UpdateHierarchySettingsForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into UpdateHierarchySettingsForCustomerResponse object with HTTP response. - */ - public static UpdateHierarchySettingsForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse UpdateHierarchySettingsForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for UpdateHierarchySettingsForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateHierarchySettingsForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateHierarchySettingsForCustomerResponse build() { - return new UpdateHierarchySettingsForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customer/responses/UpdatePaymentMethodForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customer/responses/UpdatePaymentMethodForCustomerResponse.java deleted file mode 100644 index befeb0ba..00000000 --- a/src/main/java/com/chargebee/v4/models/customer/responses/UpdatePaymentMethodForCustomerResponse.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.chargebee.v4.models.customer.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdatePaymentMethodForCustomer operation. Contains the response - * data from the API. - */ -public final class UpdatePaymentMethodForCustomerResponse extends BaseResponse { - private final Customer customer; - - private final Card card; - - private UpdatePaymentMethodForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into UpdatePaymentMethodForCustomerResponse object. */ - public static UpdatePaymentMethodForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdatePaymentMethodForCustomerResponse object with HTTP response. */ - public static UpdatePaymentMethodForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse UpdatePaymentMethodForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for UpdatePaymentMethodForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdatePaymentMethodForCustomerResponse. */ - public static class Builder { - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdatePaymentMethodForCustomerResponse build() { - return new UpdatePaymentMethodForCustomerResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/customerEntitlement/params/CustomerEntitlementEntitlementsForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customerEntitlement/params/CustomerEntitlementEntitlementsForCustomerParams.java new file mode 100644 index 00000000..9adbbeae --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customerEntitlement/params/CustomerEntitlementEntitlementsForCustomerParams.java @@ -0,0 +1,68 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.customerEntitlement.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CustomerEntitlementEntitlementsForCustomerParams { + + private final Map queryParams; + + private CustomerEntitlementEntitlementsForCustomerParams( + CustomerEntitlementEntitlementsForCustomerBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public CustomerEntitlementEntitlementsForCustomerBuilder toBuilder() { + CustomerEntitlementEntitlementsForCustomerBuilder builder = + new CustomerEntitlementEntitlementsForCustomerBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for CustomerEntitlementEntitlementsForCustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerEntitlementEntitlementsForCustomerBuilder builder() { + return new CustomerEntitlementEntitlementsForCustomerBuilder(); + } + + public static final class CustomerEntitlementEntitlementsForCustomerBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private CustomerEntitlementEntitlementsForCustomerBuilder() {} + + public CustomerEntitlementEntitlementsForCustomerBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public CustomerEntitlementEntitlementsForCustomerBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + public CustomerEntitlementEntitlementsForCustomerBuilder consolidateEntitlements( + Boolean value) { + queryParams.put("consolidate_entitlements", value); + return this; + } + + public CustomerEntitlementEntitlementsForCustomerParams build() { + return new CustomerEntitlementEntitlementsForCustomerParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customerEntitlement/params/CustomerEntitlementsForCustomerParams.java b/src/main/java/com/chargebee/v4/models/customerEntitlement/params/CustomerEntitlementsForCustomerParams.java deleted file mode 100644 index 0646d20f..00000000 --- a/src/main/java/com/chargebee/v4/models/customerEntitlement/params/CustomerEntitlementsForCustomerParams.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.customerEntitlement.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class CustomerEntitlementsForCustomerParams { - - private final Map queryParams; - - private CustomerEntitlementsForCustomerParams(CustomerEntitlementsForCustomerBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public CustomerEntitlementsForCustomerBuilder toBuilder() { - CustomerEntitlementsForCustomerBuilder builder = new CustomerEntitlementsForCustomerBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for CustomerEntitlementsForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CustomerEntitlementsForCustomerBuilder builder() { - return new CustomerEntitlementsForCustomerBuilder(); - } - - public static final class CustomerEntitlementsForCustomerBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private CustomerEntitlementsForCustomerBuilder() {} - - public CustomerEntitlementsForCustomerBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public CustomerEntitlementsForCustomerBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - public CustomerEntitlementsForCustomerBuilder consolidateEntitlements(Boolean value) { - queryParams.put("consolidate_entitlements", value); - return this; - } - - public CustomerEntitlementsForCustomerParams build() { - return new CustomerEntitlementsForCustomerParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/customerEntitlement/responses/CustomerEntitlementEntitlementsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customerEntitlement/responses/CustomerEntitlementEntitlementsForCustomerResponse.java new file mode 100644 index 00000000..edebfd41 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/customerEntitlement/responses/CustomerEntitlementEntitlementsForCustomerResponse.java @@ -0,0 +1,181 @@ +package com.chargebee.v4.models.customerEntitlement.responses; + +import java.util.List; + +import com.chargebee.v4.models.customerEntitlement.CustomerEntitlement; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.CustomerEntitlementService; +import com.chargebee.v4.models.customerEntitlement.params.CustomerEntitlementEntitlementsForCustomerParams; + +/** + * Immutable response object for CustomerEntitlementEntitlementsForCustomer operation. Contains + * paginated list data. + */ +public final class CustomerEntitlementEntitlementsForCustomerResponse { + + private final List list; + + private final String nextOffset; + + private final String customerId; + + private final CustomerEntitlementService service; + private final CustomerEntitlementEntitlementsForCustomerParams originalParams; + private final Response httpResponse; + + private CustomerEntitlementEntitlementsForCustomerResponse( + List list, + String nextOffset, + String customerId, + CustomerEntitlementService service, + CustomerEntitlementEntitlementsForCustomerParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.customerId = customerId; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into CustomerEntitlementEntitlementsForCustomerResponse object (no service + * context). Use this when you only need to read a single page (no nextPage()). + */ + public static CustomerEntitlementEntitlementsForCustomerResponse fromJson(String json) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(CustomerEntitlementEntitlementsForCustomerItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new CustomerEntitlementEntitlementsForCustomerResponse( + list, nextOffset, null, null, null, null); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CustomerEntitlementEntitlementsForCustomerResponse from JSON", e); + } + } + + /** + * Parse JSON response into CustomerEntitlementEntitlementsForCustomerResponse object with service + * context for pagination (enables nextPage()). + */ + public static CustomerEntitlementEntitlementsForCustomerResponse fromJson( + String json, + CustomerEntitlementService service, + CustomerEntitlementEntitlementsForCustomerParams originalParams, + String customerId, + Response httpResponse) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(CustomerEntitlementEntitlementsForCustomerItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new CustomerEntitlementEntitlementsForCustomerResponse( + list, nextOffset, customerId, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CustomerEntitlementEntitlementsForCustomerResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public CustomerEntitlementEntitlementsForCustomerResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + CustomerEntitlementEntitlementsForCustomerParams nextParams = + (originalParams != null + ? originalParams.toBuilder() + : CustomerEntitlementEntitlementsForCustomerParams.builder()) + .offset(nextOffset) + .build(); + + return service.entitlementsForCustomer(customerId, nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + public static class CustomerEntitlementEntitlementsForCustomerItem { + + private CustomerEntitlement customerEntitlement; + + public CustomerEntitlement getCustomerEntitlement() { + return customerEntitlement; + } + + public static CustomerEntitlementEntitlementsForCustomerItem fromJson(String json) { + CustomerEntitlementEntitlementsForCustomerItem item = + new CustomerEntitlementEntitlementsForCustomerItem(); + + String __customerEntitlementJson = JsonUtil.getObject(json, "customer_entitlement"); + if (__customerEntitlementJson != null) { + item.customerEntitlement = CustomerEntitlement.fromJson(__customerEntitlementJson); + } + + return item; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/customerEntitlement/responses/CustomerEntitlementsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/customerEntitlement/responses/CustomerEntitlementsForCustomerResponse.java deleted file mode 100644 index 908ad937..00000000 --- a/src/main/java/com/chargebee/v4/models/customerEntitlement/responses/CustomerEntitlementsForCustomerResponse.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.chargebee.v4.models.customerEntitlement.responses; - -import java.util.List; - -import com.chargebee.v4.models.customerEntitlement.CustomerEntitlement; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.CustomerEntitlementService; -import com.chargebee.v4.models.customerEntitlement.params.CustomerEntitlementsForCustomerParams; - -/** - * Immutable response object for CustomerEntitlementsForCustomer operation. Contains paginated list - * data. - */ -public final class CustomerEntitlementsForCustomerResponse { - - private final List list; - - private final String nextOffset; - - private final String customerId; - - private final CustomerEntitlementService service; - private final CustomerEntitlementsForCustomerParams originalParams; - private final Response httpResponse; - - private CustomerEntitlementsForCustomerResponse( - List list, - String nextOffset, - String customerId, - CustomerEntitlementService service, - CustomerEntitlementsForCustomerParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.customerId = customerId; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into CustomerEntitlementsForCustomerResponse object (no service context). - * Use this when you only need to read a single page (no nextPage()). - */ - public static CustomerEntitlementsForCustomerResponse fromJson(String json) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(CustomerEntitlementCustomerEntitlementsForCustomerItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new CustomerEntitlementsForCustomerResponse(list, nextOffset, null, null, null, null); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse CustomerEntitlementsForCustomerResponse from JSON", e); - } - } - - /** - * Parse JSON response into CustomerEntitlementsForCustomerResponse object with service context - * for pagination (enables nextPage()). - */ - public static CustomerEntitlementsForCustomerResponse fromJson( - String json, - CustomerEntitlementService service, - CustomerEntitlementsForCustomerParams originalParams, - String customerId, - Response httpResponse) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(CustomerEntitlementCustomerEntitlementsForCustomerItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new CustomerEntitlementsForCustomerResponse( - list, nextOffset, customerId, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse CustomerEntitlementsForCustomerResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public CustomerEntitlementsForCustomerResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - CustomerEntitlementsForCustomerParams nextParams = - (originalParams != null - ? originalParams.toBuilder() - : CustomerEntitlementsForCustomerParams.builder()) - .offset(nextOffset) - .build(); - - return service.customerEntitlementsForCustomer(customerId, nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } - - public static class CustomerEntitlementCustomerEntitlementsForCustomerItem { - - private CustomerEntitlement customerEntitlement; - - public CustomerEntitlement getCustomerEntitlement() { - return customerEntitlement; - } - - public static CustomerEntitlementCustomerEntitlementsForCustomerItem fromJson(String json) { - CustomerEntitlementCustomerEntitlementsForCustomerItem item = - new CustomerEntitlementCustomerEntitlementsForCustomerItem(); - - String __customerEntitlementJson = JsonUtil.getObject(json, "customer_entitlement"); - if (__customerEntitlementJson != null) { - item.customerEntitlement = CustomerEntitlement.fromJson(__customerEntitlementJson); - } - - return item; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/differentialPrice/params/AddDifferentialPriceForItemPriceParams.java b/src/main/java/com/chargebee/v4/models/differentialPrice/params/AddDifferentialPriceForItemPriceParams.java deleted file mode 100644 index 9806045c..00000000 --- a/src/main/java/com/chargebee/v4/models/differentialPrice/params/AddDifferentialPriceForItemPriceParams.java +++ /dev/null @@ -1,500 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.differentialPrice.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class AddDifferentialPriceForItemPriceParams { - - private final String parentItemId; - - private final Long price; - - private final String priceInDecimal; - - private final String businessEntityId; - - private final List parentPeriods; - - private final List tiers; - - private AddDifferentialPriceForItemPriceParams(AddDifferentialPriceForItemPriceBuilder builder) { - - this.parentItemId = builder.parentItemId; - - this.price = builder.price; - - this.priceInDecimal = builder.priceInDecimal; - - this.businessEntityId = builder.businessEntityId; - - this.parentPeriods = builder.parentPeriods; - - this.tiers = builder.tiers; - } - - public String getParentItemId() { - return parentItemId; - } - - public Long getPrice() { - return price; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public String getBusinessEntityId() { - return businessEntityId; - } - - public List getParentPeriods() { - return parentPeriods; - } - - public List getTiers() { - return tiers; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.parentItemId != null) { - - formData.put("parent_item_id", this.parentItemId); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.businessEntityId != null) { - - formData.put("business_entity_id", this.businessEntityId); - } - - if (this.parentPeriods != null) { - - // List of objects - for (int i = 0; i < this.parentPeriods.size(); i++) { - ParentPeriodsParams item = this.parentPeriods.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "parent_periods[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.tiers != null) { - - // List of objects - for (int i = 0; i < this.tiers.size(); i++) { - TiersParams item = this.tiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for AddDifferentialPriceForItemPriceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddDifferentialPriceForItemPriceBuilder builder() { - return new AddDifferentialPriceForItemPriceBuilder(); - } - - public static final class AddDifferentialPriceForItemPriceBuilder { - - private String parentItemId; - - private Long price; - - private String priceInDecimal; - - private String businessEntityId; - - private List parentPeriods; - - private List tiers; - - private AddDifferentialPriceForItemPriceBuilder() {} - - public AddDifferentialPriceForItemPriceBuilder parentItemId(String value) { - this.parentItemId = value; - return this; - } - - public AddDifferentialPriceForItemPriceBuilder price(Long value) { - this.price = value; - return this; - } - - public AddDifferentialPriceForItemPriceBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public AddDifferentialPriceForItemPriceBuilder businessEntityId(String value) { - this.businessEntityId = value; - return this; - } - - public AddDifferentialPriceForItemPriceBuilder parentPeriods(List value) { - this.parentPeriods = value; - return this; - } - - public AddDifferentialPriceForItemPriceBuilder tiers(List value) { - this.tiers = value; - return this; - } - - public AddDifferentialPriceForItemPriceParams build() { - return new AddDifferentialPriceForItemPriceParams(this); - } - } - - public static final class ParentPeriodsParams { - - private final PeriodUnit periodUnit; - - private final List period; - - private ParentPeriodsParams(ParentPeriodsBuilder builder) { - - this.periodUnit = builder.periodUnit; - - this.period = builder.period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public List getPeriod() { - return period; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.period != null) { - - formData.put("period", JsonUtil.toJson(this.period)); - } - - return formData; - } - - /** Create a new builder for ParentPeriodsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ParentPeriodsBuilder builder() { - return new ParentPeriodsBuilder(); - } - - public static final class ParentPeriodsBuilder { - - private PeriodUnit periodUnit; - - private List period; - - private ParentPeriodsBuilder() {} - - public ParentPeriodsBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public ParentPeriodsBuilder period(List value) { - this.period = value; - return this; - } - - public ParentPeriodsParams build() { - return new ParentPeriodsParams(this); - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class TiersParams { - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private TiersParams(TiersBuilder builder) { - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - return formData; - } - - /** Create a new builder for TiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TiersBuilder builder() { - return new TiersBuilder(); - } - - public static final class TiersBuilder { - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private TiersBuilder() {} - - public TiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public TiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public TiersBuilder price(Long value) { - this.price = value; - return this; - } - - public TiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public TiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public TiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public TiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public TiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public TiersParams build() { - return new TiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/differentialPrice/params/DeleteDifferentialPriceParams.java b/src/main/java/com/chargebee/v4/models/differentialPrice/params/DeleteDifferentialPriceParams.java deleted file mode 100644 index 29159ab5..00000000 --- a/src/main/java/com/chargebee/v4/models/differentialPrice/params/DeleteDifferentialPriceParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.differentialPrice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteDifferentialPriceParams { - - private final String itemPriceId; - - private DeleteDifferentialPriceParams(DeleteDifferentialPriceBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - } - - public String getItemPriceId() { - return itemPriceId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - return formData; - } - - /** Create a new builder for DeleteDifferentialPriceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteDifferentialPriceBuilder builder() { - return new DeleteDifferentialPriceBuilder(); - } - - public static final class DeleteDifferentialPriceBuilder { - - private String itemPriceId; - - private DeleteDifferentialPriceBuilder() {} - - public DeleteDifferentialPriceBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DeleteDifferentialPriceParams build() { - return new DeleteDifferentialPriceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/differentialPrice/params/DifferentialPriceCreateParams.java b/src/main/java/com/chargebee/v4/models/differentialPrice/params/DifferentialPriceCreateParams.java new file mode 100644 index 00000000..66443ade --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/differentialPrice/params/DifferentialPriceCreateParams.java @@ -0,0 +1,500 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.differentialPrice.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class DifferentialPriceCreateParams { + + private final String parentItemId; + + private final Long price; + + private final String priceInDecimal; + + private final String businessEntityId; + + private final List parentPeriods; + + private final List tiers; + + private DifferentialPriceCreateParams(DifferentialPriceCreateBuilder builder) { + + this.parentItemId = builder.parentItemId; + + this.price = builder.price; + + this.priceInDecimal = builder.priceInDecimal; + + this.businessEntityId = builder.businessEntityId; + + this.parentPeriods = builder.parentPeriods; + + this.tiers = builder.tiers; + } + + public String getParentItemId() { + return parentItemId; + } + + public Long getPrice() { + return price; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public String getBusinessEntityId() { + return businessEntityId; + } + + public List getParentPeriods() { + return parentPeriods; + } + + public List getTiers() { + return tiers; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.parentItemId != null) { + + formData.put("parent_item_id", this.parentItemId); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.businessEntityId != null) { + + formData.put("business_entity_id", this.businessEntityId); + } + + if (this.parentPeriods != null) { + + // List of objects + for (int i = 0; i < this.parentPeriods.size(); i++) { + ParentPeriodsParams item = this.parentPeriods.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "parent_periods[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.tiers != null) { + + // List of objects + for (int i = 0; i < this.tiers.size(); i++) { + TiersParams item = this.tiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for DifferentialPriceCreateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DifferentialPriceCreateBuilder builder() { + return new DifferentialPriceCreateBuilder(); + } + + public static final class DifferentialPriceCreateBuilder { + + private String parentItemId; + + private Long price; + + private String priceInDecimal; + + private String businessEntityId; + + private List parentPeriods; + + private List tiers; + + private DifferentialPriceCreateBuilder() {} + + public DifferentialPriceCreateBuilder parentItemId(String value) { + this.parentItemId = value; + return this; + } + + public DifferentialPriceCreateBuilder price(Long value) { + this.price = value; + return this; + } + + public DifferentialPriceCreateBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public DifferentialPriceCreateBuilder businessEntityId(String value) { + this.businessEntityId = value; + return this; + } + + public DifferentialPriceCreateBuilder parentPeriods(List value) { + this.parentPeriods = value; + return this; + } + + public DifferentialPriceCreateBuilder tiers(List value) { + this.tiers = value; + return this; + } + + public DifferentialPriceCreateParams build() { + return new DifferentialPriceCreateParams(this); + } + } + + public static final class ParentPeriodsParams { + + private final PeriodUnit periodUnit; + + private final List period; + + private ParentPeriodsParams(ParentPeriodsBuilder builder) { + + this.periodUnit = builder.periodUnit; + + this.period = builder.period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public List getPeriod() { + return period; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.period != null) { + + formData.put("period", JsonUtil.toJson(this.period)); + } + + return formData; + } + + /** Create a new builder for ParentPeriodsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ParentPeriodsBuilder builder() { + return new ParentPeriodsBuilder(); + } + + public static final class ParentPeriodsBuilder { + + private PeriodUnit periodUnit; + + private List period; + + private ParentPeriodsBuilder() {} + + public ParentPeriodsBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public ParentPeriodsBuilder period(List value) { + this.period = value; + return this; + } + + public ParentPeriodsParams build() { + return new ParentPeriodsParams(this); + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class TiersParams { + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private TiersParams(TiersBuilder builder) { + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + return formData; + } + + /** Create a new builder for TiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TiersBuilder builder() { + return new TiersBuilder(); + } + + public static final class TiersBuilder { + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private TiersBuilder() {} + + public TiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public TiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public TiersBuilder price(Long value) { + this.price = value; + return this; + } + + public TiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public TiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public TiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public TiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public TiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public TiersParams build() { + return new TiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/differentialPrice/params/DifferentialPriceDeleteParams.java b/src/main/java/com/chargebee/v4/models/differentialPrice/params/DifferentialPriceDeleteParams.java new file mode 100644 index 00000000..79110767 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/differentialPrice/params/DifferentialPriceDeleteParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.differentialPrice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class DifferentialPriceDeleteParams { + + private final String itemPriceId; + + private DifferentialPriceDeleteParams(DifferentialPriceDeleteBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + } + + public String getItemPriceId() { + return itemPriceId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + return formData; + } + + /** Create a new builder for DifferentialPriceDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DifferentialPriceDeleteBuilder builder() { + return new DifferentialPriceDeleteBuilder(); + } + + public static final class DifferentialPriceDeleteBuilder { + + private String itemPriceId; + + private DifferentialPriceDeleteBuilder() {} + + public DifferentialPriceDeleteBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DifferentialPriceDeleteParams build() { + return new DifferentialPriceDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/differentialPrice/responses/AddDifferentialPriceForItemPriceResponse.java b/src/main/java/com/chargebee/v4/models/differentialPrice/responses/AddDifferentialPriceForItemPriceResponse.java deleted file mode 100644 index c15f7b9b..00000000 --- a/src/main/java/com/chargebee/v4/models/differentialPrice/responses/AddDifferentialPriceForItemPriceResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.differentialPrice.responses; - -import com.chargebee.v4.models.differentialPrice.DifferentialPrice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddDifferentialPriceForItemPrice operation. Contains the response - * data from the API. - */ -public final class AddDifferentialPriceForItemPriceResponse extends BaseResponse { - private final DifferentialPrice differentialPrice; - - private AddDifferentialPriceForItemPriceResponse(Builder builder) { - super(builder.httpResponse); - - this.differentialPrice = builder.differentialPrice; - } - - /** Parse JSON response into AddDifferentialPriceForItemPriceResponse object. */ - public static AddDifferentialPriceForItemPriceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into AddDifferentialPriceForItemPriceResponse object with HTTP response. - */ - public static AddDifferentialPriceForItemPriceResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __differentialPriceJson = JsonUtil.getObject(json, "differential_price"); - if (__differentialPriceJson != null) { - builder.differentialPrice(DifferentialPrice.fromJson(__differentialPriceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse AddDifferentialPriceForItemPriceResponse from JSON", e); - } - } - - /** Create a new builder for AddDifferentialPriceForItemPriceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddDifferentialPriceForItemPriceResponse. */ - public static class Builder { - - private DifferentialPrice differentialPrice; - - private Response httpResponse; - - private Builder() {} - - public Builder differentialPrice(DifferentialPrice differentialPrice) { - this.differentialPrice = differentialPrice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddDifferentialPriceForItemPriceResponse build() { - return new AddDifferentialPriceForItemPriceResponse(this); - } - } - - /** Get the differentialPrice from the response. */ - public DifferentialPrice getDifferentialPrice() { - return differentialPrice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DeleteDifferentialPriceResponse.java b/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DeleteDifferentialPriceResponse.java deleted file mode 100644 index 4f57b936..00000000 --- a/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DeleteDifferentialPriceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.differentialPrice.responses; - -import com.chargebee.v4.models.differentialPrice.DifferentialPrice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteDifferentialPrice operation. Contains the response data from - * the API. - */ -public final class DeleteDifferentialPriceResponse extends BaseResponse { - private final DifferentialPrice differentialPrice; - - private DeleteDifferentialPriceResponse(Builder builder) { - super(builder.httpResponse); - - this.differentialPrice = builder.differentialPrice; - } - - /** Parse JSON response into DeleteDifferentialPriceResponse object. */ - public static DeleteDifferentialPriceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteDifferentialPriceResponse object with HTTP response. */ - public static DeleteDifferentialPriceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __differentialPriceJson = JsonUtil.getObject(json, "differential_price"); - if (__differentialPriceJson != null) { - builder.differentialPrice(DifferentialPrice.fromJson(__differentialPriceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteDifferentialPriceResponse from JSON", e); - } - } - - /** Create a new builder for DeleteDifferentialPriceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteDifferentialPriceResponse. */ - public static class Builder { - - private DifferentialPrice differentialPrice; - - private Response httpResponse; - - private Builder() {} - - public Builder differentialPrice(DifferentialPrice differentialPrice) { - this.differentialPrice = differentialPrice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteDifferentialPriceResponse build() { - return new DeleteDifferentialPriceResponse(this); - } - } - - /** Get the differentialPrice from the response. */ - public DifferentialPrice getDifferentialPrice() { - return differentialPrice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DifferentialPriceCreateResponse.java b/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DifferentialPriceCreateResponse.java new file mode 100644 index 00000000..74f021d7 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DifferentialPriceCreateResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.differentialPrice.responses; + +import com.chargebee.v4.models.differentialPrice.DifferentialPrice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for DifferentialPriceCreate operation. Contains the response data from + * the API. + */ +public final class DifferentialPriceCreateResponse extends BaseResponse { + private final DifferentialPrice differentialPrice; + + private DifferentialPriceCreateResponse(Builder builder) { + super(builder.httpResponse); + + this.differentialPrice = builder.differentialPrice; + } + + /** Parse JSON response into DifferentialPriceCreateResponse object. */ + public static DifferentialPriceCreateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into DifferentialPriceCreateResponse object with HTTP response. */ + public static DifferentialPriceCreateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __differentialPriceJson = JsonUtil.getObject(json, "differential_price"); + if (__differentialPriceJson != null) { + builder.differentialPrice(DifferentialPrice.fromJson(__differentialPriceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse DifferentialPriceCreateResponse from JSON", e); + } + } + + /** Create a new builder for DifferentialPriceCreateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for DifferentialPriceCreateResponse. */ + public static class Builder { + + private DifferentialPrice differentialPrice; + + private Response httpResponse; + + private Builder() {} + + public Builder differentialPrice(DifferentialPrice differentialPrice) { + this.differentialPrice = differentialPrice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public DifferentialPriceCreateResponse build() { + return new DifferentialPriceCreateResponse(this); + } + } + + /** Get the differentialPrice from the response. */ + public DifferentialPrice getDifferentialPrice() { + return differentialPrice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DifferentialPriceDeleteResponse.java b/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DifferentialPriceDeleteResponse.java new file mode 100644 index 00000000..bc010822 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DifferentialPriceDeleteResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.differentialPrice.responses; + +import com.chargebee.v4.models.differentialPrice.DifferentialPrice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for DifferentialPriceDelete operation. Contains the response data from + * the API. + */ +public final class DifferentialPriceDeleteResponse extends BaseResponse { + private final DifferentialPrice differentialPrice; + + private DifferentialPriceDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.differentialPrice = builder.differentialPrice; + } + + /** Parse JSON response into DifferentialPriceDeleteResponse object. */ + public static DifferentialPriceDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into DifferentialPriceDeleteResponse object with HTTP response. */ + public static DifferentialPriceDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __differentialPriceJson = JsonUtil.getObject(json, "differential_price"); + if (__differentialPriceJson != null) { + builder.differentialPrice(DifferentialPrice.fromJson(__differentialPriceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse DifferentialPriceDeleteResponse from JSON", e); + } + } + + /** Create a new builder for DifferentialPriceDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for DifferentialPriceDeleteResponse. */ + public static class Builder { + + private DifferentialPrice differentialPrice; + + private Response httpResponse; + + private Builder() {} + + public Builder differentialPrice(DifferentialPrice differentialPrice) { + this.differentialPrice = differentialPrice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public DifferentialPriceDeleteResponse build() { + return new DifferentialPriceDeleteResponse(this); + } + } + + /** Get the differentialPrice from the response. */ + public DifferentialPrice getDifferentialPrice() { + return differentialPrice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DifferentialPriceListResponse.java b/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DifferentialPriceListResponse.java index e3ada878..f445a3e5 100644 --- a/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DifferentialPriceListResponse.java +++ b/src/main/java/com/chargebee/v4/models/differentialPrice/responses/DifferentialPriceListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.differentialPrice.DifferentialPrice; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.DifferentialPriceService; @@ -99,9 +100,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public DifferentialPriceListResponse nextPage() throws Exception { + public DifferentialPriceListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/entitlement/responses/EntitlementListResponse.java b/src/main/java/com/chargebee/v4/models/entitlement/responses/EntitlementListResponse.java index eb4580d3..83526389 100644 --- a/src/main/java/com/chargebee/v4/models/entitlement/responses/EntitlementListResponse.java +++ b/src/main/java/com/chargebee/v4/models/entitlement/responses/EntitlementListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.entitlement.Entitlement; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.EntitlementService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public EntitlementListResponse nextPage() throws Exception { + public EntitlementListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/entitlementOverride/params/EntitlementOverridesForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/entitlementOverride/params/EntitlementOverridesForSubscriptionParams.java deleted file mode 100644 index c32b1853..00000000 --- a/src/main/java/com/chargebee/v4/models/entitlementOverride/params/EntitlementOverridesForSubscriptionParams.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.entitlementOverride.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class EntitlementOverridesForSubscriptionParams { - - private final Map queryParams; - - private EntitlementOverridesForSubscriptionParams( - EntitlementOverridesForSubscriptionBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public EntitlementOverridesForSubscriptionBuilder toBuilder() { - EntitlementOverridesForSubscriptionBuilder builder = - new EntitlementOverridesForSubscriptionBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for EntitlementOverridesForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EntitlementOverridesForSubscriptionBuilder builder() { - return new EntitlementOverridesForSubscriptionBuilder(); - } - - public static final class EntitlementOverridesForSubscriptionBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private EntitlementOverridesForSubscriptionBuilder() {} - - public EntitlementOverridesForSubscriptionBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public EntitlementOverridesForSubscriptionBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - @Deprecated - public EntitlementOverridesForSubscriptionBuilder embed(String value) { - queryParams.put("embed", value); - return this; - } - - @Deprecated - public EntitlementOverridesForSubscriptionBuilder includeDrafts(Boolean value) { - queryParams.put("include_drafts", value); - return this; - } - - @Deprecated - public EntitlementOverridesForSubscriptionBuilder includeScheduledOverrides(Boolean value) { - queryParams.put("include_scheduled_overrides", value); - return this; - } - - public EntitlementOverridesForSubscriptionParams build() { - return new EntitlementOverridesForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/entitlementOverride/params/ListEntitlementOverrideForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/entitlementOverride/params/ListEntitlementOverrideForSubscriptionParams.java new file mode 100644 index 00000000..089593c7 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/entitlementOverride/params/ListEntitlementOverrideForSubscriptionParams.java @@ -0,0 +1,80 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.entitlementOverride.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ListEntitlementOverrideForSubscriptionParams { + + private final Map queryParams; + + private ListEntitlementOverrideForSubscriptionParams( + ListEntitlementOverrideForSubscriptionBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public ListEntitlementOverrideForSubscriptionBuilder toBuilder() { + ListEntitlementOverrideForSubscriptionBuilder builder = + new ListEntitlementOverrideForSubscriptionBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for ListEntitlementOverrideForSubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ListEntitlementOverrideForSubscriptionBuilder builder() { + return new ListEntitlementOverrideForSubscriptionBuilder(); + } + + public static final class ListEntitlementOverrideForSubscriptionBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private ListEntitlementOverrideForSubscriptionBuilder() {} + + public ListEntitlementOverrideForSubscriptionBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public ListEntitlementOverrideForSubscriptionBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + @Deprecated + public ListEntitlementOverrideForSubscriptionBuilder embed(String value) { + queryParams.put("embed", value); + return this; + } + + @Deprecated + public ListEntitlementOverrideForSubscriptionBuilder includeDrafts(Boolean value) { + queryParams.put("include_drafts", value); + return this; + } + + @Deprecated + public ListEntitlementOverrideForSubscriptionBuilder includeScheduledOverrides(Boolean value) { + queryParams.put("include_scheduled_overrides", value); + return this; + } + + public ListEntitlementOverrideForSubscriptionParams build() { + return new ListEntitlementOverrideForSubscriptionParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/entitlementOverride/responses/EntitlementOverridesForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/entitlementOverride/responses/EntitlementOverridesForSubscriptionResponse.java deleted file mode 100644 index 76cc8a51..00000000 --- a/src/main/java/com/chargebee/v4/models/entitlementOverride/responses/EntitlementOverridesForSubscriptionResponse.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.chargebee.v4.models.entitlementOverride.responses; - -import java.util.List; - -import com.chargebee.v4.models.entitlementOverride.EntitlementOverride; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.EntitlementOverrideService; -import com.chargebee.v4.models.entitlementOverride.params.EntitlementOverridesForSubscriptionParams; - -/** - * Immutable response object for EntitlementOverridesForSubscription operation. Contains paginated - * list data. - */ -public final class EntitlementOverridesForSubscriptionResponse { - - private final List list; - - private final String nextOffset; - - private final String subscriptionId; - - private final EntitlementOverrideService service; - private final EntitlementOverridesForSubscriptionParams originalParams; - private final Response httpResponse; - - private EntitlementOverridesForSubscriptionResponse( - List list, - String nextOffset, - String subscriptionId, - EntitlementOverrideService service, - EntitlementOverridesForSubscriptionParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.subscriptionId = subscriptionId; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into EntitlementOverridesForSubscriptionResponse object (no service - * context). Use this when you only need to read a single page (no nextPage()). - */ - public static EntitlementOverridesForSubscriptionResponse fromJson(String json) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(EntitlementOverrideEntitlementOverridesForSubscriptionItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new EntitlementOverridesForSubscriptionResponse( - list, nextOffset, null, null, null, null); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse EntitlementOverridesForSubscriptionResponse from JSON", e); - } - } - - /** - * Parse JSON response into EntitlementOverridesForSubscriptionResponse object with service - * context for pagination (enables nextPage()). - */ - public static EntitlementOverridesForSubscriptionResponse fromJson( - String json, - EntitlementOverrideService service, - EntitlementOverridesForSubscriptionParams originalParams, - String subscriptionId, - Response httpResponse) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(EntitlementOverrideEntitlementOverridesForSubscriptionItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new EntitlementOverridesForSubscriptionResponse( - list, nextOffset, subscriptionId, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse EntitlementOverridesForSubscriptionResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public EntitlementOverridesForSubscriptionResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - EntitlementOverridesForSubscriptionParams nextParams = - (originalParams != null - ? originalParams.toBuilder() - : EntitlementOverridesForSubscriptionParams.builder()) - .offset(nextOffset) - .build(); - - return service.entitlementOverridesForSubscription(subscriptionId, nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } - - public static class EntitlementOverrideEntitlementOverridesForSubscriptionItem { - - private EntitlementOverride entitlementOverride; - - public EntitlementOverride getEntitlementOverride() { - return entitlementOverride; - } - - public static EntitlementOverrideEntitlementOverridesForSubscriptionItem fromJson(String json) { - EntitlementOverrideEntitlementOverridesForSubscriptionItem item = - new EntitlementOverrideEntitlementOverridesForSubscriptionItem(); - - String __entitlementOverrideJson = JsonUtil.getObject(json, "entitlement_override"); - if (__entitlementOverrideJson != null) { - item.entitlementOverride = EntitlementOverride.fromJson(__entitlementOverrideJson); - } - - return item; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/entitlementOverride/responses/ListEntitlementOverrideForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/entitlementOverride/responses/ListEntitlementOverrideForSubscriptionResponse.java new file mode 100644 index 00000000..e9def75c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/entitlementOverride/responses/ListEntitlementOverrideForSubscriptionResponse.java @@ -0,0 +1,182 @@ +package com.chargebee.v4.models.entitlementOverride.responses; + +import java.util.List; + +import com.chargebee.v4.models.entitlementOverride.EntitlementOverride; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.EntitlementOverrideService; +import com.chargebee.v4.models.entitlementOverride.params.ListEntitlementOverrideForSubscriptionParams; + +/** + * Immutable response object for ListEntitlementOverrideForSubscription operation. Contains + * paginated list data. + */ +public final class ListEntitlementOverrideForSubscriptionResponse { + + private final List list; + + private final String nextOffset; + + private final String subscriptionId; + + private final EntitlementOverrideService service; + private final ListEntitlementOverrideForSubscriptionParams originalParams; + private final Response httpResponse; + + private ListEntitlementOverrideForSubscriptionResponse( + List list, + String nextOffset, + String subscriptionId, + EntitlementOverrideService service, + ListEntitlementOverrideForSubscriptionParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.subscriptionId = subscriptionId; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into ListEntitlementOverrideForSubscriptionResponse object (no service + * context). Use this when you only need to read a single page (no nextPage()). + */ + public static ListEntitlementOverrideForSubscriptionResponse fromJson(String json) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(EntitlementOverrideListEntitlementOverrideForSubscriptionItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new ListEntitlementOverrideForSubscriptionResponse( + list, nextOffset, null, null, null, null); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse ListEntitlementOverrideForSubscriptionResponse from JSON", e); + } + } + + /** + * Parse JSON response into ListEntitlementOverrideForSubscriptionResponse object with service + * context for pagination (enables nextPage()). + */ + public static ListEntitlementOverrideForSubscriptionResponse fromJson( + String json, + EntitlementOverrideService service, + ListEntitlementOverrideForSubscriptionParams originalParams, + String subscriptionId, + Response httpResponse) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(EntitlementOverrideListEntitlementOverrideForSubscriptionItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new ListEntitlementOverrideForSubscriptionResponse( + list, nextOffset, subscriptionId, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse ListEntitlementOverrideForSubscriptionResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public ListEntitlementOverrideForSubscriptionResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + ListEntitlementOverrideForSubscriptionParams nextParams = + (originalParams != null + ? originalParams.toBuilder() + : ListEntitlementOverrideForSubscriptionParams.builder()) + .offset(nextOffset) + .build(); + + return service.listEntitlementOverrideForSubscription(subscriptionId, nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + public static class EntitlementOverrideListEntitlementOverrideForSubscriptionItem { + + private EntitlementOverride entitlementOverride; + + public EntitlementOverride getEntitlementOverride() { + return entitlementOverride; + } + + public static EntitlementOverrideListEntitlementOverrideForSubscriptionItem fromJson( + String json) { + EntitlementOverrideListEntitlementOverrideForSubscriptionItem item = + new EntitlementOverrideListEntitlementOverrideForSubscriptionItem(); + + String __entitlementOverrideJson = JsonUtil.getObject(json, "entitlement_override"); + if (__entitlementOverrideJson != null) { + item.entitlementOverride = EntitlementOverride.fromJson(__entitlementOverrideJson); + } + + return item; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/AdvanceInvoiceEstimateForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/AdvanceInvoiceEstimateForSubscriptionParams.java deleted file mode 100644 index cfd47cbe..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/AdvanceInvoiceEstimateForSubscriptionParams.java +++ /dev/null @@ -1,396 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class AdvanceInvoiceEstimateForSubscriptionParams { - - private final Integer termsToCharge; - - private final Boolean invoiceImmediately; - - private final ScheduleType scheduleType; - - private final FixedIntervalScheduleParams fixedIntervalSchedule; - - private final List specificDatesSchedule; - - private AdvanceInvoiceEstimateForSubscriptionParams( - AdvanceInvoiceEstimateForSubscriptionBuilder builder) { - - this.termsToCharge = builder.termsToCharge; - - this.invoiceImmediately = builder.invoiceImmediately; - - this.scheduleType = builder.scheduleType; - - this.fixedIntervalSchedule = builder.fixedIntervalSchedule; - - this.specificDatesSchedule = builder.specificDatesSchedule; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - public ScheduleType getScheduleType() { - return scheduleType; - } - - public FixedIntervalScheduleParams getFixedIntervalSchedule() { - return fixedIntervalSchedule; - } - - public List getSpecificDatesSchedule() { - return specificDatesSchedule; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - if (this.scheduleType != null) { - - formData.put("schedule_type", this.scheduleType); - } - - if (this.fixedIntervalSchedule != null) { - - // Single object - Map nestedData = this.fixedIntervalSchedule.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "fixed_interval_schedule[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.specificDatesSchedule != null) { - - // List of objects - for (int i = 0; i < this.specificDatesSchedule.size(); i++) { - SpecificDatesScheduleParams item = this.specificDatesSchedule.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "specific_dates_schedule[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for AdvanceInvoiceEstimateForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AdvanceInvoiceEstimateForSubscriptionBuilder builder() { - return new AdvanceInvoiceEstimateForSubscriptionBuilder(); - } - - public static final class AdvanceInvoiceEstimateForSubscriptionBuilder { - - private Integer termsToCharge; - - private Boolean invoiceImmediately; - - private ScheduleType scheduleType; - - private FixedIntervalScheduleParams fixedIntervalSchedule; - - private List specificDatesSchedule; - - private AdvanceInvoiceEstimateForSubscriptionBuilder() {} - - public AdvanceInvoiceEstimateForSubscriptionBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public AdvanceInvoiceEstimateForSubscriptionBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public AdvanceInvoiceEstimateForSubscriptionBuilder scheduleType(ScheduleType value) { - this.scheduleType = value; - return this; - } - - public AdvanceInvoiceEstimateForSubscriptionBuilder fixedIntervalSchedule( - FixedIntervalScheduleParams value) { - this.fixedIntervalSchedule = value; - return this; - } - - public AdvanceInvoiceEstimateForSubscriptionBuilder specificDatesSchedule( - List value) { - this.specificDatesSchedule = value; - return this; - } - - public AdvanceInvoiceEstimateForSubscriptionParams build() { - return new AdvanceInvoiceEstimateForSubscriptionParams(this); - } - } - - public enum ScheduleType { - IMMEDIATE("immediate"), - - SPECIFIC_DATES("specific_dates"), - - FIXED_INTERVALS("fixed_intervals"), - - /** An enum member indicating that ScheduleType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ScheduleType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ScheduleType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ScheduleType enumValue : ScheduleType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class FixedIntervalScheduleParams { - - private final Integer numberOfOccurrences; - - private final Integer daysBeforeRenewal; - - private final EndScheduleOn endScheduleOn; - - private final Timestamp endDate; - - private FixedIntervalScheduleParams(FixedIntervalScheduleBuilder builder) { - - this.numberOfOccurrences = builder.numberOfOccurrences; - - this.daysBeforeRenewal = builder.daysBeforeRenewal; - - this.endScheduleOn = builder.endScheduleOn; - - this.endDate = builder.endDate; - } - - public Integer getNumberOfOccurrences() { - return numberOfOccurrences; - } - - public Integer getDaysBeforeRenewal() { - return daysBeforeRenewal; - } - - public EndScheduleOn getEndScheduleOn() { - return endScheduleOn; - } - - public Timestamp getEndDate() { - return endDate; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.numberOfOccurrences != null) { - - formData.put("number_of_occurrences", this.numberOfOccurrences); - } - - if (this.daysBeforeRenewal != null) { - - formData.put("days_before_renewal", this.daysBeforeRenewal); - } - - if (this.endScheduleOn != null) { - - formData.put("end_schedule_on", this.endScheduleOn); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - return formData; - } - - /** Create a new builder for FixedIntervalScheduleParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static FixedIntervalScheduleBuilder builder() { - return new FixedIntervalScheduleBuilder(); - } - - public static final class FixedIntervalScheduleBuilder { - - private Integer numberOfOccurrences; - - private Integer daysBeforeRenewal; - - private EndScheduleOn endScheduleOn; - - private Timestamp endDate; - - private FixedIntervalScheduleBuilder() {} - - public FixedIntervalScheduleBuilder numberOfOccurrences(Integer value) { - this.numberOfOccurrences = value; - return this; - } - - public FixedIntervalScheduleBuilder daysBeforeRenewal(Integer value) { - this.daysBeforeRenewal = value; - return this; - } - - public FixedIntervalScheduleBuilder endScheduleOn(EndScheduleOn value) { - this.endScheduleOn = value; - return this; - } - - public FixedIntervalScheduleBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public FixedIntervalScheduleParams build() { - return new FixedIntervalScheduleParams(this); - } - } - - public enum EndScheduleOn { - AFTER_NUMBER_OF_INTERVALS("after_number_of_intervals"), - - SPECIFIC_DATE("specific_date"), - - SUBSCRIPTION_END("subscription_end"), - - /** An enum member indicating that EndScheduleOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - EndScheduleOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static EndScheduleOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (EndScheduleOn enumValue : EndScheduleOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class SpecificDatesScheduleParams { - - private final Integer termsToCharge; - - private final Timestamp date; - - private SpecificDatesScheduleParams(SpecificDatesScheduleBuilder builder) { - - this.termsToCharge = builder.termsToCharge; - - this.date = builder.date; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public Timestamp getDate() { - return date; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.date != null) { - - formData.put("date", this.date); - } - - return formData; - } - - /** Create a new builder for SpecificDatesScheduleParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SpecificDatesScheduleBuilder builder() { - return new SpecificDatesScheduleBuilder(); - } - - public static final class SpecificDatesScheduleBuilder { - - private Integer termsToCharge; - - private Timestamp date; - - private SpecificDatesScheduleBuilder() {} - - public SpecificDatesScheduleBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public SpecificDatesScheduleBuilder date(Timestamp value) { - this.date = value; - return this; - } - - public SpecificDatesScheduleParams build() { - return new SpecificDatesScheduleParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/AdvanceInvoiceEstimateParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/AdvanceInvoiceEstimateParams.java new file mode 100644 index 00000000..6dbdaff2 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/AdvanceInvoiceEstimateParams.java @@ -0,0 +1,394 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class AdvanceInvoiceEstimateParams { + + private final Integer termsToCharge; + + private final Boolean invoiceImmediately; + + private final ScheduleType scheduleType; + + private final FixedIntervalScheduleParams fixedIntervalSchedule; + + private final List specificDatesSchedule; + + private AdvanceInvoiceEstimateParams(AdvanceInvoiceEstimateBuilder builder) { + + this.termsToCharge = builder.termsToCharge; + + this.invoiceImmediately = builder.invoiceImmediately; + + this.scheduleType = builder.scheduleType; + + this.fixedIntervalSchedule = builder.fixedIntervalSchedule; + + this.specificDatesSchedule = builder.specificDatesSchedule; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + public ScheduleType getScheduleType() { + return scheduleType; + } + + public FixedIntervalScheduleParams getFixedIntervalSchedule() { + return fixedIntervalSchedule; + } + + public List getSpecificDatesSchedule() { + return specificDatesSchedule; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + if (this.scheduleType != null) { + + formData.put("schedule_type", this.scheduleType); + } + + if (this.fixedIntervalSchedule != null) { + + // Single object + Map nestedData = this.fixedIntervalSchedule.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "fixed_interval_schedule[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.specificDatesSchedule != null) { + + // List of objects + for (int i = 0; i < this.specificDatesSchedule.size(); i++) { + SpecificDatesScheduleParams item = this.specificDatesSchedule.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "specific_dates_schedule[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for AdvanceInvoiceEstimateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AdvanceInvoiceEstimateBuilder builder() { + return new AdvanceInvoiceEstimateBuilder(); + } + + public static final class AdvanceInvoiceEstimateBuilder { + + private Integer termsToCharge; + + private Boolean invoiceImmediately; + + private ScheduleType scheduleType; + + private FixedIntervalScheduleParams fixedIntervalSchedule; + + private List specificDatesSchedule; + + private AdvanceInvoiceEstimateBuilder() {} + + public AdvanceInvoiceEstimateBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public AdvanceInvoiceEstimateBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public AdvanceInvoiceEstimateBuilder scheduleType(ScheduleType value) { + this.scheduleType = value; + return this; + } + + public AdvanceInvoiceEstimateBuilder fixedIntervalSchedule(FixedIntervalScheduleParams value) { + this.fixedIntervalSchedule = value; + return this; + } + + public AdvanceInvoiceEstimateBuilder specificDatesSchedule( + List value) { + this.specificDatesSchedule = value; + return this; + } + + public AdvanceInvoiceEstimateParams build() { + return new AdvanceInvoiceEstimateParams(this); + } + } + + public enum ScheduleType { + IMMEDIATE("immediate"), + + SPECIFIC_DATES("specific_dates"), + + FIXED_INTERVALS("fixed_intervals"), + + /** An enum member indicating that ScheduleType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ScheduleType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ScheduleType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ScheduleType enumValue : ScheduleType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class FixedIntervalScheduleParams { + + private final Integer numberOfOccurrences; + + private final Integer daysBeforeRenewal; + + private final EndScheduleOn endScheduleOn; + + private final Timestamp endDate; + + private FixedIntervalScheduleParams(FixedIntervalScheduleBuilder builder) { + + this.numberOfOccurrences = builder.numberOfOccurrences; + + this.daysBeforeRenewal = builder.daysBeforeRenewal; + + this.endScheduleOn = builder.endScheduleOn; + + this.endDate = builder.endDate; + } + + public Integer getNumberOfOccurrences() { + return numberOfOccurrences; + } + + public Integer getDaysBeforeRenewal() { + return daysBeforeRenewal; + } + + public EndScheduleOn getEndScheduleOn() { + return endScheduleOn; + } + + public Timestamp getEndDate() { + return endDate; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.numberOfOccurrences != null) { + + formData.put("number_of_occurrences", this.numberOfOccurrences); + } + + if (this.daysBeforeRenewal != null) { + + formData.put("days_before_renewal", this.daysBeforeRenewal); + } + + if (this.endScheduleOn != null) { + + formData.put("end_schedule_on", this.endScheduleOn); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + return formData; + } + + /** Create a new builder for FixedIntervalScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static FixedIntervalScheduleBuilder builder() { + return new FixedIntervalScheduleBuilder(); + } + + public static final class FixedIntervalScheduleBuilder { + + private Integer numberOfOccurrences; + + private Integer daysBeforeRenewal; + + private EndScheduleOn endScheduleOn; + + private Timestamp endDate; + + private FixedIntervalScheduleBuilder() {} + + public FixedIntervalScheduleBuilder numberOfOccurrences(Integer value) { + this.numberOfOccurrences = value; + return this; + } + + public FixedIntervalScheduleBuilder daysBeforeRenewal(Integer value) { + this.daysBeforeRenewal = value; + return this; + } + + public FixedIntervalScheduleBuilder endScheduleOn(EndScheduleOn value) { + this.endScheduleOn = value; + return this; + } + + public FixedIntervalScheduleBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public FixedIntervalScheduleParams build() { + return new FixedIntervalScheduleParams(this); + } + } + + public enum EndScheduleOn { + AFTER_NUMBER_OF_INTERVALS("after_number_of_intervals"), + + SPECIFIC_DATE("specific_date"), + + SUBSCRIPTION_END("subscription_end"), + + /** An enum member indicating that EndScheduleOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + EndScheduleOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EndScheduleOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (EndScheduleOn enumValue : EndScheduleOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class SpecificDatesScheduleParams { + + private final Integer termsToCharge; + + private final Timestamp date; + + private SpecificDatesScheduleParams(SpecificDatesScheduleBuilder builder) { + + this.termsToCharge = builder.termsToCharge; + + this.date = builder.date; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public Timestamp getDate() { + return date; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.date != null) { + + formData.put("date", this.date); + } + + return formData; + } + + /** Create a new builder for SpecificDatesScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SpecificDatesScheduleBuilder builder() { + return new SpecificDatesScheduleBuilder(); + } + + public static final class SpecificDatesScheduleBuilder { + + private Integer termsToCharge; + + private Timestamp date; + + private SpecificDatesScheduleBuilder() {} + + public SpecificDatesScheduleBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public SpecificDatesScheduleBuilder date(Timestamp value) { + this.date = value; + return this; + } + + public SpecificDatesScheduleParams build() { + return new SpecificDatesScheduleParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/CancelSubscriptionEstimateForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/CancelSubscriptionEstimateForSubscriptionParams.java deleted file mode 100644 index ed812bbc..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/CancelSubscriptionEstimateForSubscriptionParams.java +++ /dev/null @@ -1,583 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class CancelSubscriptionEstimateForSubscriptionParams { - - private final CancelOption cancelOption; - - private final Boolean endOfTerm; - - private final Timestamp cancelAt; - - private final CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; - - private final UnbilledChargesOption unbilledChargesOption; - - private final AccountReceivablesHandling accountReceivablesHandling; - - private final RefundableCreditsHandling refundableCreditsHandling; - - private final ContractTermCancelOption contractTermCancelOption; - - private final Timestamp invoiceDate; - - private final String cancelReasonCode; - - private final List eventBasedAddons; - - private CancelSubscriptionEstimateForSubscriptionParams( - CancelSubscriptionEstimateForSubscriptionBuilder builder) { - - this.cancelOption = builder.cancelOption; - - this.endOfTerm = builder.endOfTerm; - - this.cancelAt = builder.cancelAt; - - this.creditOptionForCurrentTermCharges = builder.creditOptionForCurrentTermCharges; - - this.unbilledChargesOption = builder.unbilledChargesOption; - - this.accountReceivablesHandling = builder.accountReceivablesHandling; - - this.refundableCreditsHandling = builder.refundableCreditsHandling; - - this.contractTermCancelOption = builder.contractTermCancelOption; - - this.invoiceDate = builder.invoiceDate; - - this.cancelReasonCode = builder.cancelReasonCode; - - this.eventBasedAddons = builder.eventBasedAddons; - } - - public CancelOption getCancelOption() { - return cancelOption; - } - - public Boolean getEndOfTerm() { - return endOfTerm; - } - - public Timestamp getCancelAt() { - return cancelAt; - } - - public CreditOptionForCurrentTermCharges getCreditOptionForCurrentTermCharges() { - return creditOptionForCurrentTermCharges; - } - - public UnbilledChargesOption getUnbilledChargesOption() { - return unbilledChargesOption; - } - - public AccountReceivablesHandling getAccountReceivablesHandling() { - return accountReceivablesHandling; - } - - public RefundableCreditsHandling getRefundableCreditsHandling() { - return refundableCreditsHandling; - } - - public ContractTermCancelOption getContractTermCancelOption() { - return contractTermCancelOption; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public String getCancelReasonCode() { - return cancelReasonCode; - } - - public List getEventBasedAddons() { - return eventBasedAddons; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.cancelOption != null) { - - formData.put("cancel_option", this.cancelOption); - } - - if (this.endOfTerm != null) { - - formData.put("end_of_term", this.endOfTerm); - } - - if (this.cancelAt != null) { - - formData.put("cancel_at", this.cancelAt); - } - - if (this.creditOptionForCurrentTermCharges != null) { - - formData.put( - "credit_option_for_current_term_charges", this.creditOptionForCurrentTermCharges); - } - - if (this.unbilledChargesOption != null) { - - formData.put("unbilled_charges_option", this.unbilledChargesOption); - } - - if (this.accountReceivablesHandling != null) { - - formData.put("account_receivables_handling", this.accountReceivablesHandling); - } - - if (this.refundableCreditsHandling != null) { - - formData.put("refundable_credits_handling", this.refundableCreditsHandling); - } - - if (this.contractTermCancelOption != null) { - - formData.put("contract_term_cancel_option", this.contractTermCancelOption); - } - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.cancelReasonCode != null) { - - formData.put("cancel_reason_code", this.cancelReasonCode); - } - - if (this.eventBasedAddons != null) { - - // List of objects - for (int i = 0; i < this.eventBasedAddons.size(); i++) { - EventBasedAddonsParams item = this.eventBasedAddons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for CancelSubscriptionEstimateForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CancelSubscriptionEstimateForSubscriptionBuilder builder() { - return new CancelSubscriptionEstimateForSubscriptionBuilder(); - } - - public static final class CancelSubscriptionEstimateForSubscriptionBuilder { - - private CancelOption cancelOption; - - private Boolean endOfTerm; - - private Timestamp cancelAt; - - private CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; - - private UnbilledChargesOption unbilledChargesOption; - - private AccountReceivablesHandling accountReceivablesHandling; - - private RefundableCreditsHandling refundableCreditsHandling; - - private ContractTermCancelOption contractTermCancelOption; - - private Timestamp invoiceDate; - - private String cancelReasonCode; - - private List eventBasedAddons; - - private CancelSubscriptionEstimateForSubscriptionBuilder() {} - - public CancelSubscriptionEstimateForSubscriptionBuilder cancelOption(CancelOption value) { - this.cancelOption = value; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionBuilder endOfTerm(Boolean value) { - this.endOfTerm = value; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionBuilder cancelAt(Timestamp value) { - this.cancelAt = value; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionBuilder creditOptionForCurrentTermCharges( - CreditOptionForCurrentTermCharges value) { - this.creditOptionForCurrentTermCharges = value; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionBuilder unbilledChargesOption( - UnbilledChargesOption value) { - this.unbilledChargesOption = value; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionBuilder accountReceivablesHandling( - AccountReceivablesHandling value) { - this.accountReceivablesHandling = value; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionBuilder refundableCreditsHandling( - RefundableCreditsHandling value) { - this.refundableCreditsHandling = value; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionBuilder contractTermCancelOption( - ContractTermCancelOption value) { - this.contractTermCancelOption = value; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionBuilder cancelReasonCode(String value) { - this.cancelReasonCode = value; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionBuilder eventBasedAddons( - List value) { - this.eventBasedAddons = value; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionParams build() { - return new CancelSubscriptionEstimateForSubscriptionParams(this); - } - } - - public enum CancelOption { - IMMEDIATELY("immediately"), - - END_OF_TERM("end_of_term"), - - SPECIFIC_DATE("specific_date"), - - END_OF_BILLING_TERM("end_of_billing_term"), - - /** An enum member indicating that CancelOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - CancelOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CancelOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (CancelOption enumValue : CancelOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum CreditOptionForCurrentTermCharges { - NONE("none"), - - PRORATE("prorate"), - - FULL("full"), - - /** - * An enum member indicating that CreditOptionForCurrentTermCharges was instantiated with an - * unknown value. - */ - _UNKNOWN(null); - private final String value; - - CreditOptionForCurrentTermCharges(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CreditOptionForCurrentTermCharges fromString(String value) { - if (value == null) return _UNKNOWN; - for (CreditOptionForCurrentTermCharges enumValue : - CreditOptionForCurrentTermCharges.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum UnbilledChargesOption { - INVOICE("invoice"), - - DELETE("delete"), - - /** - * An enum member indicating that UnbilledChargesOption was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - UnbilledChargesOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static UnbilledChargesOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (UnbilledChargesOption enumValue : UnbilledChargesOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum AccountReceivablesHandling { - NO_ACTION("no_action"), - - SCHEDULE_PAYMENT_COLLECTION("schedule_payment_collection"), - - WRITE_OFF("write_off"), - - /** - * An enum member indicating that AccountReceivablesHandling was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - AccountReceivablesHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AccountReceivablesHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (AccountReceivablesHandling enumValue : AccountReceivablesHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum RefundableCreditsHandling { - NO_ACTION("no_action"), - - SCHEDULE_REFUND("schedule_refund"), - - /** - * An enum member indicating that RefundableCreditsHandling was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - RefundableCreditsHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static RefundableCreditsHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (RefundableCreditsHandling enumValue : RefundableCreditsHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ContractTermCancelOption { - TERMINATE_IMMEDIATELY("terminate_immediately"), - - END_OF_CONTRACT_TERM("end_of_contract_term"), - - SPECIFIC_DATE("specific_date"), - - END_OF_SUBSCRIPTION_BILLING_TERM("end_of_subscription_billing_term"), - - /** - * An enum member indicating that ContractTermCancelOption was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - ContractTermCancelOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ContractTermCancelOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ContractTermCancelOption enumValue : ContractTermCancelOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class EventBasedAddonsParams { - - private final String id; - - private final Integer quantity; - - private final Long unitPrice; - - private final Integer servicePeriodInDays; - - private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.unitPrice = builder.unitPrice; - - this.servicePeriodInDays = builder.servicePeriodInDays; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public Integer getServicePeriodInDays() { - return servicePeriodInDays; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.servicePeriodInDays != null) { - - formData.put("service_period_in_days", this.servicePeriodInDays); - } - - return formData; - } - - /** Create a new builder for EventBasedAddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EventBasedAddonsBuilder builder() { - return new EventBasedAddonsBuilder(); - } - - public static final class EventBasedAddonsBuilder { - - private String id; - - private Integer quantity; - - private Long unitPrice; - - private Integer servicePeriodInDays; - - private EventBasedAddonsBuilder() {} - - public EventBasedAddonsBuilder id(String value) { - this.id = value; - return this; - } - - public EventBasedAddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public EventBasedAddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { - this.servicePeriodInDays = value; - return this; - } - - public EventBasedAddonsParams build() { - return new EventBasedAddonsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/CancelSubscriptionForItemsEstimateForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/CancelSubscriptionForItemsEstimateForSubscriptionParams.java deleted file mode 100644 index 8993044d..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/CancelSubscriptionForItemsEstimateForSubscriptionParams.java +++ /dev/null @@ -1,624 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class CancelSubscriptionForItemsEstimateForSubscriptionParams { - - private final CancelOption cancelOption; - - private final Boolean endOfTerm; - - private final Timestamp cancelAt; - - private final CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; - - private final UnbilledChargesOption unbilledChargesOption; - - private final AccountReceivablesHandling accountReceivablesHandling; - - private final RefundableCreditsHandling refundableCreditsHandling; - - private final ContractTermCancelOption contractTermCancelOption; - - private final Timestamp invoiceDate; - - private final String cancelReasonCode; - - private final List subscriptionItems; - - private CancelSubscriptionForItemsEstimateForSubscriptionParams( - CancelSubscriptionForItemsEstimateForSubscriptionBuilder builder) { - - this.cancelOption = builder.cancelOption; - - this.endOfTerm = builder.endOfTerm; - - this.cancelAt = builder.cancelAt; - - this.creditOptionForCurrentTermCharges = builder.creditOptionForCurrentTermCharges; - - this.unbilledChargesOption = builder.unbilledChargesOption; - - this.accountReceivablesHandling = builder.accountReceivablesHandling; - - this.refundableCreditsHandling = builder.refundableCreditsHandling; - - this.contractTermCancelOption = builder.contractTermCancelOption; - - this.invoiceDate = builder.invoiceDate; - - this.cancelReasonCode = builder.cancelReasonCode; - - this.subscriptionItems = builder.subscriptionItems; - } - - public CancelOption getCancelOption() { - return cancelOption; - } - - public Boolean getEndOfTerm() { - return endOfTerm; - } - - public Timestamp getCancelAt() { - return cancelAt; - } - - public CreditOptionForCurrentTermCharges getCreditOptionForCurrentTermCharges() { - return creditOptionForCurrentTermCharges; - } - - public UnbilledChargesOption getUnbilledChargesOption() { - return unbilledChargesOption; - } - - public AccountReceivablesHandling getAccountReceivablesHandling() { - return accountReceivablesHandling; - } - - public RefundableCreditsHandling getRefundableCreditsHandling() { - return refundableCreditsHandling; - } - - public ContractTermCancelOption getContractTermCancelOption() { - return contractTermCancelOption; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public String getCancelReasonCode() { - return cancelReasonCode; - } - - public List getSubscriptionItems() { - return subscriptionItems; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.cancelOption != null) { - - formData.put("cancel_option", this.cancelOption); - } - - if (this.endOfTerm != null) { - - formData.put("end_of_term", this.endOfTerm); - } - - if (this.cancelAt != null) { - - formData.put("cancel_at", this.cancelAt); - } - - if (this.creditOptionForCurrentTermCharges != null) { - - formData.put( - "credit_option_for_current_term_charges", this.creditOptionForCurrentTermCharges); - } - - if (this.unbilledChargesOption != null) { - - formData.put("unbilled_charges_option", this.unbilledChargesOption); - } - - if (this.accountReceivablesHandling != null) { - - formData.put("account_receivables_handling", this.accountReceivablesHandling); - } - - if (this.refundableCreditsHandling != null) { - - formData.put("refundable_credits_handling", this.refundableCreditsHandling); - } - - if (this.contractTermCancelOption != null) { - - formData.put("contract_term_cancel_option", this.contractTermCancelOption); - } - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.cancelReasonCode != null) { - - formData.put("cancel_reason_code", this.cancelReasonCode); - } - - if (this.subscriptionItems != null) { - - // List of objects - for (int i = 0; i < this.subscriptionItems.size(); i++) { - SubscriptionItemsParams item = this.subscriptionItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for CancelSubscriptionForItemsEstimateForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CancelSubscriptionForItemsEstimateForSubscriptionBuilder builder() { - return new CancelSubscriptionForItemsEstimateForSubscriptionBuilder(); - } - - public static final class CancelSubscriptionForItemsEstimateForSubscriptionBuilder { - - private CancelOption cancelOption; - - private Boolean endOfTerm; - - private Timestamp cancelAt; - - private CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; - - private UnbilledChargesOption unbilledChargesOption; - - private AccountReceivablesHandling accountReceivablesHandling; - - private RefundableCreditsHandling refundableCreditsHandling; - - private ContractTermCancelOption contractTermCancelOption; - - private Timestamp invoiceDate; - - private String cancelReasonCode; - - private List subscriptionItems; - - private CancelSubscriptionForItemsEstimateForSubscriptionBuilder() {} - - public CancelSubscriptionForItemsEstimateForSubscriptionBuilder cancelOption( - CancelOption value) { - this.cancelOption = value; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionBuilder endOfTerm(Boolean value) { - this.endOfTerm = value; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionBuilder cancelAt(Timestamp value) { - this.cancelAt = value; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionBuilder - creditOptionForCurrentTermCharges(CreditOptionForCurrentTermCharges value) { - this.creditOptionForCurrentTermCharges = value; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionBuilder unbilledChargesOption( - UnbilledChargesOption value) { - this.unbilledChargesOption = value; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionBuilder accountReceivablesHandling( - AccountReceivablesHandling value) { - this.accountReceivablesHandling = value; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionBuilder refundableCreditsHandling( - RefundableCreditsHandling value) { - this.refundableCreditsHandling = value; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionBuilder contractTermCancelOption( - ContractTermCancelOption value) { - this.contractTermCancelOption = value; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionBuilder cancelReasonCode(String value) { - this.cancelReasonCode = value; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionBuilder subscriptionItems( - List value) { - this.subscriptionItems = value; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionParams build() { - return new CancelSubscriptionForItemsEstimateForSubscriptionParams(this); - } - } - - public enum CancelOption { - IMMEDIATELY("immediately"), - - END_OF_TERM("end_of_term"), - - SPECIFIC_DATE("specific_date"), - - END_OF_BILLING_TERM("end_of_billing_term"), - - /** An enum member indicating that CancelOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - CancelOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CancelOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (CancelOption enumValue : CancelOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum CreditOptionForCurrentTermCharges { - NONE("none"), - - PRORATE("prorate"), - - FULL("full"), - - /** - * An enum member indicating that CreditOptionForCurrentTermCharges was instantiated with an - * unknown value. - */ - _UNKNOWN(null); - private final String value; - - CreditOptionForCurrentTermCharges(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CreditOptionForCurrentTermCharges fromString(String value) { - if (value == null) return _UNKNOWN; - for (CreditOptionForCurrentTermCharges enumValue : - CreditOptionForCurrentTermCharges.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum UnbilledChargesOption { - INVOICE("invoice"), - - DELETE("delete"), - - /** - * An enum member indicating that UnbilledChargesOption was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - UnbilledChargesOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static UnbilledChargesOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (UnbilledChargesOption enumValue : UnbilledChargesOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum AccountReceivablesHandling { - NO_ACTION("no_action"), - - SCHEDULE_PAYMENT_COLLECTION("schedule_payment_collection"), - - WRITE_OFF("write_off"), - - /** - * An enum member indicating that AccountReceivablesHandling was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - AccountReceivablesHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AccountReceivablesHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (AccountReceivablesHandling enumValue : AccountReceivablesHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum RefundableCreditsHandling { - NO_ACTION("no_action"), - - SCHEDULE_REFUND("schedule_refund"), - - /** - * An enum member indicating that RefundableCreditsHandling was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - RefundableCreditsHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static RefundableCreditsHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (RefundableCreditsHandling enumValue : RefundableCreditsHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ContractTermCancelOption { - TERMINATE_IMMEDIATELY("terminate_immediately"), - - END_OF_CONTRACT_TERM("end_of_contract_term"), - - SPECIFIC_DATE("specific_date"), - - END_OF_SUBSCRIPTION_BILLING_TERM("end_of_subscription_billing_term"), - - /** - * An enum member indicating that ContractTermCancelOption was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - ContractTermCancelOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ContractTermCancelOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ContractTermCancelOption enumValue : ContractTermCancelOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionItemsParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer servicePeriodDays; - - private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.servicePeriodDays = builder.servicePeriodDays; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - return formData; - } - - /** Create a new builder for SubscriptionItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionItemsBuilder builder() { - return new SubscriptionItemsBuilder(); - } - - public static final class SubscriptionItemsBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer servicePeriodDays; - - private SubscriptionItemsBuilder() {} - - public SubscriptionItemsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public SubscriptionItemsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public SubscriptionItemsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public SubscriptionItemsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public SubscriptionItemsParams build() { - return new SubscriptionItemsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/ChangeTermEndEstimateForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/ChangeTermEndEstimateForSubscriptionParams.java deleted file mode 100644 index b5e3593a..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/ChangeTermEndEstimateForSubscriptionParams.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class ChangeTermEndEstimateForSubscriptionParams { - - private final Timestamp termEndsAt; - - private final Boolean prorate; - - private final Boolean invoiceImmediately; - - private ChangeTermEndEstimateForSubscriptionParams( - ChangeTermEndEstimateForSubscriptionBuilder builder) { - - this.termEndsAt = builder.termEndsAt; - - this.prorate = builder.prorate; - - this.invoiceImmediately = builder.invoiceImmediately; - } - - public Timestamp getTermEndsAt() { - return termEndsAt; - } - - public Boolean getProrate() { - return prorate; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.termEndsAt != null) { - - formData.put("term_ends_at", this.termEndsAt); - } - - if (this.prorate != null) { - - formData.put("prorate", this.prorate); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - return formData; - } - - /** Create a new builder for ChangeTermEndEstimateForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ChangeTermEndEstimateForSubscriptionBuilder builder() { - return new ChangeTermEndEstimateForSubscriptionBuilder(); - } - - public static final class ChangeTermEndEstimateForSubscriptionBuilder { - - private Timestamp termEndsAt; - - private Boolean prorate; - - private Boolean invoiceImmediately; - - private ChangeTermEndEstimateForSubscriptionBuilder() {} - - public ChangeTermEndEstimateForSubscriptionBuilder termEndsAt(Timestamp value) { - this.termEndsAt = value; - return this; - } - - public ChangeTermEndEstimateForSubscriptionBuilder prorate(Boolean value) { - this.prorate = value; - return this; - } - - public ChangeTermEndEstimateForSubscriptionBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public ChangeTermEndEstimateForSubscriptionParams build() { - return new ChangeTermEndEstimateForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionEstimateForCustomerParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionEstimateForCustomerParams.java deleted file mode 100644 index f3fbe573..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionEstimateForCustomerParams.java +++ /dev/null @@ -1,902 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; - -import java.sql.Timestamp; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class CreateSubscriptionEstimateForCustomerParams { - - private final Map queryParams; - - private CreateSubscriptionEstimateForCustomerParams( - CreateSubscriptionEstimateForCustomerBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public CreateSubscriptionEstimateForCustomerBuilder toBuilder() { - CreateSubscriptionEstimateForCustomerBuilder builder = - new CreateSubscriptionEstimateForCustomerBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for CreateSubscriptionEstimateForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreateSubscriptionEstimateForCustomerBuilder builder() { - return new CreateSubscriptionEstimateForCustomerBuilder(); - } - - public static final class CreateSubscriptionEstimateForCustomerBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private CreateSubscriptionEstimateForCustomerBuilder() {} - - public CreateSubscriptionEstimateForCustomerBuilder useExistingBalances(Boolean value) { - queryParams.put("use_existing_balances", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder invoiceImmediately(Boolean value) { - queryParams.put("invoice_immediately", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder billingCycles(Integer value) { - queryParams.put("billing_cycles", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder mandatoryAddonsToRemove( - List value) { - queryParams.put("mandatory_addons_to_remove", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder termsToCharge(Integer value) { - queryParams.put("terms_to_charge", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder billingAlignmentMode( - BillingAlignmentMode value) { - queryParams.put("billing_alignment_mode", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder invoiceDate(Timestamp value) { - queryParams.put("invoice_date", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder couponIds(List value) { - queryParams.put("coupon_ids", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder subscription(SubscriptionParams value) { - queryParams.put("subscription", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder shippingAddress( - ShippingAddressParams value) { - queryParams.put("shipping_address", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder contractTerm(ContractTermParams value) { - queryParams.put("contract_term", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder addons(AddonsParams value) { - queryParams.put("addons", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerBuilder eventBasedAddons( - EventBasedAddonsParams value) { - queryParams.put("event_based_addons", value); - return this; - } - - public CreateSubscriptionEstimateForCustomerParams build() { - return new CreateSubscriptionEstimateForCustomerParams(this); - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum SubscriptionOfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that SubscriptionOfflinePaymentMethod was instantiated with an - * unknown value. - */ - _UNKNOWN(null); - private final String value; - - SubscriptionOfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static SubscriptionOfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (SubscriptionOfflinePaymentMethod enumValue : SubscriptionOfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum SubscriptionFreePeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** - * An enum member indicating that SubscriptionFreePeriodUnit was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - SubscriptionFreePeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static SubscriptionFreePeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (SubscriptionFreePeriodUnit enumValue : SubscriptionFreePeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum SubscriptionTrialEndAction { - SITE_DEFAULT("site_default"), - - PLAN_DEFAULT("plan_default"), - - ACTIVATE_SUBSCRIPTION("activate_subscription"), - - CANCEL_SUBSCRIPTION("cancel_subscription"), - - /** - * An enum member indicating that SubscriptionTrialEndAction was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - SubscriptionTrialEndAction(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static SubscriptionTrialEndAction fromString(String value) { - if (value == null) return _UNKNOWN; - for (SubscriptionTrialEndAction enumValue : SubscriptionTrialEndAction.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ShippingAddressValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** - * An enum member indicating that ShippingAddressValidationStatus was instantiated with an - * unknown value. - */ - _UNKNOWN(null); - private final String value; - - ShippingAddressValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ShippingAddressValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ShippingAddressValidationStatus enumValue : ShippingAddressValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ContractTermActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** - * An enum member indicating that ContractTermActionAtTermEnd was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - ContractTermActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ContractTermActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ContractTermActionAtTermEnd enumValue : ContractTermActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionParams { - - private final Map queryParams; - - private SubscriptionParams(SubscriptionBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public SubscriptionBuilder toBuilder() { - SubscriptionBuilder builder = new SubscriptionBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private SubscriptionBuilder() {} - - public SubscriptionBuilder id(String value) { - queryParams.put("id", value); - return this; - } - - public SubscriptionBuilder planId(String value) { - queryParams.put("plan_id", value); - return this; - } - - public SubscriptionBuilder planQuantity(Integer value) { - queryParams.put("plan_quantity", value); - return this; - } - - public SubscriptionBuilder planQuantityInDecimal(String value) { - queryParams.put("plan_quantity_in_decimal", value); - return this; - } - - public SubscriptionBuilder planUnitPrice(Long value) { - queryParams.put("plan_unit_price", value); - return this; - } - - public SubscriptionBuilder planUnitPriceInDecimal(String value) { - queryParams.put("plan_unit_price_in_decimal", value); - return this; - } - - public SubscriptionBuilder setupFee(Long value) { - queryParams.put("setup_fee", value); - return this; - } - - public SubscriptionBuilder trialEnd(Timestamp value) { - queryParams.put("trial_end", value); - return this; - } - - public SubscriptionBuilder startDate(Timestamp value) { - queryParams.put("start_date", value); - return this; - } - - public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - queryParams.put("offline_payment_method", value); - return this; - } - - public SubscriptionBuilder freePeriod(Integer value) { - queryParams.put("free_period", value); - return this; - } - - public SubscriptionBuilder freePeriodUnit(FreePeriodUnit value) { - queryParams.put("free_period_unit", value); - return this; - } - - public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { - queryParams.put("contract_term_billing_cycle_on_renewal", value); - return this; - } - - public SubscriptionBuilder trialEndAction(TrialEndAction value) { - queryParams.put("trial_end_action", value); - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum FreePeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - FreePeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static FreePeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum TrialEndAction { - SITE_DEFAULT("site_default"), - - PLAN_DEFAULT("plan_default"), - - ACTIVATE_SUBSCRIPTION("activate_subscription"), - - CANCEL_SUBSCRIPTION("cancel_subscription"), - - /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - TrialEndAction(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static TrialEndAction fromString(String value) { - if (value == null) return _UNKNOWN; - for (TrialEndAction enumValue : TrialEndAction.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final Map queryParams; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public ShippingAddressBuilder toBuilder() { - ShippingAddressBuilder builder = new ShippingAddressBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder line1(String value) { - queryParams.put("line1", value); - return this; - } - - public ShippingAddressBuilder line2(String value) { - queryParams.put("line2", value); - return this; - } - - public ShippingAddressBuilder line3(String value) { - queryParams.put("line3", value); - return this; - } - - public ShippingAddressBuilder city(String value) { - queryParams.put("city", value); - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - queryParams.put("state_code", value); - return this; - } - - public ShippingAddressBuilder zip(String value) { - queryParams.put("zip", value); - return this; - } - - public ShippingAddressBuilder country(String value) { - queryParams.put("country", value); - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - queryParams.put("validation_status", value); - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ContractTermParams { - - private final Map queryParams; - - private ContractTermParams(ContractTermBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public ContractTermBuilder toBuilder() { - ContractTermBuilder builder = new ContractTermBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - queryParams.put("action_at_term_end", value); - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - queryParams.put("cancellation_cutoff_period", value); - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class AddonsParams { - - private final Map queryParams; - - private AddonsParams(AddonsBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public AddonsBuilder toBuilder() { - AddonsBuilder builder = new AddonsBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for AddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddonsBuilder builder() { - return new AddonsBuilder(); - } - - public static final class AddonsBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private AddonsBuilder() {} - - public AddonsBuilder id(List value) { - queryParams.put("id", value); - return this; - } - - public AddonsBuilder quantity(List value) { - queryParams.put("quantity", value); - return this; - } - - public AddonsBuilder quantityInDecimal(List value) { - queryParams.put("quantity_in_decimal", value); - return this; - } - - public AddonsBuilder unitPrice(List value) { - queryParams.put("unit_price", value); - return this; - } - - public AddonsBuilder unitPriceInDecimal(List value) { - queryParams.put("unit_price_in_decimal", value); - return this; - } - - public AddonsBuilder billingCycles(List value) { - queryParams.put("billing_cycles", value); - return this; - } - - public AddonsBuilder trialEnd(List value) { - queryParams.put("trial_end", value); - return this; - } - - public AddonsParams build() { - return new AddonsParams(this); - } - } - } - - public static final class EventBasedAddonsParams { - - private final Map queryParams; - - private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public EventBasedAddonsBuilder toBuilder() { - EventBasedAddonsBuilder builder = new EventBasedAddonsBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for EventBasedAddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EventBasedAddonsBuilder builder() { - return new EventBasedAddonsBuilder(); - } - - public static final class EventBasedAddonsBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private EventBasedAddonsBuilder() {} - - public EventBasedAddonsBuilder id(List value) { - queryParams.put("id", value); - return this; - } - - public EventBasedAddonsBuilder quantity(List value) { - queryParams.put("quantity", value); - return this; - } - - public EventBasedAddonsBuilder unitPrice(List value) { - queryParams.put("unit_price", value); - return this; - } - - public EventBasedAddonsBuilder quantityInDecimal(List value) { - queryParams.put("quantity_in_decimal", value); - return this; - } - - public EventBasedAddonsBuilder unitPriceInDecimal(List value) { - queryParams.put("unit_price_in_decimal", value); - return this; - } - - public EventBasedAddonsBuilder servicePeriodInDays(List value) { - queryParams.put("service_period_in_days", value); - return this; - } - - public EventBasedAddonsBuilder onEvent(List value) { - queryParams.put("on_event", value); - return this; - } - - public EventBasedAddonsBuilder chargeOnce(List value) { - queryParams.put("charge_once", value); - return this; - } - - public EventBasedAddonsBuilder chargeOn(List value) { - queryParams.put("charge_on", value); - return this; - } - - public EventBasedAddonsParams build() { - return new EventBasedAddonsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionForCustomerEstimateParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionForCustomerEstimateParams.java new file mode 100644 index 00000000..633c1571 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionForCustomerEstimateParams.java @@ -0,0 +1,902 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; + +import java.sql.Timestamp; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class CreateSubscriptionForCustomerEstimateParams { + + private final Map queryParams; + + private CreateSubscriptionForCustomerEstimateParams( + CreateSubscriptionForCustomerEstimateBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public CreateSubscriptionForCustomerEstimateBuilder toBuilder() { + CreateSubscriptionForCustomerEstimateBuilder builder = + new CreateSubscriptionForCustomerEstimateBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for CreateSubscriptionForCustomerEstimateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreateSubscriptionForCustomerEstimateBuilder builder() { + return new CreateSubscriptionForCustomerEstimateBuilder(); + } + + public static final class CreateSubscriptionForCustomerEstimateBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private CreateSubscriptionForCustomerEstimateBuilder() {} + + public CreateSubscriptionForCustomerEstimateBuilder useExistingBalances(Boolean value) { + queryParams.put("use_existing_balances", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder invoiceImmediately(Boolean value) { + queryParams.put("invoice_immediately", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder billingCycles(Integer value) { + queryParams.put("billing_cycles", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder mandatoryAddonsToRemove( + List value) { + queryParams.put("mandatory_addons_to_remove", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder termsToCharge(Integer value) { + queryParams.put("terms_to_charge", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder billingAlignmentMode( + BillingAlignmentMode value) { + queryParams.put("billing_alignment_mode", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder invoiceDate(Timestamp value) { + queryParams.put("invoice_date", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder couponIds(List value) { + queryParams.put("coupon_ids", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder subscription(SubscriptionParams value) { + queryParams.put("subscription", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder shippingAddress( + ShippingAddressParams value) { + queryParams.put("shipping_address", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder contractTerm(ContractTermParams value) { + queryParams.put("contract_term", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder addons(AddonsParams value) { + queryParams.put("addons", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateBuilder eventBasedAddons( + EventBasedAddonsParams value) { + queryParams.put("event_based_addons", value); + return this; + } + + public CreateSubscriptionForCustomerEstimateParams build() { + return new CreateSubscriptionForCustomerEstimateParams(this); + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum SubscriptionOfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that SubscriptionOfflinePaymentMethod was instantiated with an + * unknown value. + */ + _UNKNOWN(null); + private final String value; + + SubscriptionOfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SubscriptionOfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (SubscriptionOfflinePaymentMethod enumValue : SubscriptionOfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum SubscriptionFreePeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** + * An enum member indicating that SubscriptionFreePeriodUnit was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + SubscriptionFreePeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SubscriptionFreePeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (SubscriptionFreePeriodUnit enumValue : SubscriptionFreePeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum SubscriptionTrialEndAction { + SITE_DEFAULT("site_default"), + + PLAN_DEFAULT("plan_default"), + + ACTIVATE_SUBSCRIPTION("activate_subscription"), + + CANCEL_SUBSCRIPTION("cancel_subscription"), + + /** + * An enum member indicating that SubscriptionTrialEndAction was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + SubscriptionTrialEndAction(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SubscriptionTrialEndAction fromString(String value) { + if (value == null) return _UNKNOWN; + for (SubscriptionTrialEndAction enumValue : SubscriptionTrialEndAction.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ShippingAddressValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** + * An enum member indicating that ShippingAddressValidationStatus was instantiated with an + * unknown value. + */ + _UNKNOWN(null); + private final String value; + + ShippingAddressValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ShippingAddressValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ShippingAddressValidationStatus enumValue : ShippingAddressValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ContractTermActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** + * An enum member indicating that ContractTermActionAtTermEnd was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + ContractTermActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ContractTermActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ContractTermActionAtTermEnd enumValue : ContractTermActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionParams { + + private final Map queryParams; + + private SubscriptionParams(SubscriptionBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public SubscriptionBuilder toBuilder() { + SubscriptionBuilder builder = new SubscriptionBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private SubscriptionBuilder() {} + + public SubscriptionBuilder id(String value) { + queryParams.put("id", value); + return this; + } + + public SubscriptionBuilder planId(String value) { + queryParams.put("plan_id", value); + return this; + } + + public SubscriptionBuilder planQuantity(Integer value) { + queryParams.put("plan_quantity", value); + return this; + } + + public SubscriptionBuilder planQuantityInDecimal(String value) { + queryParams.put("plan_quantity_in_decimal", value); + return this; + } + + public SubscriptionBuilder planUnitPrice(Long value) { + queryParams.put("plan_unit_price", value); + return this; + } + + public SubscriptionBuilder planUnitPriceInDecimal(String value) { + queryParams.put("plan_unit_price_in_decimal", value); + return this; + } + + public SubscriptionBuilder setupFee(Long value) { + queryParams.put("setup_fee", value); + return this; + } + + public SubscriptionBuilder trialEnd(Timestamp value) { + queryParams.put("trial_end", value); + return this; + } + + public SubscriptionBuilder startDate(Timestamp value) { + queryParams.put("start_date", value); + return this; + } + + public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + queryParams.put("offline_payment_method", value); + return this; + } + + public SubscriptionBuilder freePeriod(Integer value) { + queryParams.put("free_period", value); + return this; + } + + public SubscriptionBuilder freePeriodUnit(FreePeriodUnit value) { + queryParams.put("free_period_unit", value); + return this; + } + + public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { + queryParams.put("contract_term_billing_cycle_on_renewal", value); + return this; + } + + public SubscriptionBuilder trialEndAction(TrialEndAction value) { + queryParams.put("trial_end_action", value); + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum FreePeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + FreePeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static FreePeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum TrialEndAction { + SITE_DEFAULT("site_default"), + + PLAN_DEFAULT("plan_default"), + + ACTIVATE_SUBSCRIPTION("activate_subscription"), + + CANCEL_SUBSCRIPTION("cancel_subscription"), + + /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + TrialEndAction(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static TrialEndAction fromString(String value) { + if (value == null) return _UNKNOWN; + for (TrialEndAction enumValue : TrialEndAction.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final Map queryParams; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public ShippingAddressBuilder toBuilder() { + ShippingAddressBuilder builder = new ShippingAddressBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder line1(String value) { + queryParams.put("line1", value); + return this; + } + + public ShippingAddressBuilder line2(String value) { + queryParams.put("line2", value); + return this; + } + + public ShippingAddressBuilder line3(String value) { + queryParams.put("line3", value); + return this; + } + + public ShippingAddressBuilder city(String value) { + queryParams.put("city", value); + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + queryParams.put("state_code", value); + return this; + } + + public ShippingAddressBuilder zip(String value) { + queryParams.put("zip", value); + return this; + } + + public ShippingAddressBuilder country(String value) { + queryParams.put("country", value); + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + queryParams.put("validation_status", value); + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ContractTermParams { + + private final Map queryParams; + + private ContractTermParams(ContractTermBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public ContractTermBuilder toBuilder() { + ContractTermBuilder builder = new ContractTermBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + queryParams.put("action_at_term_end", value); + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + queryParams.put("cancellation_cutoff_period", value); + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class AddonsParams { + + private final Map queryParams; + + private AddonsParams(AddonsBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public AddonsBuilder toBuilder() { + AddonsBuilder builder = new AddonsBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for AddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddonsBuilder builder() { + return new AddonsBuilder(); + } + + public static final class AddonsBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private AddonsBuilder() {} + + public AddonsBuilder id(List value) { + queryParams.put("id", value); + return this; + } + + public AddonsBuilder quantity(List value) { + queryParams.put("quantity", value); + return this; + } + + public AddonsBuilder quantityInDecimal(List value) { + queryParams.put("quantity_in_decimal", value); + return this; + } + + public AddonsBuilder unitPrice(List value) { + queryParams.put("unit_price", value); + return this; + } + + public AddonsBuilder unitPriceInDecimal(List value) { + queryParams.put("unit_price_in_decimal", value); + return this; + } + + public AddonsBuilder billingCycles(List value) { + queryParams.put("billing_cycles", value); + return this; + } + + public AddonsBuilder trialEnd(List value) { + queryParams.put("trial_end", value); + return this; + } + + public AddonsParams build() { + return new AddonsParams(this); + } + } + } + + public static final class EventBasedAddonsParams { + + private final Map queryParams; + + private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public EventBasedAddonsBuilder toBuilder() { + EventBasedAddonsBuilder builder = new EventBasedAddonsBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for EventBasedAddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EventBasedAddonsBuilder builder() { + return new EventBasedAddonsBuilder(); + } + + public static final class EventBasedAddonsBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private EventBasedAddonsBuilder() {} + + public EventBasedAddonsBuilder id(List value) { + queryParams.put("id", value); + return this; + } + + public EventBasedAddonsBuilder quantity(List value) { + queryParams.put("quantity", value); + return this; + } + + public EventBasedAddonsBuilder unitPrice(List value) { + queryParams.put("unit_price", value); + return this; + } + + public EventBasedAddonsBuilder quantityInDecimal(List value) { + queryParams.put("quantity_in_decimal", value); + return this; + } + + public EventBasedAddonsBuilder unitPriceInDecimal(List value) { + queryParams.put("unit_price_in_decimal", value); + return this; + } + + public EventBasedAddonsBuilder servicePeriodInDays(List value) { + queryParams.put("service_period_in_days", value); + return this; + } + + public EventBasedAddonsBuilder onEvent(List value) { + queryParams.put("on_event", value); + return this; + } + + public EventBasedAddonsBuilder chargeOnce(List value) { + queryParams.put("charge_once", value); + return this; + } + + public EventBasedAddonsBuilder chargeOn(List value) { + queryParams.put("charge_on", value); + return this; + } + + public EventBasedAddonsParams build() { + return new EventBasedAddonsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionForItemsEstimateForCustomerParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionForItemsEstimateForCustomerParams.java deleted file mode 100644 index b077d771..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionForItemsEstimateForCustomerParams.java +++ /dev/null @@ -1,2307 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class CreateSubscriptionForItemsEstimateForCustomerParams { - - private final Boolean useExistingBalances; - - private final Boolean invoiceImmediately; - - private final Integer billingCycles; - - private final List mandatoryItemsToRemove; - - private final Integer termsToCharge; - - private final BillingAlignmentMode billingAlignmentMode; - - private final Timestamp invoiceDate; - - private final List couponIds; - - private final SubscriptionParams subscription; - - private final ShippingAddressParams shippingAddress; - - private final BillingAddressParams billingAddress; - - private final ContractTermParams contractTerm; - - private final BillingOverrideParams billingOverride; - - private final List subscriptionItems; - - private final List discounts; - - private final List itemTiers; - - private CreateSubscriptionForItemsEstimateForCustomerParams( - CreateSubscriptionForItemsEstimateForCustomerBuilder builder) { - - this.useExistingBalances = builder.useExistingBalances; - - this.invoiceImmediately = builder.invoiceImmediately; - - this.billingCycles = builder.billingCycles; - - this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; - - this.termsToCharge = builder.termsToCharge; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.invoiceDate = builder.invoiceDate; - - this.couponIds = builder.couponIds; - - this.subscription = builder.subscription; - - this.shippingAddress = builder.shippingAddress; - - this.billingAddress = builder.billingAddress; - - this.contractTerm = builder.contractTerm; - - this.billingOverride = builder.billingOverride; - - this.subscriptionItems = builder.subscriptionItems; - - this.discounts = builder.discounts; - - this.itemTiers = builder.itemTiers; - } - - public Boolean getUseExistingBalances() { - return useExistingBalances; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public List getMandatoryItemsToRemove() { - return mandatoryItemsToRemove; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public List getCouponIds() { - return couponIds; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public BillingAddressParams getBillingAddress() { - return billingAddress; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public BillingOverrideParams getBillingOverride() { - return billingOverride; - } - - public List getSubscriptionItems() { - return subscriptionItems; - } - - public List getDiscounts() { - return discounts; - } - - public List getItemTiers() { - return itemTiers; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.useExistingBalances != null) { - - formData.put("use_existing_balances", this.useExistingBalances); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.mandatoryItemsToRemove != null) { - - formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.billingAddress != null) { - - // Single object - Map nestedData = this.billingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.billingOverride != null) { - - // Single object - Map nestedData = this.billingOverride.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_override[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.subscriptionItems != null) { - - // List of objects - for (int i = 0; i < this.subscriptionItems.size(); i++) { - SubscriptionItemsParams item = this.subscriptionItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discounts != null) { - - // List of objects - for (int i = 0; i < this.discounts.size(); i++) { - DiscountsParams item = this.discounts.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for CreateSubscriptionForItemsEstimateForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreateSubscriptionForItemsEstimateForCustomerBuilder builder() { - return new CreateSubscriptionForItemsEstimateForCustomerBuilder(); - } - - public static final class CreateSubscriptionForItemsEstimateForCustomerBuilder { - - private Boolean useExistingBalances; - - private Boolean invoiceImmediately; - - private Integer billingCycles; - - private List mandatoryItemsToRemove; - - private Integer termsToCharge; - - private BillingAlignmentMode billingAlignmentMode; - - private Timestamp invoiceDate; - - private List couponIds; - - private SubscriptionParams subscription; - - private ShippingAddressParams shippingAddress; - - private BillingAddressParams billingAddress; - - private ContractTermParams contractTerm; - - private BillingOverrideParams billingOverride; - - private List subscriptionItems; - - private List discounts; - - private List itemTiers; - - private CreateSubscriptionForItemsEstimateForCustomerBuilder() {} - - public CreateSubscriptionForItemsEstimateForCustomerBuilder useExistingBalances(Boolean value) { - this.useExistingBalances = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder mandatoryItemsToRemove( - List value) { - this.mandatoryItemsToRemove = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder billingAlignmentMode( - BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder subscription( - SubscriptionParams value) { - this.subscription = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder shippingAddress( - ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder billingAddress( - BillingAddressParams value) { - this.billingAddress = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder contractTerm( - ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder billingOverride( - BillingOverrideParams value) { - this.billingOverride = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder subscriptionItems( - List value) { - this.subscriptionItems = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder discounts( - List value) { - this.discounts = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerBuilder itemTiers( - List value) { - this.itemTiers = value; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerParams build() { - return new CreateSubscriptionForItemsEstimateForCustomerParams(this); - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionParams { - - private final String id; - - private final Timestamp trialEnd; - - private final Long setupFee; - - private final Timestamp startDate; - - private final OfflinePaymentMethod offlinePaymentMethod; - - private final Integer freePeriod; - - private final FreePeriodUnit freePeriodUnit; - - private final Integer contractTermBillingCycleOnRenewal; - - private final TrialEndAction trialEndAction; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.id = builder.id; - - this.trialEnd = builder.trialEnd; - - this.setupFee = builder.setupFee; - - this.startDate = builder.startDate; - - this.offlinePaymentMethod = builder.offlinePaymentMethod; - - this.freePeriod = builder.freePeriod; - - this.freePeriodUnit = builder.freePeriodUnit; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - - this.trialEndAction = builder.trialEndAction; - } - - public String getId() { - return id; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Long getSetupFee() { - return setupFee; - } - - public Timestamp getStartDate() { - return startDate; - } - - public OfflinePaymentMethod getOfflinePaymentMethod() { - return offlinePaymentMethod; - } - - public Integer getFreePeriod() { - return freePeriod; - } - - public FreePeriodUnit getFreePeriodUnit() { - return freePeriodUnit; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - public TrialEndAction getTrialEndAction() { - return trialEndAction; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.offlinePaymentMethod != null) { - - formData.put("offline_payment_method", this.offlinePaymentMethod); - } - - if (this.freePeriod != null) { - - formData.put("free_period", this.freePeriod); - } - - if (this.freePeriodUnit != null) { - - formData.put("free_period_unit", this.freePeriodUnit); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - if (this.trialEndAction != null) { - - formData.put("trial_end_action", this.trialEndAction); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private String id; - - private Timestamp trialEnd; - - private Long setupFee; - - private Timestamp startDate; - - private OfflinePaymentMethod offlinePaymentMethod; - - private Integer freePeriod; - - private FreePeriodUnit freePeriodUnit; - - private Integer contractTermBillingCycleOnRenewal; - - private TrialEndAction trialEndAction; - - private SubscriptionBuilder() {} - - public SubscriptionBuilder id(String value) { - this.id = value; - return this; - } - - public SubscriptionBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - @Deprecated - public SubscriptionBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public SubscriptionBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - this.offlinePaymentMethod = value; - return this; - } - - public SubscriptionBuilder freePeriod(Integer value) { - this.freePeriod = value; - return this; - } - - public SubscriptionBuilder freePeriodUnit(FreePeriodUnit value) { - this.freePeriodUnit = value; - return this; - } - - public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public SubscriptionBuilder trialEndAction(TrialEndAction value) { - this.trialEndAction = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum FreePeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - FreePeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static FreePeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum TrialEndAction { - SITE_DEFAULT("site_default"), - - PLAN_DEFAULT("plan_default"), - - ACTIVATE_SUBSCRIPTION("activate_subscription"), - - CANCEL_SUBSCRIPTION("cancel_subscription"), - - /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - TrialEndAction(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static TrialEndAction fromString(String value) { - if (value == null) return _UNKNOWN; - for (TrialEndAction enumValue : TrialEndAction.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class BillingAddressParams { - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private BillingAddressParams(BillingAddressBuilder builder) { - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for BillingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingAddressBuilder builder() { - return new BillingAddressBuilder(); - } - - public static final class BillingAddressBuilder { - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private BillingAddressBuilder() {} - - public BillingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public BillingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public BillingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public BillingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public BillingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public BillingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public BillingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public BillingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public BillingAddressParams build() { - return new BillingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Timestamp contractStart; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.contractStart = builder.contractStart; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Timestamp getContractStart() { - return contractStart; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.contractStart != null) { - - formData.put("contract_start", this.contractStart); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Timestamp contractStart; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - @Deprecated - public ContractTermBuilder contractStart(Timestamp value) { - this.contractStart = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class BillingOverrideParams { - - private final Long maxExcessPaymentUsage; - - private final Long maxRefundableCreditsUsage; - - private BillingOverrideParams(BillingOverrideBuilder builder) { - - this.maxExcessPaymentUsage = builder.maxExcessPaymentUsage; - - this.maxRefundableCreditsUsage = builder.maxRefundableCreditsUsage; - } - - public Long getMaxExcessPaymentUsage() { - return maxExcessPaymentUsage; - } - - public Long getMaxRefundableCreditsUsage() { - return maxRefundableCreditsUsage; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.maxExcessPaymentUsage != null) { - - formData.put("max_excess_payment_usage", this.maxExcessPaymentUsage); - } - - if (this.maxRefundableCreditsUsage != null) { - - formData.put("max_refundable_credits_usage", this.maxRefundableCreditsUsage); - } - - return formData; - } - - /** Create a new builder for BillingOverrideParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingOverrideBuilder builder() { - return new BillingOverrideBuilder(); - } - - public static final class BillingOverrideBuilder { - - private Long maxExcessPaymentUsage; - - private Long maxRefundableCreditsUsage; - - private BillingOverrideBuilder() {} - - public BillingOverrideBuilder maxExcessPaymentUsage(Long value) { - this.maxExcessPaymentUsage = value; - return this; - } - - public BillingOverrideBuilder maxRefundableCreditsUsage(Long value) { - this.maxRefundableCreditsUsage = value; - return this; - } - - public BillingOverrideParams build() { - return new BillingOverrideParams(this); - } - } - } - - public static final class SubscriptionItemsParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Timestamp trialEnd; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ItemType itemType; - - private final ChargeOnOption chargeOnOption; - - private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.trialEnd = builder.trialEnd; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.itemType = builder.itemType; - - this.chargeOnOption = builder.chargeOnOption; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ItemType getItemType() { - return itemType; - } - - public ChargeOnOption getChargeOnOption() { - return chargeOnOption; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.itemType != null) { - - formData.put("item_type", this.itemType); - } - - if (this.chargeOnOption != null) { - - formData.put("charge_on_option", this.chargeOnOption); - } - - return formData; - } - - /** Create a new builder for SubscriptionItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionItemsBuilder builder() { - return new SubscriptionItemsBuilder(); - } - - public static final class SubscriptionItemsBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Timestamp trialEnd; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ItemType itemType; - - private ChargeOnOption chargeOnOption; - - private SubscriptionItemsBuilder() {} - - public SubscriptionItemsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public SubscriptionItemsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public SubscriptionItemsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public SubscriptionItemsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public SubscriptionItemsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionItemsBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public SubscriptionItemsBuilder itemType(ItemType value) { - this.itemType = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { - this.chargeOnOption = value; - return this; - } - - public SubscriptionItemsParams build() { - return new SubscriptionItemsParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ItemType { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemType enumValue : ItemType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnOption { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnOption enumValue : ChargeOnOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class DiscountsParams { - - private final ApplyOn applyOn; - - private final DurationType durationType; - - private final Number percentage; - - private final Long amount; - - private final Integer period; - - private final PeriodUnit periodUnit; - - private final Boolean includedInMrr; - - private final String itemPriceId; - - private final Integer quantity; - - private DiscountsParams(DiscountsBuilder builder) { - - this.applyOn = builder.applyOn; - - this.durationType = builder.durationType; - - this.percentage = builder.percentage; - - this.amount = builder.amount; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - - this.includedInMrr = builder.includedInMrr; - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public DurationType getDurationType() { - return durationType; - } - - public Number getPercentage() { - return percentage; - } - - public Long getAmount() { - return amount; - } - - public Integer getPeriod() { - return period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public Boolean getIncludedInMrr() { - return includedInMrr; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.durationType != null) { - - formData.put("duration_type", this.durationType); - } - - if (this.percentage != null) { - - formData.put("percentage", this.percentage); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.includedInMrr != null) { - - formData.put("included_in_mrr", this.includedInMrr); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - return formData; - } - - /** Create a new builder for DiscountsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsBuilder builder() { - return new DiscountsBuilder(); - } - - public static final class DiscountsBuilder { - - private ApplyOn applyOn; - - private DurationType durationType; - - private Number percentage; - - private Long amount; - - private Integer period; - - private PeriodUnit periodUnit; - - private Boolean includedInMrr; - - private String itemPriceId; - - private Integer quantity; - - private DiscountsBuilder() {} - - public DiscountsBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public DiscountsBuilder durationType(DurationType value) { - this.durationType = value; - return this; - } - - public DiscountsBuilder percentage(Number value) { - this.percentage = value; - return this; - } - - public DiscountsBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsBuilder period(Integer value) { - this.period = value; - return this; - } - - public DiscountsBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public DiscountsBuilder includedInMrr(Boolean value) { - this.includedInMrr = value; - return this; - } - - public DiscountsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DiscountsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public DiscountsParams build() { - return new DiscountsParams(this); - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIC_ITEM_PRICE("specific_item_price"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum DurationType { - ONE_TIME("one_time"), - - FOREVER("forever"), - - LIMITED_PERIOD("limited_period"), - - /** An enum member indicating that DurationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DurationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DurationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DurationType enumValue : DurationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemTiersParams { - - private final String itemPriceId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private String itemPriceId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionItemEstimateParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionItemEstimateParams.java new file mode 100644 index 00000000..1a6698cb --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionItemEstimateParams.java @@ -0,0 +1,2680 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class CreateSubscriptionItemEstimateParams { + + private final Integer billingCycles; + + private final List mandatoryItemsToRemove; + + private final Integer termsToCharge; + + private final BillingAlignmentMode billingAlignmentMode; + + private final List couponIds; + + private final Boolean invoiceImmediately; + + private final Timestamp invoiceDate; + + private final String clientProfileId; + + private final SubscriptionParams subscription; + + private final BillingAddressParams billingAddress; + + private final ShippingAddressParams shippingAddress; + + private final CustomerParams customer; + + private final ContractTermParams contractTerm; + + private final List subscriptionItems; + + private final List discounts; + + private final List itemTiers; + + private final List taxProvidersFields; + + private CreateSubscriptionItemEstimateParams(CreateSubscriptionItemEstimateBuilder builder) { + + this.billingCycles = builder.billingCycles; + + this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; + + this.termsToCharge = builder.termsToCharge; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.couponIds = builder.couponIds; + + this.invoiceImmediately = builder.invoiceImmediately; + + this.invoiceDate = builder.invoiceDate; + + this.clientProfileId = builder.clientProfileId; + + this.subscription = builder.subscription; + + this.billingAddress = builder.billingAddress; + + this.shippingAddress = builder.shippingAddress; + + this.customer = builder.customer; + + this.contractTerm = builder.contractTerm; + + this.subscriptionItems = builder.subscriptionItems; + + this.discounts = builder.discounts; + + this.itemTiers = builder.itemTiers; + + this.taxProvidersFields = builder.taxProvidersFields; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public List getMandatoryItemsToRemove() { + return mandatoryItemsToRemove; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public List getCouponIds() { + return couponIds; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public String getClientProfileId() { + return clientProfileId; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + public BillingAddressParams getBillingAddress() { + return billingAddress; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public CustomerParams getCustomer() { + return customer; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public List getSubscriptionItems() { + return subscriptionItems; + } + + public List getDiscounts() { + return discounts; + } + + public List getItemTiers() { + return itemTiers; + } + + public List getTaxProvidersFields() { + return taxProvidersFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.mandatoryItemsToRemove != null) { + + formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.clientProfileId != null) { + + formData.put("client_profile_id", this.clientProfileId); + } + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.billingAddress != null) { + + // Single object + Map nestedData = this.billingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.customer != null) { + + // Single object + Map nestedData = this.customer.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "customer[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.subscriptionItems != null) { + + // List of objects + for (int i = 0; i < this.subscriptionItems.size(); i++) { + SubscriptionItemsParams item = this.subscriptionItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discounts != null) { + + // List of objects + for (int i = 0; i < this.discounts.size(); i++) { + DiscountsParams item = this.discounts.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.taxProvidersFields != null) { + + // List of objects + for (int i = 0; i < this.taxProvidersFields.size(); i++) { + TaxProvidersFieldsParams item = this.taxProvidersFields.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "tax_providers_fields[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for CreateSubscriptionItemEstimateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreateSubscriptionItemEstimateBuilder builder() { + return new CreateSubscriptionItemEstimateBuilder(); + } + + public static final class CreateSubscriptionItemEstimateBuilder { + + private Integer billingCycles; + + private List mandatoryItemsToRemove; + + private Integer termsToCharge; + + private BillingAlignmentMode billingAlignmentMode; + + private List couponIds; + + private Boolean invoiceImmediately; + + private Timestamp invoiceDate; + + private String clientProfileId; + + private SubscriptionParams subscription; + + private BillingAddressParams billingAddress; + + private ShippingAddressParams shippingAddress; + + private CustomerParams customer; + + private ContractTermParams contractTerm; + + private List subscriptionItems; + + private List discounts; + + private List itemTiers; + + private List taxProvidersFields; + + private CreateSubscriptionItemEstimateBuilder() {} + + public CreateSubscriptionItemEstimateBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder mandatoryItemsToRemove(List value) { + this.mandatoryItemsToRemove = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder billingAlignmentMode(BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder clientProfileId(String value) { + this.clientProfileId = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder subscription(SubscriptionParams value) { + this.subscription = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder billingAddress(BillingAddressParams value) { + this.billingAddress = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder customer(CustomerParams value) { + this.customer = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder subscriptionItems( + List value) { + this.subscriptionItems = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder discounts(List value) { + this.discounts = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder itemTiers(List value) { + this.itemTiers = value; + return this; + } + + public CreateSubscriptionItemEstimateBuilder taxProvidersFields( + List value) { + this.taxProvidersFields = value; + return this; + } + + public CreateSubscriptionItemEstimateParams build() { + return new CreateSubscriptionItemEstimateParams(this); + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionParams { + + private final String id; + + private final Timestamp trialEnd; + + private final Long setupFee; + + private final Timestamp startDate; + + private final String coupon; + + private final OfflinePaymentMethod offlinePaymentMethod; + + private final Integer freePeriod; + + private final FreePeriodUnit freePeriodUnit; + + private final Integer contractTermBillingCycleOnRenewal; + + private final TrialEndAction trialEndAction; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.id = builder.id; + + this.trialEnd = builder.trialEnd; + + this.setupFee = builder.setupFee; + + this.startDate = builder.startDate; + + this.coupon = builder.coupon; + + this.offlinePaymentMethod = builder.offlinePaymentMethod; + + this.freePeriod = builder.freePeriod; + + this.freePeriodUnit = builder.freePeriodUnit; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + + this.trialEndAction = builder.trialEndAction; + } + + public String getId() { + return id; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Long getSetupFee() { + return setupFee; + } + + public Timestamp getStartDate() { + return startDate; + } + + public String getCoupon() { + return coupon; + } + + public OfflinePaymentMethod getOfflinePaymentMethod() { + return offlinePaymentMethod; + } + + public Integer getFreePeriod() { + return freePeriod; + } + + public FreePeriodUnit getFreePeriodUnit() { + return freePeriodUnit; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + public TrialEndAction getTrialEndAction() { + return trialEndAction; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.coupon != null) { + + formData.put("coupon", this.coupon); + } + + if (this.offlinePaymentMethod != null) { + + formData.put("offline_payment_method", this.offlinePaymentMethod); + } + + if (this.freePeriod != null) { + + formData.put("free_period", this.freePeriod); + } + + if (this.freePeriodUnit != null) { + + formData.put("free_period_unit", this.freePeriodUnit); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + if (this.trialEndAction != null) { + + formData.put("trial_end_action", this.trialEndAction); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private String id; + + private Timestamp trialEnd; + + private Long setupFee; + + private Timestamp startDate; + + private String coupon; + + private OfflinePaymentMethod offlinePaymentMethod; + + private Integer freePeriod; + + private FreePeriodUnit freePeriodUnit; + + private Integer contractTermBillingCycleOnRenewal; + + private TrialEndAction trialEndAction; + + private SubscriptionBuilder() {} + + public SubscriptionBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + @Deprecated + public SubscriptionBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + @Deprecated + public SubscriptionBuilder coupon(String value) { + this.coupon = value; + return this; + } + + public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + this.offlinePaymentMethod = value; + return this; + } + + public SubscriptionBuilder freePeriod(Integer value) { + this.freePeriod = value; + return this; + } + + public SubscriptionBuilder freePeriodUnit(FreePeriodUnit value) { + this.freePeriodUnit = value; + return this; + } + + public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionBuilder trialEndAction(TrialEndAction value) { + this.trialEndAction = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum FreePeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + FreePeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static FreePeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum TrialEndAction { + SITE_DEFAULT("site_default"), + + PLAN_DEFAULT("plan_default"), + + ACTIVATE_SUBSCRIPTION("activate_subscription"), + + CANCEL_SUBSCRIPTION("cancel_subscription"), + + /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + TrialEndAction(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static TrialEndAction fromString(String value) { + if (value == null) return _UNKNOWN; + for (TrialEndAction enumValue : TrialEndAction.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class BillingAddressParams { + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private BillingAddressParams(BillingAddressBuilder builder) { + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for BillingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingAddressBuilder builder() { + return new BillingAddressBuilder(); + } + + public static final class BillingAddressBuilder { + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private BillingAddressBuilder() {} + + public BillingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public BillingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public BillingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public BillingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public BillingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public BillingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public BillingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public BillingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public BillingAddressParams build() { + return new BillingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CustomerParams { + + private final String vatNumber; + + private final String vatNumberPrefix; + + private final Boolean registeredForGst; + + private final Taxability taxability; + + private final EntityCode entityCode; + + private final String exemptNumber; + + private final List exemptionDetails; + + private final CustomerType customerType; + + private CustomerParams(CustomerBuilder builder) { + + this.vatNumber = builder.vatNumber; + + this.vatNumberPrefix = builder.vatNumberPrefix; + + this.registeredForGst = builder.registeredForGst; + + this.taxability = builder.taxability; + + this.entityCode = builder.entityCode; + + this.exemptNumber = builder.exemptNumber; + + this.exemptionDetails = builder.exemptionDetails; + + this.customerType = builder.customerType; + } + + public String getVatNumber() { + return vatNumber; + } + + public String getVatNumberPrefix() { + return vatNumberPrefix; + } + + public Boolean getRegisteredForGst() { + return registeredForGst; + } + + public Taxability getTaxability() { + return taxability; + } + + public EntityCode getEntityCode() { + return entityCode; + } + + public String getExemptNumber() { + return exemptNumber; + } + + public List getExemptionDetails() { + return exemptionDetails; + } + + public CustomerType getCustomerType() { + return customerType; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.vatNumber != null) { + + formData.put("vat_number", this.vatNumber); + } + + if (this.vatNumberPrefix != null) { + + formData.put("vat_number_prefix", this.vatNumberPrefix); + } + + if (this.registeredForGst != null) { + + formData.put("registered_for_gst", this.registeredForGst); + } + + if (this.taxability != null) { + + formData.put("taxability", this.taxability); + } + + if (this.entityCode != null) { + + formData.put("entity_code", this.entityCode); + } + + if (this.exemptNumber != null) { + + formData.put("exempt_number", this.exemptNumber); + } + + if (this.exemptionDetails != null) { + + formData.put("exemption_details", JsonUtil.toJson(this.exemptionDetails)); + } + + if (this.customerType != null) { + + formData.put("customer_type", this.customerType); + } + + return formData; + } + + /** Create a new builder for CustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerBuilder builder() { + return new CustomerBuilder(); + } + + public static final class CustomerBuilder { + + private String vatNumber; + + private String vatNumberPrefix; + + private Boolean registeredForGst; + + private Taxability taxability; + + private EntityCode entityCode; + + private String exemptNumber; + + private List exemptionDetails; + + private CustomerType customerType; + + private CustomerBuilder() {} + + public CustomerBuilder vatNumber(String value) { + this.vatNumber = value; + return this; + } + + public CustomerBuilder vatNumberPrefix(String value) { + this.vatNumberPrefix = value; + return this; + } + + public CustomerBuilder registeredForGst(Boolean value) { + this.registeredForGst = value; + return this; + } + + public CustomerBuilder taxability(Taxability value) { + this.taxability = value; + return this; + } + + public CustomerBuilder entityCode(EntityCode value) { + this.entityCode = value; + return this; + } + + public CustomerBuilder exemptNumber(String value) { + this.exemptNumber = value; + return this; + } + + public CustomerBuilder exemptionDetails(List value) { + this.exemptionDetails = value; + return this; + } + + public CustomerBuilder customerType(CustomerType value) { + this.customerType = value; + return this; + } + + public CustomerParams build() { + return new CustomerParams(this); + } + } + + public enum Taxability { + TAXABLE("taxable"), + + EXEMPT("exempt"), + + /** An enum member indicating that Taxability was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Taxability(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Taxability fromString(String value) { + if (value == null) return _UNKNOWN; + for (Taxability enumValue : Taxability.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum EntityCode { + A("a"), + + B("b"), + + C("c"), + + D("d"), + + E("e"), + + F("f"), + + G("g"), + + H("h"), + + I("i"), + + J("j"), + + K("k"), + + L("l"), + + M("m"), + + N("n"), + + P("p"), + + Q("q"), + + R("r"), + + MED_1("med1"), + + MED_2("med2"), + + /** An enum member indicating that EntityCode was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + EntityCode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EntityCode fromString(String value) { + if (value == null) return _UNKNOWN; + for (EntityCode enumValue : EntityCode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum CustomerType { + RESIDENTIAL("residential"), + + BUSINESS("business"), + + SENIOR_CITIZEN("senior_citizen"), + + INDUSTRIAL("industrial"), + + /** An enum member indicating that CustomerType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + CustomerType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CustomerType fromString(String value) { + if (value == null) return _UNKNOWN; + for (CustomerType enumValue : CustomerType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Timestamp contractStart; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.contractStart = builder.contractStart; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Timestamp getContractStart() { + return contractStart; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.contractStart != null) { + + formData.put("contract_start", this.contractStart); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Timestamp contractStart; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + @Deprecated + public ContractTermBuilder contractStart(Timestamp value) { + this.contractStart = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class SubscriptionItemsParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Timestamp trialEnd; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ItemType itemType; + + private final ChargeOnOption chargeOnOption; + + private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.trialEnd = builder.trialEnd; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.itemType = builder.itemType; + + this.chargeOnOption = builder.chargeOnOption; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ItemType getItemType() { + return itemType; + } + + public ChargeOnOption getChargeOnOption() { + return chargeOnOption; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.itemType != null) { + + formData.put("item_type", this.itemType); + } + + if (this.chargeOnOption != null) { + + formData.put("charge_on_option", this.chargeOnOption); + } + + return formData; + } + + /** Create a new builder for SubscriptionItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionItemsBuilder builder() { + return new SubscriptionItemsBuilder(); + } + + public static final class SubscriptionItemsBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Timestamp trialEnd; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ItemType itemType; + + private ChargeOnOption chargeOnOption; + + private SubscriptionItemsBuilder() {} + + public SubscriptionItemsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public SubscriptionItemsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public SubscriptionItemsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public SubscriptionItemsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public SubscriptionItemsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionItemsBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public SubscriptionItemsBuilder itemType(ItemType value) { + this.itemType = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { + this.chargeOnOption = value; + return this; + } + + public SubscriptionItemsParams build() { + return new SubscriptionItemsParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ItemType { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemType enumValue : ItemType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnOption { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnOption enumValue : ChargeOnOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class DiscountsParams { + + private final ApplyOn applyOn; + + private final DurationType durationType; + + private final Number percentage; + + private final Long amount; + + private final Integer period; + + private final PeriodUnit periodUnit; + + private final Boolean includedInMrr; + + private final String itemPriceId; + + private final Integer quantity; + + private DiscountsParams(DiscountsBuilder builder) { + + this.applyOn = builder.applyOn; + + this.durationType = builder.durationType; + + this.percentage = builder.percentage; + + this.amount = builder.amount; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + + this.includedInMrr = builder.includedInMrr; + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public DurationType getDurationType() { + return durationType; + } + + public Number getPercentage() { + return percentage; + } + + public Long getAmount() { + return amount; + } + + public Integer getPeriod() { + return period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public Boolean getIncludedInMrr() { + return includedInMrr; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.durationType != null) { + + formData.put("duration_type", this.durationType); + } + + if (this.percentage != null) { + + formData.put("percentage", this.percentage); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.includedInMrr != null) { + + formData.put("included_in_mrr", this.includedInMrr); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + return formData; + } + + /** Create a new builder for DiscountsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsBuilder builder() { + return new DiscountsBuilder(); + } + + public static final class DiscountsBuilder { + + private ApplyOn applyOn; + + private DurationType durationType; + + private Number percentage; + + private Long amount; + + private Integer period; + + private PeriodUnit periodUnit; + + private Boolean includedInMrr; + + private String itemPriceId; + + private Integer quantity; + + private DiscountsBuilder() {} + + public DiscountsBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public DiscountsBuilder durationType(DurationType value) { + this.durationType = value; + return this; + } + + public DiscountsBuilder percentage(Number value) { + this.percentage = value; + return this; + } + + public DiscountsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsBuilder period(Integer value) { + this.period = value; + return this; + } + + public DiscountsBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public DiscountsBuilder includedInMrr(Boolean value) { + this.includedInMrr = value; + return this; + } + + public DiscountsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DiscountsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public DiscountsParams build() { + return new DiscountsParams(this); + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIC_ITEM_PRICE("specific_item_price"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum DurationType { + ONE_TIME("one_time"), + + FOREVER("forever"), + + LIMITED_PERIOD("limited_period"), + + /** An enum member indicating that DurationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DurationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DurationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DurationType enumValue : DurationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemTiersParams { + + private final String itemPriceId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private String itemPriceId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class TaxProvidersFieldsParams { + + private final String providerName; + + private final String fieldId; + + private final String fieldValue; + + private TaxProvidersFieldsParams(TaxProvidersFieldsBuilder builder) { + + this.providerName = builder.providerName; + + this.fieldId = builder.fieldId; + + this.fieldValue = builder.fieldValue; + } + + public String getProviderName() { + return providerName; + } + + public String getFieldId() { + return fieldId; + } + + public String getFieldValue() { + return fieldValue; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.providerName != null) { + + formData.put("provider_name", this.providerName); + } + + if (this.fieldId != null) { + + formData.put("field_id", this.fieldId); + } + + if (this.fieldValue != null) { + + formData.put("field_value", this.fieldValue); + } + + return formData; + } + + /** Create a new builder for TaxProvidersFieldsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TaxProvidersFieldsBuilder builder() { + return new TaxProvidersFieldsBuilder(); + } + + public static final class TaxProvidersFieldsBuilder { + + private String providerName; + + private String fieldId; + + private String fieldValue; + + private TaxProvidersFieldsBuilder() {} + + public TaxProvidersFieldsBuilder providerName(String value) { + this.providerName = value; + return this; + } + + public TaxProvidersFieldsBuilder fieldId(String value) { + this.fieldId = value; + return this; + } + + public TaxProvidersFieldsBuilder fieldValue(String value) { + this.fieldValue = value; + return this; + } + + public TaxProvidersFieldsParams build() { + return new TaxProvidersFieldsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionItemForCustomerEstimateParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionItemForCustomerEstimateParams.java new file mode 100644 index 00000000..c1aaea24 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/CreateSubscriptionItemForCustomerEstimateParams.java @@ -0,0 +1,2303 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class CreateSubscriptionItemForCustomerEstimateParams { + + private final Boolean useExistingBalances; + + private final Boolean invoiceImmediately; + + private final Integer billingCycles; + + private final List mandatoryItemsToRemove; + + private final Integer termsToCharge; + + private final BillingAlignmentMode billingAlignmentMode; + + private final Timestamp invoiceDate; + + private final List couponIds; + + private final SubscriptionParams subscription; + + private final ShippingAddressParams shippingAddress; + + private final BillingAddressParams billingAddress; + + private final ContractTermParams contractTerm; + + private final BillingOverrideParams billingOverride; + + private final List subscriptionItems; + + private final List discounts; + + private final List itemTiers; + + private CreateSubscriptionItemForCustomerEstimateParams( + CreateSubscriptionItemForCustomerEstimateBuilder builder) { + + this.useExistingBalances = builder.useExistingBalances; + + this.invoiceImmediately = builder.invoiceImmediately; + + this.billingCycles = builder.billingCycles; + + this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; + + this.termsToCharge = builder.termsToCharge; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.invoiceDate = builder.invoiceDate; + + this.couponIds = builder.couponIds; + + this.subscription = builder.subscription; + + this.shippingAddress = builder.shippingAddress; + + this.billingAddress = builder.billingAddress; + + this.contractTerm = builder.contractTerm; + + this.billingOverride = builder.billingOverride; + + this.subscriptionItems = builder.subscriptionItems; + + this.discounts = builder.discounts; + + this.itemTiers = builder.itemTiers; + } + + public Boolean getUseExistingBalances() { + return useExistingBalances; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public List getMandatoryItemsToRemove() { + return mandatoryItemsToRemove; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public List getCouponIds() { + return couponIds; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public BillingAddressParams getBillingAddress() { + return billingAddress; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public BillingOverrideParams getBillingOverride() { + return billingOverride; + } + + public List getSubscriptionItems() { + return subscriptionItems; + } + + public List getDiscounts() { + return discounts; + } + + public List getItemTiers() { + return itemTiers; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.useExistingBalances != null) { + + formData.put("use_existing_balances", this.useExistingBalances); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.mandatoryItemsToRemove != null) { + + formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.billingAddress != null) { + + // Single object + Map nestedData = this.billingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.billingOverride != null) { + + // Single object + Map nestedData = this.billingOverride.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_override[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.subscriptionItems != null) { + + // List of objects + for (int i = 0; i < this.subscriptionItems.size(); i++) { + SubscriptionItemsParams item = this.subscriptionItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discounts != null) { + + // List of objects + for (int i = 0; i < this.discounts.size(); i++) { + DiscountsParams item = this.discounts.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for CreateSubscriptionItemForCustomerEstimateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreateSubscriptionItemForCustomerEstimateBuilder builder() { + return new CreateSubscriptionItemForCustomerEstimateBuilder(); + } + + public static final class CreateSubscriptionItemForCustomerEstimateBuilder { + + private Boolean useExistingBalances; + + private Boolean invoiceImmediately; + + private Integer billingCycles; + + private List mandatoryItemsToRemove; + + private Integer termsToCharge; + + private BillingAlignmentMode billingAlignmentMode; + + private Timestamp invoiceDate; + + private List couponIds; + + private SubscriptionParams subscription; + + private ShippingAddressParams shippingAddress; + + private BillingAddressParams billingAddress; + + private ContractTermParams contractTerm; + + private BillingOverrideParams billingOverride; + + private List subscriptionItems; + + private List discounts; + + private List itemTiers; + + private CreateSubscriptionItemForCustomerEstimateBuilder() {} + + public CreateSubscriptionItemForCustomerEstimateBuilder useExistingBalances(Boolean value) { + this.useExistingBalances = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder mandatoryItemsToRemove( + List value) { + this.mandatoryItemsToRemove = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder billingAlignmentMode( + BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder subscription(SubscriptionParams value) { + this.subscription = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder shippingAddress( + ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder billingAddress( + BillingAddressParams value) { + this.billingAddress = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder billingOverride( + BillingOverrideParams value) { + this.billingOverride = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder subscriptionItems( + List value) { + this.subscriptionItems = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder discounts(List value) { + this.discounts = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateBuilder itemTiers(List value) { + this.itemTiers = value; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateParams build() { + return new CreateSubscriptionItemForCustomerEstimateParams(this); + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionParams { + + private final String id; + + private final Timestamp trialEnd; + + private final Long setupFee; + + private final Timestamp startDate; + + private final OfflinePaymentMethod offlinePaymentMethod; + + private final Integer freePeriod; + + private final FreePeriodUnit freePeriodUnit; + + private final Integer contractTermBillingCycleOnRenewal; + + private final TrialEndAction trialEndAction; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.id = builder.id; + + this.trialEnd = builder.trialEnd; + + this.setupFee = builder.setupFee; + + this.startDate = builder.startDate; + + this.offlinePaymentMethod = builder.offlinePaymentMethod; + + this.freePeriod = builder.freePeriod; + + this.freePeriodUnit = builder.freePeriodUnit; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + + this.trialEndAction = builder.trialEndAction; + } + + public String getId() { + return id; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Long getSetupFee() { + return setupFee; + } + + public Timestamp getStartDate() { + return startDate; + } + + public OfflinePaymentMethod getOfflinePaymentMethod() { + return offlinePaymentMethod; + } + + public Integer getFreePeriod() { + return freePeriod; + } + + public FreePeriodUnit getFreePeriodUnit() { + return freePeriodUnit; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + public TrialEndAction getTrialEndAction() { + return trialEndAction; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.offlinePaymentMethod != null) { + + formData.put("offline_payment_method", this.offlinePaymentMethod); + } + + if (this.freePeriod != null) { + + formData.put("free_period", this.freePeriod); + } + + if (this.freePeriodUnit != null) { + + formData.put("free_period_unit", this.freePeriodUnit); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + if (this.trialEndAction != null) { + + formData.put("trial_end_action", this.trialEndAction); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private String id; + + private Timestamp trialEnd; + + private Long setupFee; + + private Timestamp startDate; + + private OfflinePaymentMethod offlinePaymentMethod; + + private Integer freePeriod; + + private FreePeriodUnit freePeriodUnit; + + private Integer contractTermBillingCycleOnRenewal; + + private TrialEndAction trialEndAction; + + private SubscriptionBuilder() {} + + public SubscriptionBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + @Deprecated + public SubscriptionBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + this.offlinePaymentMethod = value; + return this; + } + + public SubscriptionBuilder freePeriod(Integer value) { + this.freePeriod = value; + return this; + } + + public SubscriptionBuilder freePeriodUnit(FreePeriodUnit value) { + this.freePeriodUnit = value; + return this; + } + + public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionBuilder trialEndAction(TrialEndAction value) { + this.trialEndAction = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum FreePeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + FreePeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static FreePeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum TrialEndAction { + SITE_DEFAULT("site_default"), + + PLAN_DEFAULT("plan_default"), + + ACTIVATE_SUBSCRIPTION("activate_subscription"), + + CANCEL_SUBSCRIPTION("cancel_subscription"), + + /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + TrialEndAction(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static TrialEndAction fromString(String value) { + if (value == null) return _UNKNOWN; + for (TrialEndAction enumValue : TrialEndAction.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class BillingAddressParams { + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private BillingAddressParams(BillingAddressBuilder builder) { + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for BillingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingAddressBuilder builder() { + return new BillingAddressBuilder(); + } + + public static final class BillingAddressBuilder { + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private BillingAddressBuilder() {} + + public BillingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public BillingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public BillingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public BillingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public BillingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public BillingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public BillingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public BillingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public BillingAddressParams build() { + return new BillingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Timestamp contractStart; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.contractStart = builder.contractStart; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Timestamp getContractStart() { + return contractStart; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.contractStart != null) { + + formData.put("contract_start", this.contractStart); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Timestamp contractStart; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + @Deprecated + public ContractTermBuilder contractStart(Timestamp value) { + this.contractStart = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class BillingOverrideParams { + + private final Long maxExcessPaymentUsage; + + private final Long maxRefundableCreditsUsage; + + private BillingOverrideParams(BillingOverrideBuilder builder) { + + this.maxExcessPaymentUsage = builder.maxExcessPaymentUsage; + + this.maxRefundableCreditsUsage = builder.maxRefundableCreditsUsage; + } + + public Long getMaxExcessPaymentUsage() { + return maxExcessPaymentUsage; + } + + public Long getMaxRefundableCreditsUsage() { + return maxRefundableCreditsUsage; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.maxExcessPaymentUsage != null) { + + formData.put("max_excess_payment_usage", this.maxExcessPaymentUsage); + } + + if (this.maxRefundableCreditsUsage != null) { + + formData.put("max_refundable_credits_usage", this.maxRefundableCreditsUsage); + } + + return formData; + } + + /** Create a new builder for BillingOverrideParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingOverrideBuilder builder() { + return new BillingOverrideBuilder(); + } + + public static final class BillingOverrideBuilder { + + private Long maxExcessPaymentUsage; + + private Long maxRefundableCreditsUsage; + + private BillingOverrideBuilder() {} + + public BillingOverrideBuilder maxExcessPaymentUsage(Long value) { + this.maxExcessPaymentUsage = value; + return this; + } + + public BillingOverrideBuilder maxRefundableCreditsUsage(Long value) { + this.maxRefundableCreditsUsage = value; + return this; + } + + public BillingOverrideParams build() { + return new BillingOverrideParams(this); + } + } + } + + public static final class SubscriptionItemsParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Timestamp trialEnd; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ItemType itemType; + + private final ChargeOnOption chargeOnOption; + + private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.trialEnd = builder.trialEnd; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.itemType = builder.itemType; + + this.chargeOnOption = builder.chargeOnOption; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ItemType getItemType() { + return itemType; + } + + public ChargeOnOption getChargeOnOption() { + return chargeOnOption; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.itemType != null) { + + formData.put("item_type", this.itemType); + } + + if (this.chargeOnOption != null) { + + formData.put("charge_on_option", this.chargeOnOption); + } + + return formData; + } + + /** Create a new builder for SubscriptionItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionItemsBuilder builder() { + return new SubscriptionItemsBuilder(); + } + + public static final class SubscriptionItemsBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Timestamp trialEnd; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ItemType itemType; + + private ChargeOnOption chargeOnOption; + + private SubscriptionItemsBuilder() {} + + public SubscriptionItemsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public SubscriptionItemsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public SubscriptionItemsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public SubscriptionItemsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public SubscriptionItemsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionItemsBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public SubscriptionItemsBuilder itemType(ItemType value) { + this.itemType = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { + this.chargeOnOption = value; + return this; + } + + public SubscriptionItemsParams build() { + return new SubscriptionItemsParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ItemType { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemType enumValue : ItemType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnOption { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnOption enumValue : ChargeOnOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class DiscountsParams { + + private final ApplyOn applyOn; + + private final DurationType durationType; + + private final Number percentage; + + private final Long amount; + + private final Integer period; + + private final PeriodUnit periodUnit; + + private final Boolean includedInMrr; + + private final String itemPriceId; + + private final Integer quantity; + + private DiscountsParams(DiscountsBuilder builder) { + + this.applyOn = builder.applyOn; + + this.durationType = builder.durationType; + + this.percentage = builder.percentage; + + this.amount = builder.amount; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + + this.includedInMrr = builder.includedInMrr; + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public DurationType getDurationType() { + return durationType; + } + + public Number getPercentage() { + return percentage; + } + + public Long getAmount() { + return amount; + } + + public Integer getPeriod() { + return period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public Boolean getIncludedInMrr() { + return includedInMrr; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.durationType != null) { + + formData.put("duration_type", this.durationType); + } + + if (this.percentage != null) { + + formData.put("percentage", this.percentage); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.includedInMrr != null) { + + formData.put("included_in_mrr", this.includedInMrr); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + return formData; + } + + /** Create a new builder for DiscountsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsBuilder builder() { + return new DiscountsBuilder(); + } + + public static final class DiscountsBuilder { + + private ApplyOn applyOn; + + private DurationType durationType; + + private Number percentage; + + private Long amount; + + private Integer period; + + private PeriodUnit periodUnit; + + private Boolean includedInMrr; + + private String itemPriceId; + + private Integer quantity; + + private DiscountsBuilder() {} + + public DiscountsBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public DiscountsBuilder durationType(DurationType value) { + this.durationType = value; + return this; + } + + public DiscountsBuilder percentage(Number value) { + this.percentage = value; + return this; + } + + public DiscountsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsBuilder period(Integer value) { + this.period = value; + return this; + } + + public DiscountsBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public DiscountsBuilder includedInMrr(Boolean value) { + this.includedInMrr = value; + return this; + } + + public DiscountsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DiscountsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public DiscountsParams build() { + return new DiscountsParams(this); + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIC_ITEM_PRICE("specific_item_price"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum DurationType { + ONE_TIME("one_time"), + + FOREVER("forever"), + + LIMITED_PERIOD("limited_period"), + + /** An enum member indicating that DurationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DurationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DurationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DurationType enumValue : DurationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemTiersParams { + + private final String itemPriceId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private String itemPriceId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/EstimateCancelSubscriptionForItemsParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateCancelSubscriptionForItemsParams.java new file mode 100644 index 00000000..56aad632 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateCancelSubscriptionForItemsParams.java @@ -0,0 +1,623 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class EstimateCancelSubscriptionForItemsParams { + + private final CancelOption cancelOption; + + private final Boolean endOfTerm; + + private final Timestamp cancelAt; + + private final CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; + + private final UnbilledChargesOption unbilledChargesOption; + + private final AccountReceivablesHandling accountReceivablesHandling; + + private final RefundableCreditsHandling refundableCreditsHandling; + + private final ContractTermCancelOption contractTermCancelOption; + + private final Timestamp invoiceDate; + + private final String cancelReasonCode; + + private final List subscriptionItems; + + private EstimateCancelSubscriptionForItemsParams( + EstimateCancelSubscriptionForItemsBuilder builder) { + + this.cancelOption = builder.cancelOption; + + this.endOfTerm = builder.endOfTerm; + + this.cancelAt = builder.cancelAt; + + this.creditOptionForCurrentTermCharges = builder.creditOptionForCurrentTermCharges; + + this.unbilledChargesOption = builder.unbilledChargesOption; + + this.accountReceivablesHandling = builder.accountReceivablesHandling; + + this.refundableCreditsHandling = builder.refundableCreditsHandling; + + this.contractTermCancelOption = builder.contractTermCancelOption; + + this.invoiceDate = builder.invoiceDate; + + this.cancelReasonCode = builder.cancelReasonCode; + + this.subscriptionItems = builder.subscriptionItems; + } + + public CancelOption getCancelOption() { + return cancelOption; + } + + public Boolean getEndOfTerm() { + return endOfTerm; + } + + public Timestamp getCancelAt() { + return cancelAt; + } + + public CreditOptionForCurrentTermCharges getCreditOptionForCurrentTermCharges() { + return creditOptionForCurrentTermCharges; + } + + public UnbilledChargesOption getUnbilledChargesOption() { + return unbilledChargesOption; + } + + public AccountReceivablesHandling getAccountReceivablesHandling() { + return accountReceivablesHandling; + } + + public RefundableCreditsHandling getRefundableCreditsHandling() { + return refundableCreditsHandling; + } + + public ContractTermCancelOption getContractTermCancelOption() { + return contractTermCancelOption; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public String getCancelReasonCode() { + return cancelReasonCode; + } + + public List getSubscriptionItems() { + return subscriptionItems; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.cancelOption != null) { + + formData.put("cancel_option", this.cancelOption); + } + + if (this.endOfTerm != null) { + + formData.put("end_of_term", this.endOfTerm); + } + + if (this.cancelAt != null) { + + formData.put("cancel_at", this.cancelAt); + } + + if (this.creditOptionForCurrentTermCharges != null) { + + formData.put( + "credit_option_for_current_term_charges", this.creditOptionForCurrentTermCharges); + } + + if (this.unbilledChargesOption != null) { + + formData.put("unbilled_charges_option", this.unbilledChargesOption); + } + + if (this.accountReceivablesHandling != null) { + + formData.put("account_receivables_handling", this.accountReceivablesHandling); + } + + if (this.refundableCreditsHandling != null) { + + formData.put("refundable_credits_handling", this.refundableCreditsHandling); + } + + if (this.contractTermCancelOption != null) { + + formData.put("contract_term_cancel_option", this.contractTermCancelOption); + } + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.cancelReasonCode != null) { + + formData.put("cancel_reason_code", this.cancelReasonCode); + } + + if (this.subscriptionItems != null) { + + // List of objects + for (int i = 0; i < this.subscriptionItems.size(); i++) { + SubscriptionItemsParams item = this.subscriptionItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for EstimateCancelSubscriptionForItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EstimateCancelSubscriptionForItemsBuilder builder() { + return new EstimateCancelSubscriptionForItemsBuilder(); + } + + public static final class EstimateCancelSubscriptionForItemsBuilder { + + private CancelOption cancelOption; + + private Boolean endOfTerm; + + private Timestamp cancelAt; + + private CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; + + private UnbilledChargesOption unbilledChargesOption; + + private AccountReceivablesHandling accountReceivablesHandling; + + private RefundableCreditsHandling refundableCreditsHandling; + + private ContractTermCancelOption contractTermCancelOption; + + private Timestamp invoiceDate; + + private String cancelReasonCode; + + private List subscriptionItems; + + private EstimateCancelSubscriptionForItemsBuilder() {} + + public EstimateCancelSubscriptionForItemsBuilder cancelOption(CancelOption value) { + this.cancelOption = value; + return this; + } + + public EstimateCancelSubscriptionForItemsBuilder endOfTerm(Boolean value) { + this.endOfTerm = value; + return this; + } + + public EstimateCancelSubscriptionForItemsBuilder cancelAt(Timestamp value) { + this.cancelAt = value; + return this; + } + + public EstimateCancelSubscriptionForItemsBuilder creditOptionForCurrentTermCharges( + CreditOptionForCurrentTermCharges value) { + this.creditOptionForCurrentTermCharges = value; + return this; + } + + public EstimateCancelSubscriptionForItemsBuilder unbilledChargesOption( + UnbilledChargesOption value) { + this.unbilledChargesOption = value; + return this; + } + + public EstimateCancelSubscriptionForItemsBuilder accountReceivablesHandling( + AccountReceivablesHandling value) { + this.accountReceivablesHandling = value; + return this; + } + + public EstimateCancelSubscriptionForItemsBuilder refundableCreditsHandling( + RefundableCreditsHandling value) { + this.refundableCreditsHandling = value; + return this; + } + + public EstimateCancelSubscriptionForItemsBuilder contractTermCancelOption( + ContractTermCancelOption value) { + this.contractTermCancelOption = value; + return this; + } + + public EstimateCancelSubscriptionForItemsBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public EstimateCancelSubscriptionForItemsBuilder cancelReasonCode(String value) { + this.cancelReasonCode = value; + return this; + } + + public EstimateCancelSubscriptionForItemsBuilder subscriptionItems( + List value) { + this.subscriptionItems = value; + return this; + } + + public EstimateCancelSubscriptionForItemsParams build() { + return new EstimateCancelSubscriptionForItemsParams(this); + } + } + + public enum CancelOption { + IMMEDIATELY("immediately"), + + END_OF_TERM("end_of_term"), + + SPECIFIC_DATE("specific_date"), + + END_OF_BILLING_TERM("end_of_billing_term"), + + /** An enum member indicating that CancelOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + CancelOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CancelOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (CancelOption enumValue : CancelOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum CreditOptionForCurrentTermCharges { + NONE("none"), + + PRORATE("prorate"), + + FULL("full"), + + /** + * An enum member indicating that CreditOptionForCurrentTermCharges was instantiated with an + * unknown value. + */ + _UNKNOWN(null); + private final String value; + + CreditOptionForCurrentTermCharges(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CreditOptionForCurrentTermCharges fromString(String value) { + if (value == null) return _UNKNOWN; + for (CreditOptionForCurrentTermCharges enumValue : + CreditOptionForCurrentTermCharges.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum UnbilledChargesOption { + INVOICE("invoice"), + + DELETE("delete"), + + /** + * An enum member indicating that UnbilledChargesOption was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + UnbilledChargesOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static UnbilledChargesOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (UnbilledChargesOption enumValue : UnbilledChargesOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum AccountReceivablesHandling { + NO_ACTION("no_action"), + + SCHEDULE_PAYMENT_COLLECTION("schedule_payment_collection"), + + WRITE_OFF("write_off"), + + /** + * An enum member indicating that AccountReceivablesHandling was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + AccountReceivablesHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AccountReceivablesHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (AccountReceivablesHandling enumValue : AccountReceivablesHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum RefundableCreditsHandling { + NO_ACTION("no_action"), + + SCHEDULE_REFUND("schedule_refund"), + + /** + * An enum member indicating that RefundableCreditsHandling was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + RefundableCreditsHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static RefundableCreditsHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (RefundableCreditsHandling enumValue : RefundableCreditsHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ContractTermCancelOption { + TERMINATE_IMMEDIATELY("terminate_immediately"), + + END_OF_CONTRACT_TERM("end_of_contract_term"), + + SPECIFIC_DATE("specific_date"), + + END_OF_SUBSCRIPTION_BILLING_TERM("end_of_subscription_billing_term"), + + /** + * An enum member indicating that ContractTermCancelOption was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + ContractTermCancelOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ContractTermCancelOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ContractTermCancelOption enumValue : ContractTermCancelOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionItemsParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer servicePeriodDays; + + private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.servicePeriodDays = builder.servicePeriodDays; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + return formData; + } + + /** Create a new builder for SubscriptionItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionItemsBuilder builder() { + return new SubscriptionItemsBuilder(); + } + + public static final class SubscriptionItemsBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer servicePeriodDays; + + private SubscriptionItemsBuilder() {} + + public SubscriptionItemsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public SubscriptionItemsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public SubscriptionItemsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public SubscriptionItemsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public SubscriptionItemsParams build() { + return new SubscriptionItemsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/EstimateCancelSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateCancelSubscriptionParams.java new file mode 100644 index 00000000..c924f284 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateCancelSubscriptionParams.java @@ -0,0 +1,580 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class EstimateCancelSubscriptionParams { + + private final CancelOption cancelOption; + + private final Boolean endOfTerm; + + private final Timestamp cancelAt; + + private final CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; + + private final UnbilledChargesOption unbilledChargesOption; + + private final AccountReceivablesHandling accountReceivablesHandling; + + private final RefundableCreditsHandling refundableCreditsHandling; + + private final ContractTermCancelOption contractTermCancelOption; + + private final Timestamp invoiceDate; + + private final String cancelReasonCode; + + private final List eventBasedAddons; + + private EstimateCancelSubscriptionParams(EstimateCancelSubscriptionBuilder builder) { + + this.cancelOption = builder.cancelOption; + + this.endOfTerm = builder.endOfTerm; + + this.cancelAt = builder.cancelAt; + + this.creditOptionForCurrentTermCharges = builder.creditOptionForCurrentTermCharges; + + this.unbilledChargesOption = builder.unbilledChargesOption; + + this.accountReceivablesHandling = builder.accountReceivablesHandling; + + this.refundableCreditsHandling = builder.refundableCreditsHandling; + + this.contractTermCancelOption = builder.contractTermCancelOption; + + this.invoiceDate = builder.invoiceDate; + + this.cancelReasonCode = builder.cancelReasonCode; + + this.eventBasedAddons = builder.eventBasedAddons; + } + + public CancelOption getCancelOption() { + return cancelOption; + } + + public Boolean getEndOfTerm() { + return endOfTerm; + } + + public Timestamp getCancelAt() { + return cancelAt; + } + + public CreditOptionForCurrentTermCharges getCreditOptionForCurrentTermCharges() { + return creditOptionForCurrentTermCharges; + } + + public UnbilledChargesOption getUnbilledChargesOption() { + return unbilledChargesOption; + } + + public AccountReceivablesHandling getAccountReceivablesHandling() { + return accountReceivablesHandling; + } + + public RefundableCreditsHandling getRefundableCreditsHandling() { + return refundableCreditsHandling; + } + + public ContractTermCancelOption getContractTermCancelOption() { + return contractTermCancelOption; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public String getCancelReasonCode() { + return cancelReasonCode; + } + + public List getEventBasedAddons() { + return eventBasedAddons; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.cancelOption != null) { + + formData.put("cancel_option", this.cancelOption); + } + + if (this.endOfTerm != null) { + + formData.put("end_of_term", this.endOfTerm); + } + + if (this.cancelAt != null) { + + formData.put("cancel_at", this.cancelAt); + } + + if (this.creditOptionForCurrentTermCharges != null) { + + formData.put( + "credit_option_for_current_term_charges", this.creditOptionForCurrentTermCharges); + } + + if (this.unbilledChargesOption != null) { + + formData.put("unbilled_charges_option", this.unbilledChargesOption); + } + + if (this.accountReceivablesHandling != null) { + + formData.put("account_receivables_handling", this.accountReceivablesHandling); + } + + if (this.refundableCreditsHandling != null) { + + formData.put("refundable_credits_handling", this.refundableCreditsHandling); + } + + if (this.contractTermCancelOption != null) { + + formData.put("contract_term_cancel_option", this.contractTermCancelOption); + } + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.cancelReasonCode != null) { + + formData.put("cancel_reason_code", this.cancelReasonCode); + } + + if (this.eventBasedAddons != null) { + + // List of objects + for (int i = 0; i < this.eventBasedAddons.size(); i++) { + EventBasedAddonsParams item = this.eventBasedAddons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for EstimateCancelSubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EstimateCancelSubscriptionBuilder builder() { + return new EstimateCancelSubscriptionBuilder(); + } + + public static final class EstimateCancelSubscriptionBuilder { + + private CancelOption cancelOption; + + private Boolean endOfTerm; + + private Timestamp cancelAt; + + private CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; + + private UnbilledChargesOption unbilledChargesOption; + + private AccountReceivablesHandling accountReceivablesHandling; + + private RefundableCreditsHandling refundableCreditsHandling; + + private ContractTermCancelOption contractTermCancelOption; + + private Timestamp invoiceDate; + + private String cancelReasonCode; + + private List eventBasedAddons; + + private EstimateCancelSubscriptionBuilder() {} + + public EstimateCancelSubscriptionBuilder cancelOption(CancelOption value) { + this.cancelOption = value; + return this; + } + + public EstimateCancelSubscriptionBuilder endOfTerm(Boolean value) { + this.endOfTerm = value; + return this; + } + + public EstimateCancelSubscriptionBuilder cancelAt(Timestamp value) { + this.cancelAt = value; + return this; + } + + public EstimateCancelSubscriptionBuilder creditOptionForCurrentTermCharges( + CreditOptionForCurrentTermCharges value) { + this.creditOptionForCurrentTermCharges = value; + return this; + } + + public EstimateCancelSubscriptionBuilder unbilledChargesOption(UnbilledChargesOption value) { + this.unbilledChargesOption = value; + return this; + } + + public EstimateCancelSubscriptionBuilder accountReceivablesHandling( + AccountReceivablesHandling value) { + this.accountReceivablesHandling = value; + return this; + } + + public EstimateCancelSubscriptionBuilder refundableCreditsHandling( + RefundableCreditsHandling value) { + this.refundableCreditsHandling = value; + return this; + } + + public EstimateCancelSubscriptionBuilder contractTermCancelOption( + ContractTermCancelOption value) { + this.contractTermCancelOption = value; + return this; + } + + public EstimateCancelSubscriptionBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public EstimateCancelSubscriptionBuilder cancelReasonCode(String value) { + this.cancelReasonCode = value; + return this; + } + + public EstimateCancelSubscriptionBuilder eventBasedAddons(List value) { + this.eventBasedAddons = value; + return this; + } + + public EstimateCancelSubscriptionParams build() { + return new EstimateCancelSubscriptionParams(this); + } + } + + public enum CancelOption { + IMMEDIATELY("immediately"), + + END_OF_TERM("end_of_term"), + + SPECIFIC_DATE("specific_date"), + + END_OF_BILLING_TERM("end_of_billing_term"), + + /** An enum member indicating that CancelOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + CancelOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CancelOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (CancelOption enumValue : CancelOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum CreditOptionForCurrentTermCharges { + NONE("none"), + + PRORATE("prorate"), + + FULL("full"), + + /** + * An enum member indicating that CreditOptionForCurrentTermCharges was instantiated with an + * unknown value. + */ + _UNKNOWN(null); + private final String value; + + CreditOptionForCurrentTermCharges(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CreditOptionForCurrentTermCharges fromString(String value) { + if (value == null) return _UNKNOWN; + for (CreditOptionForCurrentTermCharges enumValue : + CreditOptionForCurrentTermCharges.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum UnbilledChargesOption { + INVOICE("invoice"), + + DELETE("delete"), + + /** + * An enum member indicating that UnbilledChargesOption was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + UnbilledChargesOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static UnbilledChargesOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (UnbilledChargesOption enumValue : UnbilledChargesOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum AccountReceivablesHandling { + NO_ACTION("no_action"), + + SCHEDULE_PAYMENT_COLLECTION("schedule_payment_collection"), + + WRITE_OFF("write_off"), + + /** + * An enum member indicating that AccountReceivablesHandling was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + AccountReceivablesHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AccountReceivablesHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (AccountReceivablesHandling enumValue : AccountReceivablesHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum RefundableCreditsHandling { + NO_ACTION("no_action"), + + SCHEDULE_REFUND("schedule_refund"), + + /** + * An enum member indicating that RefundableCreditsHandling was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + RefundableCreditsHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static RefundableCreditsHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (RefundableCreditsHandling enumValue : RefundableCreditsHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ContractTermCancelOption { + TERMINATE_IMMEDIATELY("terminate_immediately"), + + END_OF_CONTRACT_TERM("end_of_contract_term"), + + SPECIFIC_DATE("specific_date"), + + END_OF_SUBSCRIPTION_BILLING_TERM("end_of_subscription_billing_term"), + + /** + * An enum member indicating that ContractTermCancelOption was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + ContractTermCancelOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ContractTermCancelOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ContractTermCancelOption enumValue : ContractTermCancelOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class EventBasedAddonsParams { + + private final String id; + + private final Integer quantity; + + private final Long unitPrice; + + private final Integer servicePeriodInDays; + + private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.unitPrice = builder.unitPrice; + + this.servicePeriodInDays = builder.servicePeriodInDays; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public Integer getServicePeriodInDays() { + return servicePeriodInDays; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.servicePeriodInDays != null) { + + formData.put("service_period_in_days", this.servicePeriodInDays); + } + + return formData; + } + + /** Create a new builder for EventBasedAddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EventBasedAddonsBuilder builder() { + return new EventBasedAddonsBuilder(); + } + + public static final class EventBasedAddonsBuilder { + + private String id; + + private Integer quantity; + + private Long unitPrice; + + private Integer servicePeriodInDays; + + private EventBasedAddonsBuilder() {} + + public EventBasedAddonsBuilder id(String value) { + this.id = value; + return this; + } + + public EventBasedAddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public EventBasedAddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { + this.servicePeriodInDays = value; + return this; + } + + public EventBasedAddonsParams build() { + return new EventBasedAddonsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/EstimateChangeTermEndParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateChangeTermEndParams.java new file mode 100644 index 00000000..8b2eaf67 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateChangeTermEndParams.java @@ -0,0 +1,101 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class EstimateChangeTermEndParams { + + private final Timestamp termEndsAt; + + private final Boolean prorate; + + private final Boolean invoiceImmediately; + + private EstimateChangeTermEndParams(EstimateChangeTermEndBuilder builder) { + + this.termEndsAt = builder.termEndsAt; + + this.prorate = builder.prorate; + + this.invoiceImmediately = builder.invoiceImmediately; + } + + public Timestamp getTermEndsAt() { + return termEndsAt; + } + + public Boolean getProrate() { + return prorate; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.termEndsAt != null) { + + formData.put("term_ends_at", this.termEndsAt); + } + + if (this.prorate != null) { + + formData.put("prorate", this.prorate); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + return formData; + } + + /** Create a new builder for EstimateChangeTermEndParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EstimateChangeTermEndBuilder builder() { + return new EstimateChangeTermEndBuilder(); + } + + public static final class EstimateChangeTermEndBuilder { + + private Timestamp termEndsAt; + + private Boolean prorate; + + private Boolean invoiceImmediately; + + private EstimateChangeTermEndBuilder() {} + + public EstimateChangeTermEndBuilder termEndsAt(Timestamp value) { + this.termEndsAt = value; + return this; + } + + public EstimateChangeTermEndBuilder prorate(Boolean value) { + this.prorate = value; + return this; + } + + public EstimateChangeTermEndBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public EstimateChangeTermEndParams build() { + return new EstimateChangeTermEndParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/EstimateCreateSubscriptionForItemsParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateCreateSubscriptionForItemsParams.java deleted file mode 100644 index c0eac173..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/EstimateCreateSubscriptionForItemsParams.java +++ /dev/null @@ -1,2682 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class EstimateCreateSubscriptionForItemsParams { - - private final Integer billingCycles; - - private final List mandatoryItemsToRemove; - - private final Integer termsToCharge; - - private final BillingAlignmentMode billingAlignmentMode; - - private final List couponIds; - - private final Boolean invoiceImmediately; - - private final Timestamp invoiceDate; - - private final String clientProfileId; - - private final SubscriptionParams subscription; - - private final BillingAddressParams billingAddress; - - private final ShippingAddressParams shippingAddress; - - private final CustomerParams customer; - - private final ContractTermParams contractTerm; - - private final List subscriptionItems; - - private final List discounts; - - private final List itemTiers; - - private final List taxProvidersFields; - - private EstimateCreateSubscriptionForItemsParams( - EstimateCreateSubscriptionForItemsBuilder builder) { - - this.billingCycles = builder.billingCycles; - - this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; - - this.termsToCharge = builder.termsToCharge; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.couponIds = builder.couponIds; - - this.invoiceImmediately = builder.invoiceImmediately; - - this.invoiceDate = builder.invoiceDate; - - this.clientProfileId = builder.clientProfileId; - - this.subscription = builder.subscription; - - this.billingAddress = builder.billingAddress; - - this.shippingAddress = builder.shippingAddress; - - this.customer = builder.customer; - - this.contractTerm = builder.contractTerm; - - this.subscriptionItems = builder.subscriptionItems; - - this.discounts = builder.discounts; - - this.itemTiers = builder.itemTiers; - - this.taxProvidersFields = builder.taxProvidersFields; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public List getMandatoryItemsToRemove() { - return mandatoryItemsToRemove; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public List getCouponIds() { - return couponIds; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public String getClientProfileId() { - return clientProfileId; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - public BillingAddressParams getBillingAddress() { - return billingAddress; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public CustomerParams getCustomer() { - return customer; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public List getSubscriptionItems() { - return subscriptionItems; - } - - public List getDiscounts() { - return discounts; - } - - public List getItemTiers() { - return itemTiers; - } - - public List getTaxProvidersFields() { - return taxProvidersFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.mandatoryItemsToRemove != null) { - - formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.clientProfileId != null) { - - formData.put("client_profile_id", this.clientProfileId); - } - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.billingAddress != null) { - - // Single object - Map nestedData = this.billingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.customer != null) { - - // Single object - Map nestedData = this.customer.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "customer[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.subscriptionItems != null) { - - // List of objects - for (int i = 0; i < this.subscriptionItems.size(); i++) { - SubscriptionItemsParams item = this.subscriptionItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discounts != null) { - - // List of objects - for (int i = 0; i < this.discounts.size(); i++) { - DiscountsParams item = this.discounts.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.taxProvidersFields != null) { - - // List of objects - for (int i = 0; i < this.taxProvidersFields.size(); i++) { - TaxProvidersFieldsParams item = this.taxProvidersFields.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "tax_providers_fields[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for EstimateCreateSubscriptionForItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EstimateCreateSubscriptionForItemsBuilder builder() { - return new EstimateCreateSubscriptionForItemsBuilder(); - } - - public static final class EstimateCreateSubscriptionForItemsBuilder { - - private Integer billingCycles; - - private List mandatoryItemsToRemove; - - private Integer termsToCharge; - - private BillingAlignmentMode billingAlignmentMode; - - private List couponIds; - - private Boolean invoiceImmediately; - - private Timestamp invoiceDate; - - private String clientProfileId; - - private SubscriptionParams subscription; - - private BillingAddressParams billingAddress; - - private ShippingAddressParams shippingAddress; - - private CustomerParams customer; - - private ContractTermParams contractTerm; - - private List subscriptionItems; - - private List discounts; - - private List itemTiers; - - private List taxProvidersFields; - - private EstimateCreateSubscriptionForItemsBuilder() {} - - public EstimateCreateSubscriptionForItemsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder mandatoryItemsToRemove(List value) { - this.mandatoryItemsToRemove = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder billingAlignmentMode( - BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder clientProfileId(String value) { - this.clientProfileId = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder subscription(SubscriptionParams value) { - this.subscription = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder billingAddress(BillingAddressParams value) { - this.billingAddress = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder shippingAddress(ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder customer(CustomerParams value) { - this.customer = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder subscriptionItems( - List value) { - this.subscriptionItems = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder discounts(List value) { - this.discounts = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder itemTiers(List value) { - this.itemTiers = value; - return this; - } - - public EstimateCreateSubscriptionForItemsBuilder taxProvidersFields( - List value) { - this.taxProvidersFields = value; - return this; - } - - public EstimateCreateSubscriptionForItemsParams build() { - return new EstimateCreateSubscriptionForItemsParams(this); - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionParams { - - private final String id; - - private final Timestamp trialEnd; - - private final Long setupFee; - - private final Timestamp startDate; - - private final String coupon; - - private final OfflinePaymentMethod offlinePaymentMethod; - - private final Integer freePeriod; - - private final FreePeriodUnit freePeriodUnit; - - private final Integer contractTermBillingCycleOnRenewal; - - private final TrialEndAction trialEndAction; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.id = builder.id; - - this.trialEnd = builder.trialEnd; - - this.setupFee = builder.setupFee; - - this.startDate = builder.startDate; - - this.coupon = builder.coupon; - - this.offlinePaymentMethod = builder.offlinePaymentMethod; - - this.freePeriod = builder.freePeriod; - - this.freePeriodUnit = builder.freePeriodUnit; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - - this.trialEndAction = builder.trialEndAction; - } - - public String getId() { - return id; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Long getSetupFee() { - return setupFee; - } - - public Timestamp getStartDate() { - return startDate; - } - - public String getCoupon() { - return coupon; - } - - public OfflinePaymentMethod getOfflinePaymentMethod() { - return offlinePaymentMethod; - } - - public Integer getFreePeriod() { - return freePeriod; - } - - public FreePeriodUnit getFreePeriodUnit() { - return freePeriodUnit; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - public TrialEndAction getTrialEndAction() { - return trialEndAction; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.coupon != null) { - - formData.put("coupon", this.coupon); - } - - if (this.offlinePaymentMethod != null) { - - formData.put("offline_payment_method", this.offlinePaymentMethod); - } - - if (this.freePeriod != null) { - - formData.put("free_period", this.freePeriod); - } - - if (this.freePeriodUnit != null) { - - formData.put("free_period_unit", this.freePeriodUnit); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - if (this.trialEndAction != null) { - - formData.put("trial_end_action", this.trialEndAction); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private String id; - - private Timestamp trialEnd; - - private Long setupFee; - - private Timestamp startDate; - - private String coupon; - - private OfflinePaymentMethod offlinePaymentMethod; - - private Integer freePeriod; - - private FreePeriodUnit freePeriodUnit; - - private Integer contractTermBillingCycleOnRenewal; - - private TrialEndAction trialEndAction; - - private SubscriptionBuilder() {} - - public SubscriptionBuilder id(String value) { - this.id = value; - return this; - } - - public SubscriptionBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - @Deprecated - public SubscriptionBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public SubscriptionBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - @Deprecated - public SubscriptionBuilder coupon(String value) { - this.coupon = value; - return this; - } - - public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - this.offlinePaymentMethod = value; - return this; - } - - public SubscriptionBuilder freePeriod(Integer value) { - this.freePeriod = value; - return this; - } - - public SubscriptionBuilder freePeriodUnit(FreePeriodUnit value) { - this.freePeriodUnit = value; - return this; - } - - public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public SubscriptionBuilder trialEndAction(TrialEndAction value) { - this.trialEndAction = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum FreePeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - FreePeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static FreePeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum TrialEndAction { - SITE_DEFAULT("site_default"), - - PLAN_DEFAULT("plan_default"), - - ACTIVATE_SUBSCRIPTION("activate_subscription"), - - CANCEL_SUBSCRIPTION("cancel_subscription"), - - /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - TrialEndAction(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static TrialEndAction fromString(String value) { - if (value == null) return _UNKNOWN; - for (TrialEndAction enumValue : TrialEndAction.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class BillingAddressParams { - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private BillingAddressParams(BillingAddressBuilder builder) { - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for BillingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingAddressBuilder builder() { - return new BillingAddressBuilder(); - } - - public static final class BillingAddressBuilder { - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private BillingAddressBuilder() {} - - public BillingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public BillingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public BillingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public BillingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public BillingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public BillingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public BillingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public BillingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public BillingAddressParams build() { - return new BillingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CustomerParams { - - private final String vatNumber; - - private final String vatNumberPrefix; - - private final Boolean registeredForGst; - - private final Taxability taxability; - - private final EntityCode entityCode; - - private final String exemptNumber; - - private final List exemptionDetails; - - private final CustomerType customerType; - - private CustomerParams(CustomerBuilder builder) { - - this.vatNumber = builder.vatNumber; - - this.vatNumberPrefix = builder.vatNumberPrefix; - - this.registeredForGst = builder.registeredForGst; - - this.taxability = builder.taxability; - - this.entityCode = builder.entityCode; - - this.exemptNumber = builder.exemptNumber; - - this.exemptionDetails = builder.exemptionDetails; - - this.customerType = builder.customerType; - } - - public String getVatNumber() { - return vatNumber; - } - - public String getVatNumberPrefix() { - return vatNumberPrefix; - } - - public Boolean getRegisteredForGst() { - return registeredForGst; - } - - public Taxability getTaxability() { - return taxability; - } - - public EntityCode getEntityCode() { - return entityCode; - } - - public String getExemptNumber() { - return exemptNumber; - } - - public List getExemptionDetails() { - return exemptionDetails; - } - - public CustomerType getCustomerType() { - return customerType; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.vatNumber != null) { - - formData.put("vat_number", this.vatNumber); - } - - if (this.vatNumberPrefix != null) { - - formData.put("vat_number_prefix", this.vatNumberPrefix); - } - - if (this.registeredForGst != null) { - - formData.put("registered_for_gst", this.registeredForGst); - } - - if (this.taxability != null) { - - formData.put("taxability", this.taxability); - } - - if (this.entityCode != null) { - - formData.put("entity_code", this.entityCode); - } - - if (this.exemptNumber != null) { - - formData.put("exempt_number", this.exemptNumber); - } - - if (this.exemptionDetails != null) { - - formData.put("exemption_details", JsonUtil.toJson(this.exemptionDetails)); - } - - if (this.customerType != null) { - - formData.put("customer_type", this.customerType); - } - - return formData; - } - - /** Create a new builder for CustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CustomerBuilder builder() { - return new CustomerBuilder(); - } - - public static final class CustomerBuilder { - - private String vatNumber; - - private String vatNumberPrefix; - - private Boolean registeredForGst; - - private Taxability taxability; - - private EntityCode entityCode; - - private String exemptNumber; - - private List exemptionDetails; - - private CustomerType customerType; - - private CustomerBuilder() {} - - public CustomerBuilder vatNumber(String value) { - this.vatNumber = value; - return this; - } - - public CustomerBuilder vatNumberPrefix(String value) { - this.vatNumberPrefix = value; - return this; - } - - public CustomerBuilder registeredForGst(Boolean value) { - this.registeredForGst = value; - return this; - } - - public CustomerBuilder taxability(Taxability value) { - this.taxability = value; - return this; - } - - public CustomerBuilder entityCode(EntityCode value) { - this.entityCode = value; - return this; - } - - public CustomerBuilder exemptNumber(String value) { - this.exemptNumber = value; - return this; - } - - public CustomerBuilder exemptionDetails(List value) { - this.exemptionDetails = value; - return this; - } - - public CustomerBuilder customerType(CustomerType value) { - this.customerType = value; - return this; - } - - public CustomerParams build() { - return new CustomerParams(this); - } - } - - public enum Taxability { - TAXABLE("taxable"), - - EXEMPT("exempt"), - - /** An enum member indicating that Taxability was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Taxability(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Taxability fromString(String value) { - if (value == null) return _UNKNOWN; - for (Taxability enumValue : Taxability.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum EntityCode { - A("a"), - - B("b"), - - C("c"), - - D("d"), - - E("e"), - - F("f"), - - G("g"), - - H("h"), - - I("i"), - - J("j"), - - K("k"), - - L("l"), - - M("m"), - - N("n"), - - P("p"), - - Q("q"), - - R("r"), - - MED_1("med1"), - - MED_2("med2"), - - /** An enum member indicating that EntityCode was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - EntityCode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static EntityCode fromString(String value) { - if (value == null) return _UNKNOWN; - for (EntityCode enumValue : EntityCode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum CustomerType { - RESIDENTIAL("residential"), - - BUSINESS("business"), - - SENIOR_CITIZEN("senior_citizen"), - - INDUSTRIAL("industrial"), - - /** An enum member indicating that CustomerType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - CustomerType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CustomerType fromString(String value) { - if (value == null) return _UNKNOWN; - for (CustomerType enumValue : CustomerType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Timestamp contractStart; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.contractStart = builder.contractStart; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Timestamp getContractStart() { - return contractStart; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.contractStart != null) { - - formData.put("contract_start", this.contractStart); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Timestamp contractStart; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - @Deprecated - public ContractTermBuilder contractStart(Timestamp value) { - this.contractStart = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class SubscriptionItemsParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Timestamp trialEnd; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ItemType itemType; - - private final ChargeOnOption chargeOnOption; - - private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.trialEnd = builder.trialEnd; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.itemType = builder.itemType; - - this.chargeOnOption = builder.chargeOnOption; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ItemType getItemType() { - return itemType; - } - - public ChargeOnOption getChargeOnOption() { - return chargeOnOption; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.itemType != null) { - - formData.put("item_type", this.itemType); - } - - if (this.chargeOnOption != null) { - - formData.put("charge_on_option", this.chargeOnOption); - } - - return formData; - } - - /** Create a new builder for SubscriptionItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionItemsBuilder builder() { - return new SubscriptionItemsBuilder(); - } - - public static final class SubscriptionItemsBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Timestamp trialEnd; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ItemType itemType; - - private ChargeOnOption chargeOnOption; - - private SubscriptionItemsBuilder() {} - - public SubscriptionItemsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public SubscriptionItemsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public SubscriptionItemsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public SubscriptionItemsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public SubscriptionItemsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionItemsBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public SubscriptionItemsBuilder itemType(ItemType value) { - this.itemType = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { - this.chargeOnOption = value; - return this; - } - - public SubscriptionItemsParams build() { - return new SubscriptionItemsParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ItemType { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemType enumValue : ItemType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnOption { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnOption enumValue : ChargeOnOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class DiscountsParams { - - private final ApplyOn applyOn; - - private final DurationType durationType; - - private final Number percentage; - - private final Long amount; - - private final Integer period; - - private final PeriodUnit periodUnit; - - private final Boolean includedInMrr; - - private final String itemPriceId; - - private final Integer quantity; - - private DiscountsParams(DiscountsBuilder builder) { - - this.applyOn = builder.applyOn; - - this.durationType = builder.durationType; - - this.percentage = builder.percentage; - - this.amount = builder.amount; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - - this.includedInMrr = builder.includedInMrr; - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public DurationType getDurationType() { - return durationType; - } - - public Number getPercentage() { - return percentage; - } - - public Long getAmount() { - return amount; - } - - public Integer getPeriod() { - return period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public Boolean getIncludedInMrr() { - return includedInMrr; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.durationType != null) { - - formData.put("duration_type", this.durationType); - } - - if (this.percentage != null) { - - formData.put("percentage", this.percentage); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.includedInMrr != null) { - - formData.put("included_in_mrr", this.includedInMrr); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - return formData; - } - - /** Create a new builder for DiscountsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsBuilder builder() { - return new DiscountsBuilder(); - } - - public static final class DiscountsBuilder { - - private ApplyOn applyOn; - - private DurationType durationType; - - private Number percentage; - - private Long amount; - - private Integer period; - - private PeriodUnit periodUnit; - - private Boolean includedInMrr; - - private String itemPriceId; - - private Integer quantity; - - private DiscountsBuilder() {} - - public DiscountsBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public DiscountsBuilder durationType(DurationType value) { - this.durationType = value; - return this; - } - - public DiscountsBuilder percentage(Number value) { - this.percentage = value; - return this; - } - - public DiscountsBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsBuilder period(Integer value) { - this.period = value; - return this; - } - - public DiscountsBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public DiscountsBuilder includedInMrr(Boolean value) { - this.includedInMrr = value; - return this; - } - - public DiscountsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DiscountsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public DiscountsParams build() { - return new DiscountsParams(this); - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIC_ITEM_PRICE("specific_item_price"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum DurationType { - ONE_TIME("one_time"), - - FOREVER("forever"), - - LIMITED_PERIOD("limited_period"), - - /** An enum member indicating that DurationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DurationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DurationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DurationType enumValue : DurationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemTiersParams { - - private final String itemPriceId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private String itemPriceId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class TaxProvidersFieldsParams { - - private final String providerName; - - private final String fieldId; - - private final String fieldValue; - - private TaxProvidersFieldsParams(TaxProvidersFieldsBuilder builder) { - - this.providerName = builder.providerName; - - this.fieldId = builder.fieldId; - - this.fieldValue = builder.fieldValue; - } - - public String getProviderName() { - return providerName; - } - - public String getFieldId() { - return fieldId; - } - - public String getFieldValue() { - return fieldValue; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.providerName != null) { - - formData.put("provider_name", this.providerName); - } - - if (this.fieldId != null) { - - formData.put("field_id", this.fieldId); - } - - if (this.fieldValue != null) { - - formData.put("field_value", this.fieldValue); - } - - return formData; - } - - /** Create a new builder for TaxProvidersFieldsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TaxProvidersFieldsBuilder builder() { - return new TaxProvidersFieldsBuilder(); - } - - public static final class TaxProvidersFieldsBuilder { - - private String providerName; - - private String fieldId; - - private String fieldValue; - - private TaxProvidersFieldsBuilder() {} - - public TaxProvidersFieldsBuilder providerName(String value) { - this.providerName = value; - return this; - } - - public TaxProvidersFieldsBuilder fieldId(String value) { - this.fieldId = value; - return this; - } - - public TaxProvidersFieldsBuilder fieldValue(String value) { - this.fieldValue = value; - return this; - } - - public TaxProvidersFieldsParams build() { - return new TaxProvidersFieldsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/EstimatePauseSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/EstimatePauseSubscriptionParams.java new file mode 100644 index 00000000..2b463d6d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/EstimatePauseSubscriptionParams.java @@ -0,0 +1,257 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class EstimatePauseSubscriptionParams { + + private final PauseOption pauseOption; + + private final UnbilledChargesHandling unbilledChargesHandling; + + private final SubscriptionParams subscription; + + private EstimatePauseSubscriptionParams(EstimatePauseSubscriptionBuilder builder) { + + this.pauseOption = builder.pauseOption; + + this.unbilledChargesHandling = builder.unbilledChargesHandling; + + this.subscription = builder.subscription; + } + + public PauseOption getPauseOption() { + return pauseOption; + } + + public UnbilledChargesHandling getUnbilledChargesHandling() { + return unbilledChargesHandling; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.pauseOption != null) { + + formData.put("pause_option", this.pauseOption); + } + + if (this.unbilledChargesHandling != null) { + + formData.put("unbilled_charges_handling", this.unbilledChargesHandling); + } + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for EstimatePauseSubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EstimatePauseSubscriptionBuilder builder() { + return new EstimatePauseSubscriptionBuilder(); + } + + public static final class EstimatePauseSubscriptionBuilder { + + private PauseOption pauseOption; + + private UnbilledChargesHandling unbilledChargesHandling; + + private SubscriptionParams subscription; + + private EstimatePauseSubscriptionBuilder() {} + + public EstimatePauseSubscriptionBuilder pauseOption(PauseOption value) { + this.pauseOption = value; + return this; + } + + public EstimatePauseSubscriptionBuilder unbilledChargesHandling(UnbilledChargesHandling value) { + this.unbilledChargesHandling = value; + return this; + } + + public EstimatePauseSubscriptionBuilder subscription(SubscriptionParams value) { + this.subscription = value; + return this; + } + + public EstimatePauseSubscriptionParams build() { + return new EstimatePauseSubscriptionParams(this); + } + } + + public enum PauseOption { + IMMEDIATELY("immediately"), + + END_OF_TERM("end_of_term"), + + SPECIFIC_DATE("specific_date"), + + BILLING_CYCLES("billing_cycles"), + + /** An enum member indicating that PauseOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PauseOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PauseOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (PauseOption enumValue : PauseOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum UnbilledChargesHandling { + NO_ACTION("no_action"), + + INVOICE("invoice"), + + /** + * An enum member indicating that UnbilledChargesHandling was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + UnbilledChargesHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static UnbilledChargesHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (UnbilledChargesHandling enumValue : UnbilledChargesHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionParams { + + private final Timestamp pauseDate; + + private final Timestamp resumeDate; + + private final Integer skipBillingCycles; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.pauseDate = builder.pauseDate; + + this.resumeDate = builder.resumeDate; + + this.skipBillingCycles = builder.skipBillingCycles; + } + + public Timestamp getPauseDate() { + return pauseDate; + } + + public Timestamp getResumeDate() { + return resumeDate; + } + + public Integer getSkipBillingCycles() { + return skipBillingCycles; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.pauseDate != null) { + + formData.put("pause_date", this.pauseDate); + } + + if (this.resumeDate != null) { + + formData.put("resume_date", this.resumeDate); + } + + if (this.skipBillingCycles != null) { + + formData.put("skip_billing_cycles", this.skipBillingCycles); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private Timestamp pauseDate; + + private Timestamp resumeDate; + + private Integer skipBillingCycles; + + private SubscriptionBuilder() {} + + public SubscriptionBuilder pauseDate(Timestamp value) { + this.pauseDate = value; + return this; + } + + public SubscriptionBuilder resumeDate(Timestamp value) { + this.resumeDate = value; + return this; + } + + public SubscriptionBuilder skipBillingCycles(Integer value) { + this.skipBillingCycles = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/EstimateResumeSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateResumeSubscriptionParams.java new file mode 100644 index 00000000..1f1d42c9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateResumeSubscriptionParams.java @@ -0,0 +1,210 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class EstimateResumeSubscriptionParams { + + private final ResumeOption resumeOption; + + private final ChargesHandling chargesHandling; + + private final SubscriptionParams subscription; + + private EstimateResumeSubscriptionParams(EstimateResumeSubscriptionBuilder builder) { + + this.resumeOption = builder.resumeOption; + + this.chargesHandling = builder.chargesHandling; + + this.subscription = builder.subscription; + } + + public ResumeOption getResumeOption() { + return resumeOption; + } + + public ChargesHandling getChargesHandling() { + return chargesHandling; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.resumeOption != null) { + + formData.put("resume_option", this.resumeOption); + } + + if (this.chargesHandling != null) { + + formData.put("charges_handling", this.chargesHandling); + } + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for EstimateResumeSubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EstimateResumeSubscriptionBuilder builder() { + return new EstimateResumeSubscriptionBuilder(); + } + + public static final class EstimateResumeSubscriptionBuilder { + + private ResumeOption resumeOption; + + private ChargesHandling chargesHandling; + + private SubscriptionParams subscription; + + private EstimateResumeSubscriptionBuilder() {} + + public EstimateResumeSubscriptionBuilder resumeOption(ResumeOption value) { + this.resumeOption = value; + return this; + } + + public EstimateResumeSubscriptionBuilder chargesHandling(ChargesHandling value) { + this.chargesHandling = value; + return this; + } + + public EstimateResumeSubscriptionBuilder subscription(SubscriptionParams value) { + this.subscription = value; + return this; + } + + public EstimateResumeSubscriptionParams build() { + return new EstimateResumeSubscriptionParams(this); + } + } + + public enum ResumeOption { + IMMEDIATELY("immediately"), + + SPECIFIC_DATE("specific_date"), + + /** An enum member indicating that ResumeOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ResumeOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ResumeOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ResumeOption enumValue : ResumeOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargesHandling { + INVOICE_IMMEDIATELY("invoice_immediately"), + + ADD_TO_UNBILLED_CHARGES("add_to_unbilled_charges"), + + /** An enum member indicating that ChargesHandling was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargesHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargesHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargesHandling enumValue : ChargesHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionParams { + + private final Timestamp resumeDate; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.resumeDate = builder.resumeDate; + } + + public Timestamp getResumeDate() { + return resumeDate; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.resumeDate != null) { + + formData.put("resume_date", this.resumeDate); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private Timestamp resumeDate; + + private SubscriptionBuilder() {} + + public SubscriptionBuilder resumeDate(Timestamp value) { + this.resumeDate = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/PauseSubscriptionEstimateForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/PauseSubscriptionEstimateForSubscriptionParams.java deleted file mode 100644 index abd383d9..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/PauseSubscriptionEstimateForSubscriptionParams.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class PauseSubscriptionEstimateForSubscriptionParams { - - private final PauseOption pauseOption; - - private final UnbilledChargesHandling unbilledChargesHandling; - - private final SubscriptionParams subscription; - - private PauseSubscriptionEstimateForSubscriptionParams( - PauseSubscriptionEstimateForSubscriptionBuilder builder) { - - this.pauseOption = builder.pauseOption; - - this.unbilledChargesHandling = builder.unbilledChargesHandling; - - this.subscription = builder.subscription; - } - - public PauseOption getPauseOption() { - return pauseOption; - } - - public UnbilledChargesHandling getUnbilledChargesHandling() { - return unbilledChargesHandling; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.pauseOption != null) { - - formData.put("pause_option", this.pauseOption); - } - - if (this.unbilledChargesHandling != null) { - - formData.put("unbilled_charges_handling", this.unbilledChargesHandling); - } - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for PauseSubscriptionEstimateForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PauseSubscriptionEstimateForSubscriptionBuilder builder() { - return new PauseSubscriptionEstimateForSubscriptionBuilder(); - } - - public static final class PauseSubscriptionEstimateForSubscriptionBuilder { - - private PauseOption pauseOption; - - private UnbilledChargesHandling unbilledChargesHandling; - - private SubscriptionParams subscription; - - private PauseSubscriptionEstimateForSubscriptionBuilder() {} - - public PauseSubscriptionEstimateForSubscriptionBuilder pauseOption(PauseOption value) { - this.pauseOption = value; - return this; - } - - public PauseSubscriptionEstimateForSubscriptionBuilder unbilledChargesHandling( - UnbilledChargesHandling value) { - this.unbilledChargesHandling = value; - return this; - } - - public PauseSubscriptionEstimateForSubscriptionBuilder subscription(SubscriptionParams value) { - this.subscription = value; - return this; - } - - public PauseSubscriptionEstimateForSubscriptionParams build() { - return new PauseSubscriptionEstimateForSubscriptionParams(this); - } - } - - public enum PauseOption { - IMMEDIATELY("immediately"), - - END_OF_TERM("end_of_term"), - - SPECIFIC_DATE("specific_date"), - - BILLING_CYCLES("billing_cycles"), - - /** An enum member indicating that PauseOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PauseOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PauseOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (PauseOption enumValue : PauseOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum UnbilledChargesHandling { - NO_ACTION("no_action"), - - INVOICE("invoice"), - - /** - * An enum member indicating that UnbilledChargesHandling was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - UnbilledChargesHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static UnbilledChargesHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (UnbilledChargesHandling enumValue : UnbilledChargesHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionParams { - - private final Timestamp pauseDate; - - private final Timestamp resumeDate; - - private final Integer skipBillingCycles; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.pauseDate = builder.pauseDate; - - this.resumeDate = builder.resumeDate; - - this.skipBillingCycles = builder.skipBillingCycles; - } - - public Timestamp getPauseDate() { - return pauseDate; - } - - public Timestamp getResumeDate() { - return resumeDate; - } - - public Integer getSkipBillingCycles() { - return skipBillingCycles; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.pauseDate != null) { - - formData.put("pause_date", this.pauseDate); - } - - if (this.resumeDate != null) { - - formData.put("resume_date", this.resumeDate); - } - - if (this.skipBillingCycles != null) { - - formData.put("skip_billing_cycles", this.skipBillingCycles); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private Timestamp pauseDate; - - private Timestamp resumeDate; - - private Integer skipBillingCycles; - - private SubscriptionBuilder() {} - - public SubscriptionBuilder pauseDate(Timestamp value) { - this.pauseDate = value; - return this; - } - - public SubscriptionBuilder resumeDate(Timestamp value) { - this.resumeDate = value; - return this; - } - - public SubscriptionBuilder skipBillingCycles(Integer value) { - this.skipBillingCycles = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/RegenerateInvoiceEstimateForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/RegenerateInvoiceEstimateForSubscriptionParams.java deleted file mode 100644 index f06e0aff..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/RegenerateInvoiceEstimateForSubscriptionParams.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class RegenerateInvoiceEstimateForSubscriptionParams { - - private final Timestamp dateFrom; - - private final Timestamp dateTo; - - private final Boolean prorate; - - private final Boolean invoiceImmediately; - - private RegenerateInvoiceEstimateForSubscriptionParams( - RegenerateInvoiceEstimateForSubscriptionBuilder builder) { - - this.dateFrom = builder.dateFrom; - - this.dateTo = builder.dateTo; - - this.prorate = builder.prorate; - - this.invoiceImmediately = builder.invoiceImmediately; - } - - public Timestamp getDateFrom() { - return dateFrom; - } - - public Timestamp getDateTo() { - return dateTo; - } - - public Boolean getProrate() { - return prorate; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.dateFrom != null) { - - formData.put("date_from", this.dateFrom); - } - - if (this.dateTo != null) { - - formData.put("date_to", this.dateTo); - } - - if (this.prorate != null) { - - formData.put("prorate", this.prorate); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - return formData; - } - - /** Create a new builder for RegenerateInvoiceEstimateForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RegenerateInvoiceEstimateForSubscriptionBuilder builder() { - return new RegenerateInvoiceEstimateForSubscriptionBuilder(); - } - - public static final class RegenerateInvoiceEstimateForSubscriptionBuilder { - - private Timestamp dateFrom; - - private Timestamp dateTo; - - private Boolean prorate; - - private Boolean invoiceImmediately; - - private RegenerateInvoiceEstimateForSubscriptionBuilder() {} - - public RegenerateInvoiceEstimateForSubscriptionBuilder dateFrom(Timestamp value) { - this.dateFrom = value; - return this; - } - - public RegenerateInvoiceEstimateForSubscriptionBuilder dateTo(Timestamp value) { - this.dateTo = value; - return this; - } - - public RegenerateInvoiceEstimateForSubscriptionBuilder prorate(Boolean value) { - this.prorate = value; - return this; - } - - public RegenerateInvoiceEstimateForSubscriptionBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public RegenerateInvoiceEstimateForSubscriptionParams build() { - return new RegenerateInvoiceEstimateForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/RegenerateInvoiceEstimateParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/RegenerateInvoiceEstimateParams.java new file mode 100644 index 00000000..46ff139d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/RegenerateInvoiceEstimateParams.java @@ -0,0 +1,121 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class RegenerateInvoiceEstimateParams { + + private final Timestamp dateFrom; + + private final Timestamp dateTo; + + private final Boolean prorate; + + private final Boolean invoiceImmediately; + + private RegenerateInvoiceEstimateParams(RegenerateInvoiceEstimateBuilder builder) { + + this.dateFrom = builder.dateFrom; + + this.dateTo = builder.dateTo; + + this.prorate = builder.prorate; + + this.invoiceImmediately = builder.invoiceImmediately; + } + + public Timestamp getDateFrom() { + return dateFrom; + } + + public Timestamp getDateTo() { + return dateTo; + } + + public Boolean getProrate() { + return prorate; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.dateFrom != null) { + + formData.put("date_from", this.dateFrom); + } + + if (this.dateTo != null) { + + formData.put("date_to", this.dateTo); + } + + if (this.prorate != null) { + + formData.put("prorate", this.prorate); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + return formData; + } + + /** Create a new builder for RegenerateInvoiceEstimateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static RegenerateInvoiceEstimateBuilder builder() { + return new RegenerateInvoiceEstimateBuilder(); + } + + public static final class RegenerateInvoiceEstimateBuilder { + + private Timestamp dateFrom; + + private Timestamp dateTo; + + private Boolean prorate; + + private Boolean invoiceImmediately; + + private RegenerateInvoiceEstimateBuilder() {} + + public RegenerateInvoiceEstimateBuilder dateFrom(Timestamp value) { + this.dateFrom = value; + return this; + } + + public RegenerateInvoiceEstimateBuilder dateTo(Timestamp value) { + this.dateTo = value; + return this; + } + + public RegenerateInvoiceEstimateBuilder prorate(Boolean value) { + this.prorate = value; + return this; + } + + public RegenerateInvoiceEstimateBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public RegenerateInvoiceEstimateParams build() { + return new RegenerateInvoiceEstimateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/RenewalEstimateForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/RenewalEstimateForSubscriptionParams.java deleted file mode 100644 index 40fc62fd..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/RenewalEstimateForSubscriptionParams.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RenewalEstimateForSubscriptionParams { - - private final Map queryParams; - - private RenewalEstimateForSubscriptionParams(RenewalEstimateForSubscriptionBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public RenewalEstimateForSubscriptionBuilder toBuilder() { - RenewalEstimateForSubscriptionBuilder builder = new RenewalEstimateForSubscriptionBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for RenewalEstimateForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RenewalEstimateForSubscriptionBuilder builder() { - return new RenewalEstimateForSubscriptionBuilder(); - } - - public static final class RenewalEstimateForSubscriptionBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private RenewalEstimateForSubscriptionBuilder() {} - - public RenewalEstimateForSubscriptionBuilder includeDelayedCharges(Boolean value) { - queryParams.put("include_delayed_charges", value); - return this; - } - - public RenewalEstimateForSubscriptionBuilder useExistingBalances(Boolean value) { - queryParams.put("use_existing_balances", value); - return this; - } - - public RenewalEstimateForSubscriptionBuilder ignoreScheduledCancellation(Boolean value) { - queryParams.put("ignore_scheduled_cancellation", value); - return this; - } - - public RenewalEstimateForSubscriptionBuilder ignoreScheduledChanges(Boolean value) { - queryParams.put("ignore_scheduled_changes", value); - return this; - } - - public RenewalEstimateForSubscriptionBuilder excludeTaxType(ExcludeTaxType value) { - queryParams.put("exclude_tax_type", value); - return this; - } - - public RenewalEstimateForSubscriptionParams build() { - return new RenewalEstimateForSubscriptionParams(this); - } - } - - public enum ExcludeTaxType { - EXCLUSIVE("exclusive"), - - NONE("none"), - - /** An enum member indicating that ExcludeTaxType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ExcludeTaxType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ExcludeTaxType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ExcludeTaxType enumValue : ExcludeTaxType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/RenewalEstimateParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/RenewalEstimateParams.java new file mode 100644 index 00000000..e15be559 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/RenewalEstimateParams.java @@ -0,0 +1,103 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class RenewalEstimateParams { + + private final Map queryParams; + + private RenewalEstimateParams(RenewalEstimateBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public RenewalEstimateBuilder toBuilder() { + RenewalEstimateBuilder builder = new RenewalEstimateBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for RenewalEstimateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static RenewalEstimateBuilder builder() { + return new RenewalEstimateBuilder(); + } + + public static final class RenewalEstimateBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private RenewalEstimateBuilder() {} + + public RenewalEstimateBuilder includeDelayedCharges(Boolean value) { + queryParams.put("include_delayed_charges", value); + return this; + } + + public RenewalEstimateBuilder useExistingBalances(Boolean value) { + queryParams.put("use_existing_balances", value); + return this; + } + + public RenewalEstimateBuilder ignoreScheduledCancellation(Boolean value) { + queryParams.put("ignore_scheduled_cancellation", value); + return this; + } + + public RenewalEstimateBuilder ignoreScheduledChanges(Boolean value) { + queryParams.put("ignore_scheduled_changes", value); + return this; + } + + public RenewalEstimateBuilder excludeTaxType(ExcludeTaxType value) { + queryParams.put("exclude_tax_type", value); + return this; + } + + public RenewalEstimateParams build() { + return new RenewalEstimateParams(this); + } + } + + public enum ExcludeTaxType { + EXCLUSIVE("exclusive"), + + NONE("none"), + + /** An enum member indicating that ExcludeTaxType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ExcludeTaxType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ExcludeTaxType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ExcludeTaxType enumValue : ExcludeTaxType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/ResumeSubscriptionEstimateForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/ResumeSubscriptionEstimateForSubscriptionParams.java deleted file mode 100644 index b9373bfd..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/ResumeSubscriptionEstimateForSubscriptionParams.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class ResumeSubscriptionEstimateForSubscriptionParams { - - private final ResumeOption resumeOption; - - private final ChargesHandling chargesHandling; - - private final SubscriptionParams subscription; - - private ResumeSubscriptionEstimateForSubscriptionParams( - ResumeSubscriptionEstimateForSubscriptionBuilder builder) { - - this.resumeOption = builder.resumeOption; - - this.chargesHandling = builder.chargesHandling; - - this.subscription = builder.subscription; - } - - public ResumeOption getResumeOption() { - return resumeOption; - } - - public ChargesHandling getChargesHandling() { - return chargesHandling; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.resumeOption != null) { - - formData.put("resume_option", this.resumeOption); - } - - if (this.chargesHandling != null) { - - formData.put("charges_handling", this.chargesHandling); - } - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for ResumeSubscriptionEstimateForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ResumeSubscriptionEstimateForSubscriptionBuilder builder() { - return new ResumeSubscriptionEstimateForSubscriptionBuilder(); - } - - public static final class ResumeSubscriptionEstimateForSubscriptionBuilder { - - private ResumeOption resumeOption; - - private ChargesHandling chargesHandling; - - private SubscriptionParams subscription; - - private ResumeSubscriptionEstimateForSubscriptionBuilder() {} - - public ResumeSubscriptionEstimateForSubscriptionBuilder resumeOption(ResumeOption value) { - this.resumeOption = value; - return this; - } - - public ResumeSubscriptionEstimateForSubscriptionBuilder chargesHandling(ChargesHandling value) { - this.chargesHandling = value; - return this; - } - - public ResumeSubscriptionEstimateForSubscriptionBuilder subscription(SubscriptionParams value) { - this.subscription = value; - return this; - } - - public ResumeSubscriptionEstimateForSubscriptionParams build() { - return new ResumeSubscriptionEstimateForSubscriptionParams(this); - } - } - - public enum ResumeOption { - IMMEDIATELY("immediately"), - - SPECIFIC_DATE("specific_date"), - - /** An enum member indicating that ResumeOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ResumeOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ResumeOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ResumeOption enumValue : ResumeOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargesHandling { - INVOICE_IMMEDIATELY("invoice_immediately"), - - ADD_TO_UNBILLED_CHARGES("add_to_unbilled_charges"), - - /** An enum member indicating that ChargesHandling was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargesHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargesHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargesHandling enumValue : ChargesHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionParams { - - private final Timestamp resumeDate; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.resumeDate = builder.resumeDate; - } - - public Timestamp getResumeDate() { - return resumeDate; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.resumeDate != null) { - - formData.put("resume_date", this.resumeDate); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private Timestamp resumeDate; - - private SubscriptionBuilder() {} - - public SubscriptionBuilder resumeDate(Timestamp value) { - this.resumeDate = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/UpcomingInvoicesEstimateForCustomerParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/UpcomingInvoicesEstimateForCustomerParams.java deleted file mode 100644 index 023b959b..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/params/UpcomingInvoicesEstimateForCustomerParams.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.estimate.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UpcomingInvoicesEstimateForCustomerParams { - - private final Map queryParams; - - private UpcomingInvoicesEstimateForCustomerParams( - UpcomingInvoicesEstimateForCustomerBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public UpcomingInvoicesEstimateForCustomerBuilder toBuilder() { - UpcomingInvoicesEstimateForCustomerBuilder builder = - new UpcomingInvoicesEstimateForCustomerBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for UpcomingInvoicesEstimateForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpcomingInvoicesEstimateForCustomerBuilder builder() { - return new UpcomingInvoicesEstimateForCustomerBuilder(); - } - - public static final class UpcomingInvoicesEstimateForCustomerBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private UpcomingInvoicesEstimateForCustomerBuilder() {} - - public UpcomingInvoicesEstimateForCustomerParams build() { - return new UpcomingInvoicesEstimateForCustomerParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/UpcomingInvoicesEstimateParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/UpcomingInvoicesEstimateParams.java new file mode 100644 index 00000000..fa7fc50d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/params/UpcomingInvoicesEstimateParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.estimate.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class UpcomingInvoicesEstimateParams { + + private final Map queryParams; + + private UpcomingInvoicesEstimateParams(UpcomingInvoicesEstimateBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public UpcomingInvoicesEstimateBuilder toBuilder() { + UpcomingInvoicesEstimateBuilder builder = new UpcomingInvoicesEstimateBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for UpcomingInvoicesEstimateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UpcomingInvoicesEstimateBuilder builder() { + return new UpcomingInvoicesEstimateBuilder(); + } + + public static final class UpcomingInvoicesEstimateBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private UpcomingInvoicesEstimateBuilder() {} + + public UpcomingInvoicesEstimateParams build() { + return new UpcomingInvoicesEstimateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/AdvanceInvoiceEstimateForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/AdvanceInvoiceEstimateForSubscriptionResponse.java deleted file mode 100644 index 17217cb2..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/AdvanceInvoiceEstimateForSubscriptionResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AdvanceInvoiceEstimateForSubscription operation. Contains the - * response data from the API. - */ -public final class AdvanceInvoiceEstimateForSubscriptionResponse extends BaseResponse { - private final Estimate estimate; - - private AdvanceInvoiceEstimateForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into AdvanceInvoiceEstimateForSubscriptionResponse object. */ - public static AdvanceInvoiceEstimateForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into AdvanceInvoiceEstimateForSubscriptionResponse object with HTTP - * response. - */ - public static AdvanceInvoiceEstimateForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse AdvanceInvoiceEstimateForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for AdvanceInvoiceEstimateForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AdvanceInvoiceEstimateForSubscriptionResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AdvanceInvoiceEstimateForSubscriptionResponse build() { - return new AdvanceInvoiceEstimateForSubscriptionResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/AdvanceInvoiceEstimateResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/AdvanceInvoiceEstimateResponse.java new file mode 100644 index 00000000..ca0ba476 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/AdvanceInvoiceEstimateResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for AdvanceInvoiceEstimate operation. Contains the response data from + * the API. + */ +public final class AdvanceInvoiceEstimateResponse extends BaseResponse { + private final Estimate estimate; + + private AdvanceInvoiceEstimateResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into AdvanceInvoiceEstimateResponse object. */ + public static AdvanceInvoiceEstimateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into AdvanceInvoiceEstimateResponse object with HTTP response. */ + public static AdvanceInvoiceEstimateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse AdvanceInvoiceEstimateResponse from JSON", e); + } + } + + /** Create a new builder for AdvanceInvoiceEstimateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for AdvanceInvoiceEstimateResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public AdvanceInvoiceEstimateResponse build() { + return new AdvanceInvoiceEstimateResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/CancelSubscriptionEstimateForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/CancelSubscriptionEstimateForSubscriptionResponse.java deleted file mode 100644 index 126bc061..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/CancelSubscriptionEstimateForSubscriptionResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CancelSubscriptionEstimateForSubscription operation. Contains the - * response data from the API. - */ -public final class CancelSubscriptionEstimateForSubscriptionResponse extends BaseResponse { - private final Estimate estimate; - - private CancelSubscriptionEstimateForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into CancelSubscriptionEstimateForSubscriptionResponse object. */ - public static CancelSubscriptionEstimateForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into CancelSubscriptionEstimateForSubscriptionResponse object with HTTP - * response. - */ - public static CancelSubscriptionEstimateForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse CancelSubscriptionEstimateForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for CancelSubscriptionEstimateForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CancelSubscriptionEstimateForSubscriptionResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CancelSubscriptionEstimateForSubscriptionResponse build() { - return new CancelSubscriptionEstimateForSubscriptionResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/CancelSubscriptionForItemsEstimateForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/CancelSubscriptionForItemsEstimateForSubscriptionResponse.java deleted file mode 100644 index 094324f2..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/CancelSubscriptionForItemsEstimateForSubscriptionResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CancelSubscriptionForItemsEstimateForSubscription operation. - * Contains the response data from the API. - */ -public final class CancelSubscriptionForItemsEstimateForSubscriptionResponse extends BaseResponse { - private final Estimate estimate; - - private CancelSubscriptionForItemsEstimateForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into CancelSubscriptionForItemsEstimateForSubscriptionResponse object. */ - public static CancelSubscriptionForItemsEstimateForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into CancelSubscriptionForItemsEstimateForSubscriptionResponse object with - * HTTP response. - */ - public static CancelSubscriptionForItemsEstimateForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse CancelSubscriptionForItemsEstimateForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for CancelSubscriptionForItemsEstimateForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CancelSubscriptionForItemsEstimateForSubscriptionResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CancelSubscriptionForItemsEstimateForSubscriptionResponse build() { - return new CancelSubscriptionForItemsEstimateForSubscriptionResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/ChangeTermEndEstimateForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/ChangeTermEndEstimateForSubscriptionResponse.java deleted file mode 100644 index cc60c6e9..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/ChangeTermEndEstimateForSubscriptionResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ChangeTermEndEstimateForSubscription operation. Contains the - * response data from the API. - */ -public final class ChangeTermEndEstimateForSubscriptionResponse extends BaseResponse { - private final Estimate estimate; - - private ChangeTermEndEstimateForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into ChangeTermEndEstimateForSubscriptionResponse object. */ - public static ChangeTermEndEstimateForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into ChangeTermEndEstimateForSubscriptionResponse object with HTTP - * response. - */ - public static ChangeTermEndEstimateForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ChangeTermEndEstimateForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ChangeTermEndEstimateForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ChangeTermEndEstimateForSubscriptionResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ChangeTermEndEstimateForSubscriptionResponse build() { - return new ChangeTermEndEstimateForSubscriptionResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionEstimateForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionEstimateForCustomerResponse.java deleted file mode 100644 index 76831f52..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionEstimateForCustomerResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CreateSubscriptionEstimateForCustomer operation. Contains the - * response data from a single resource get operation. - */ -public final class CreateSubscriptionEstimateForCustomerResponse extends BaseResponse { - private final Estimate estimate; - - private CreateSubscriptionEstimateForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into CreateSubscriptionEstimateForCustomerResponse object. */ - public static CreateSubscriptionEstimateForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into CreateSubscriptionEstimateForCustomerResponse object with HTTP - * response. - */ - public static CreateSubscriptionEstimateForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse CreateSubscriptionEstimateForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for CreateSubscriptionEstimateForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CreateSubscriptionEstimateForCustomerResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CreateSubscriptionEstimateForCustomerResponse build() { - return new CreateSubscriptionEstimateForCustomerResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionForCustomerEstimateResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionForCustomerEstimateResponse.java new file mode 100644 index 00000000..7371b7e8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionForCustomerEstimateResponse.java @@ -0,0 +1,82 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreateSubscriptionForCustomerEstimate operation. Contains the + * response data from a single resource get operation. + */ +public final class CreateSubscriptionForCustomerEstimateResponse extends BaseResponse { + private final Estimate estimate; + + private CreateSubscriptionForCustomerEstimateResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into CreateSubscriptionForCustomerEstimateResponse object. */ + public static CreateSubscriptionForCustomerEstimateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into CreateSubscriptionForCustomerEstimateResponse object with HTTP + * response. + */ + public static CreateSubscriptionForCustomerEstimateResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CreateSubscriptionForCustomerEstimateResponse from JSON", e); + } + } + + /** Create a new builder for CreateSubscriptionForCustomerEstimateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreateSubscriptionForCustomerEstimateResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreateSubscriptionForCustomerEstimateResponse build() { + return new CreateSubscriptionForCustomerEstimateResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionForItemsEstimateForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionForItemsEstimateForCustomerResponse.java deleted file mode 100644 index 5c3764a0..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionForItemsEstimateForCustomerResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CreateSubscriptionForItemsEstimateForCustomer operation. Contains - * the response data from the API. - */ -public final class CreateSubscriptionForItemsEstimateForCustomerResponse extends BaseResponse { - private final Estimate estimate; - - private CreateSubscriptionForItemsEstimateForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into CreateSubscriptionForItemsEstimateForCustomerResponse object. */ - public static CreateSubscriptionForItemsEstimateForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into CreateSubscriptionForItemsEstimateForCustomerResponse object with HTTP - * response. - */ - public static CreateSubscriptionForItemsEstimateForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse CreateSubscriptionForItemsEstimateForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for CreateSubscriptionForItemsEstimateForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CreateSubscriptionForItemsEstimateForCustomerResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CreateSubscriptionForItemsEstimateForCustomerResponse build() { - return new CreateSubscriptionForItemsEstimateForCustomerResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionItemEstimateResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionItemEstimateResponse.java new file mode 100644 index 00000000..5d3bfb5d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionItemEstimateResponse.java @@ -0,0 +1,79 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreateSubscriptionItemEstimate operation. Contains the response + * data from the API. + */ +public final class CreateSubscriptionItemEstimateResponse extends BaseResponse { + private final Estimate estimate; + + private CreateSubscriptionItemEstimateResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into CreateSubscriptionItemEstimateResponse object. */ + public static CreateSubscriptionItemEstimateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreateSubscriptionItemEstimateResponse object with HTTP response. */ + public static CreateSubscriptionItemEstimateResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CreateSubscriptionItemEstimateResponse from JSON", e); + } + } + + /** Create a new builder for CreateSubscriptionItemEstimateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreateSubscriptionItemEstimateResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreateSubscriptionItemEstimateResponse build() { + return new CreateSubscriptionItemEstimateResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionItemForCustomerEstimateResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionItemForCustomerEstimateResponse.java new file mode 100644 index 00000000..418da411 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/CreateSubscriptionItemForCustomerEstimateResponse.java @@ -0,0 +1,82 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreateSubscriptionItemForCustomerEstimate operation. Contains the + * response data from the API. + */ +public final class CreateSubscriptionItemForCustomerEstimateResponse extends BaseResponse { + private final Estimate estimate; + + private CreateSubscriptionItemForCustomerEstimateResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into CreateSubscriptionItemForCustomerEstimateResponse object. */ + public static CreateSubscriptionItemForCustomerEstimateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into CreateSubscriptionItemForCustomerEstimateResponse object with HTTP + * response. + */ + public static CreateSubscriptionItemForCustomerEstimateResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CreateSubscriptionItemForCustomerEstimateResponse from JSON", e); + } + } + + /** Create a new builder for CreateSubscriptionItemForCustomerEstimateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreateSubscriptionItemForCustomerEstimateResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreateSubscriptionItemForCustomerEstimateResponse build() { + return new CreateSubscriptionItemForCustomerEstimateResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateCancelSubscriptionForItemsResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateCancelSubscriptionForItemsResponse.java new file mode 100644 index 00000000..df53d1ca --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateCancelSubscriptionForItemsResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for EstimateCancelSubscriptionForItems operation. Contains the response + * data from the API. + */ +public final class EstimateCancelSubscriptionForItemsResponse extends BaseResponse { + private final Estimate estimate; + + private EstimateCancelSubscriptionForItemsResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into EstimateCancelSubscriptionForItemsResponse object. */ + public static EstimateCancelSubscriptionForItemsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into EstimateCancelSubscriptionForItemsResponse object with HTTP response. + */ + public static EstimateCancelSubscriptionForItemsResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse EstimateCancelSubscriptionForItemsResponse from JSON", e); + } + } + + /** Create a new builder for EstimateCancelSubscriptionForItemsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for EstimateCancelSubscriptionForItemsResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public EstimateCancelSubscriptionForItemsResponse build() { + return new EstimateCancelSubscriptionForItemsResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateCancelSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateCancelSubscriptionResponse.java new file mode 100644 index 00000000..b253de87 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateCancelSubscriptionResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for EstimateCancelSubscription operation. Contains the response data + * from the API. + */ +public final class EstimateCancelSubscriptionResponse extends BaseResponse { + private final Estimate estimate; + + private EstimateCancelSubscriptionResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into EstimateCancelSubscriptionResponse object. */ + public static EstimateCancelSubscriptionResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into EstimateCancelSubscriptionResponse object with HTTP response. */ + public static EstimateCancelSubscriptionResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse EstimateCancelSubscriptionResponse from JSON", e); + } + } + + /** Create a new builder for EstimateCancelSubscriptionResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for EstimateCancelSubscriptionResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public EstimateCancelSubscriptionResponse build() { + return new EstimateCancelSubscriptionResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateChangeTermEndResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateChangeTermEndResponse.java new file mode 100644 index 00000000..9a7d390d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateChangeTermEndResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for EstimateChangeTermEnd operation. Contains the response data from + * the API. + */ +public final class EstimateChangeTermEndResponse extends BaseResponse { + private final Estimate estimate; + + private EstimateChangeTermEndResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into EstimateChangeTermEndResponse object. */ + public static EstimateChangeTermEndResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into EstimateChangeTermEndResponse object with HTTP response. */ + public static EstimateChangeTermEndResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse EstimateChangeTermEndResponse from JSON", e); + } + } + + /** Create a new builder for EstimateChangeTermEndResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for EstimateChangeTermEndResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public EstimateChangeTermEndResponse build() { + return new EstimateChangeTermEndResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateCreateSubscriptionForItemsResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateCreateSubscriptionForItemsResponse.java deleted file mode 100644 index ff5d3202..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateCreateSubscriptionForItemsResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for EstimateCreateSubscriptionForItems operation. Contains the response - * data from the API. - */ -public final class EstimateCreateSubscriptionForItemsResponse extends BaseResponse { - private final Estimate estimate; - - private EstimateCreateSubscriptionForItemsResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into EstimateCreateSubscriptionForItemsResponse object. */ - public static EstimateCreateSubscriptionForItemsResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into EstimateCreateSubscriptionForItemsResponse object with HTTP response. - */ - public static EstimateCreateSubscriptionForItemsResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse EstimateCreateSubscriptionForItemsResponse from JSON", e); - } - } - - /** Create a new builder for EstimateCreateSubscriptionForItemsResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for EstimateCreateSubscriptionForItemsResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public EstimateCreateSubscriptionForItemsResponse build() { - return new EstimateCreateSubscriptionForItemsResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/EstimatePauseSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/EstimatePauseSubscriptionResponse.java new file mode 100644 index 00000000..2b858001 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/EstimatePauseSubscriptionResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for EstimatePauseSubscription operation. Contains the response data + * from the API. + */ +public final class EstimatePauseSubscriptionResponse extends BaseResponse { + private final Estimate estimate; + + private EstimatePauseSubscriptionResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into EstimatePauseSubscriptionResponse object. */ + public static EstimatePauseSubscriptionResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into EstimatePauseSubscriptionResponse object with HTTP response. */ + public static EstimatePauseSubscriptionResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse EstimatePauseSubscriptionResponse from JSON", e); + } + } + + /** Create a new builder for EstimatePauseSubscriptionResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for EstimatePauseSubscriptionResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public EstimatePauseSubscriptionResponse build() { + return new EstimatePauseSubscriptionResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateResumeSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateResumeSubscriptionResponse.java new file mode 100644 index 00000000..e2785e95 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/EstimateResumeSubscriptionResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for EstimateResumeSubscription operation. Contains the response data + * from the API. + */ +public final class EstimateResumeSubscriptionResponse extends BaseResponse { + private final Estimate estimate; + + private EstimateResumeSubscriptionResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into EstimateResumeSubscriptionResponse object. */ + public static EstimateResumeSubscriptionResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into EstimateResumeSubscriptionResponse object with HTTP response. */ + public static EstimateResumeSubscriptionResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse EstimateResumeSubscriptionResponse from JSON", e); + } + } + + /** Create a new builder for EstimateResumeSubscriptionResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for EstimateResumeSubscriptionResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public EstimateResumeSubscriptionResponse build() { + return new EstimateResumeSubscriptionResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/PauseSubscriptionEstimateForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/PauseSubscriptionEstimateForSubscriptionResponse.java deleted file mode 100644 index 342aa0ff..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/PauseSubscriptionEstimateForSubscriptionResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for PauseSubscriptionEstimateForSubscription operation. Contains the - * response data from the API. - */ -public final class PauseSubscriptionEstimateForSubscriptionResponse extends BaseResponse { - private final Estimate estimate; - - private PauseSubscriptionEstimateForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into PauseSubscriptionEstimateForSubscriptionResponse object. */ - public static PauseSubscriptionEstimateForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into PauseSubscriptionEstimateForSubscriptionResponse object with HTTP - * response. - */ - public static PauseSubscriptionEstimateForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse PauseSubscriptionEstimateForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for PauseSubscriptionEstimateForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for PauseSubscriptionEstimateForSubscriptionResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public PauseSubscriptionEstimateForSubscriptionResponse build() { - return new PauseSubscriptionEstimateForSubscriptionResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/RegenerateInvoiceEstimateForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/RegenerateInvoiceEstimateForSubscriptionResponse.java deleted file mode 100644 index 14af1dd4..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/RegenerateInvoiceEstimateForSubscriptionResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RegenerateInvoiceEstimateForSubscription operation. Contains the - * response data from the API. - */ -public final class RegenerateInvoiceEstimateForSubscriptionResponse extends BaseResponse { - private final Estimate estimate; - - private RegenerateInvoiceEstimateForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into RegenerateInvoiceEstimateForSubscriptionResponse object. */ - public static RegenerateInvoiceEstimateForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into RegenerateInvoiceEstimateForSubscriptionResponse object with HTTP - * response. - */ - public static RegenerateInvoiceEstimateForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RegenerateInvoiceEstimateForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RegenerateInvoiceEstimateForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RegenerateInvoiceEstimateForSubscriptionResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RegenerateInvoiceEstimateForSubscriptionResponse build() { - return new RegenerateInvoiceEstimateForSubscriptionResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/RegenerateInvoiceEstimateResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/RegenerateInvoiceEstimateResponse.java new file mode 100644 index 00000000..8c0f6017 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/RegenerateInvoiceEstimateResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for RegenerateInvoiceEstimate operation. Contains the response data + * from the API. + */ +public final class RegenerateInvoiceEstimateResponse extends BaseResponse { + private final Estimate estimate; + + private RegenerateInvoiceEstimateResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into RegenerateInvoiceEstimateResponse object. */ + public static RegenerateInvoiceEstimateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into RegenerateInvoiceEstimateResponse object with HTTP response. */ + public static RegenerateInvoiceEstimateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse RegenerateInvoiceEstimateResponse from JSON", e); + } + } + + /** Create a new builder for RegenerateInvoiceEstimateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for RegenerateInvoiceEstimateResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public RegenerateInvoiceEstimateResponse build() { + return new RegenerateInvoiceEstimateResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/RenewalEstimateForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/RenewalEstimateForSubscriptionResponse.java deleted file mode 100644 index 4b923061..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/RenewalEstimateForSubscriptionResponse.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RenewalEstimateForSubscription operation. Contains the response - * data from a single resource get operation. - */ -public final class RenewalEstimateForSubscriptionResponse extends BaseResponse { - private final Estimate estimate; - - private RenewalEstimateForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into RenewalEstimateForSubscriptionResponse object. */ - public static RenewalEstimateForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RenewalEstimateForSubscriptionResponse object with HTTP response. */ - public static RenewalEstimateForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RenewalEstimateForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RenewalEstimateForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RenewalEstimateForSubscriptionResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RenewalEstimateForSubscriptionResponse build() { - return new RenewalEstimateForSubscriptionResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/RenewalEstimateResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/RenewalEstimateResponse.java new file mode 100644 index 00000000..0df95276 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/RenewalEstimateResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for RenewalEstimate operation. Contains the response data from a single + * resource get operation. + */ +public final class RenewalEstimateResponse extends BaseResponse { + private final Estimate estimate; + + private RenewalEstimateResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into RenewalEstimateResponse object. */ + public static RenewalEstimateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into RenewalEstimateResponse object with HTTP response. */ + public static RenewalEstimateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse RenewalEstimateResponse from JSON", e); + } + } + + /** Create a new builder for RenewalEstimateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for RenewalEstimateResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public RenewalEstimateResponse build() { + return new RenewalEstimateResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/ResumeSubscriptionEstimateForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/ResumeSubscriptionEstimateForSubscriptionResponse.java deleted file mode 100644 index 6222d893..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/ResumeSubscriptionEstimateForSubscriptionResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ResumeSubscriptionEstimateForSubscription operation. Contains the - * response data from the API. - */ -public final class ResumeSubscriptionEstimateForSubscriptionResponse extends BaseResponse { - private final Estimate estimate; - - private ResumeSubscriptionEstimateForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into ResumeSubscriptionEstimateForSubscriptionResponse object. */ - public static ResumeSubscriptionEstimateForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into ResumeSubscriptionEstimateForSubscriptionResponse object with HTTP - * response. - */ - public static ResumeSubscriptionEstimateForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ResumeSubscriptionEstimateForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ResumeSubscriptionEstimateForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ResumeSubscriptionEstimateForSubscriptionResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ResumeSubscriptionEstimateForSubscriptionResponse build() { - return new ResumeSubscriptionEstimateForSubscriptionResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/UpcomingInvoicesEstimateForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/UpcomingInvoicesEstimateForCustomerResponse.java deleted file mode 100644 index 7ba943fc..00000000 --- a/src/main/java/com/chargebee/v4/models/estimate/responses/UpcomingInvoicesEstimateForCustomerResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.estimate.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpcomingInvoicesEstimateForCustomer operation. Contains the - * response data from a single resource get operation. - */ -public final class UpcomingInvoicesEstimateForCustomerResponse extends BaseResponse { - private final Estimate estimate; - - private UpcomingInvoicesEstimateForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into UpcomingInvoicesEstimateForCustomerResponse object. */ - public static UpcomingInvoicesEstimateForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into UpcomingInvoicesEstimateForCustomerResponse object with HTTP response. - */ - public static UpcomingInvoicesEstimateForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse UpcomingInvoicesEstimateForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for UpcomingInvoicesEstimateForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpcomingInvoicesEstimateForCustomerResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpcomingInvoicesEstimateForCustomerResponse build() { - return new UpcomingInvoicesEstimateForCustomerResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/estimate/responses/UpcomingInvoicesEstimateResponse.java b/src/main/java/com/chargebee/v4/models/estimate/responses/UpcomingInvoicesEstimateResponse.java new file mode 100644 index 00000000..b673ae3d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/estimate/responses/UpcomingInvoicesEstimateResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.estimate.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for UpcomingInvoicesEstimate operation. Contains the response data from + * a single resource get operation. + */ +public final class UpcomingInvoicesEstimateResponse extends BaseResponse { + private final Estimate estimate; + + private UpcomingInvoicesEstimateResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into UpcomingInvoicesEstimateResponse object. */ + public static UpcomingInvoicesEstimateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into UpcomingInvoicesEstimateResponse object with HTTP response. */ + public static UpcomingInvoicesEstimateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse UpcomingInvoicesEstimateResponse from JSON", e); + } + } + + /** Create a new builder for UpcomingInvoicesEstimateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for UpcomingInvoicesEstimateResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public UpcomingInvoicesEstimateResponse build() { + return new UpcomingInvoicesEstimateResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/event/CustomerBusinessEntityChangedEvent.java b/src/main/java/com/chargebee/v4/models/event/CustomerBusinessEntityChangedEvent.java index c72e7b61..bf6a4316 100644 --- a/src/main/java/com/chargebee/v4/models/event/CustomerBusinessEntityChangedEvent.java +++ b/src/main/java/com/chargebee/v4/models/event/CustomerBusinessEntityChangedEvent.java @@ -11,8 +11,6 @@ import com.chargebee.v4.models.customer.Customer; -import com.chargebee.v4.models.businessEntityChange.BusinessEntityChange; - import com.chargebee.v4.models.businessEntityTransfer.BusinessEntityTransfer; public class CustomerBusinessEntityChangedEvent { @@ -85,14 +83,9 @@ public static CustomerBusinessEntityChangedEvent fromJson(String json) { public static class Content { - private BusinessEntityChange businessEntityChange; private BusinessEntityTransfer businessEntityTransfer; private Customer customer; - public BusinessEntityChange getBusinessEntityChange() { - return businessEntityChange; - } - public BusinessEntityTransfer getBusinessEntityTransfer() { return businessEntityTransfer; } @@ -104,11 +97,6 @@ public Customer getCustomer() { public static Content fromJson(String json) { Content obj = new Content(); - String __businessEntityChangeJson = JsonUtil.getObject(json, "business_entity_change"); - if (__businessEntityChangeJson != null) { - obj.businessEntityChange = BusinessEntityChange.fromJson(__businessEntityChangeJson); - } - String __businessEntityTransferJson = JsonUtil.getObject(json, "business_entity_transfer"); if (__businessEntityTransferJson != null) { obj.businessEntityTransfer = BusinessEntityTransfer.fromJson(__businessEntityTransferJson); diff --git a/src/main/java/com/chargebee/v4/models/event/SubscriptionBusinessEntityChangedEvent.java b/src/main/java/com/chargebee/v4/models/event/SubscriptionBusinessEntityChangedEvent.java index 5db55d64..b7a674bf 100644 --- a/src/main/java/com/chargebee/v4/models/event/SubscriptionBusinessEntityChangedEvent.java +++ b/src/main/java/com/chargebee/v4/models/event/SubscriptionBusinessEntityChangedEvent.java @@ -9,8 +9,6 @@ import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.models.businessEntityChange.BusinessEntityChange; - import com.chargebee.v4.models.businessEntityTransfer.BusinessEntityTransfer; import com.chargebee.v4.models.subscription.Subscription; @@ -85,14 +83,9 @@ public static SubscriptionBusinessEntityChangedEvent fromJson(String json) { public static class Content { - private BusinessEntityChange businessEntityChange; private BusinessEntityTransfer businessEntityTransfer; private Subscription subscription; - public BusinessEntityChange getBusinessEntityChange() { - return businessEntityChange; - } - public BusinessEntityTransfer getBusinessEntityTransfer() { return businessEntityTransfer; } @@ -104,11 +97,6 @@ public Subscription getSubscription() { public static Content fromJson(String json) { Content obj = new Content(); - String __businessEntityChangeJson = JsonUtil.getObject(json, "business_entity_change"); - if (__businessEntityChangeJson != null) { - obj.businessEntityChange = BusinessEntityChange.fromJson(__businessEntityChangeJson); - } - String __businessEntityTransferJson = JsonUtil.getObject(json, "business_entity_transfer"); if (__businessEntityTransferJson != null) { obj.businessEntityTransfer = BusinessEntityTransfer.fromJson(__businessEntityTransferJson); diff --git a/src/main/java/com/chargebee/v4/models/event/responses/EventListResponse.java b/src/main/java/com/chargebee/v4/models/event/responses/EventListResponse.java index 2e7e17bd..343b6ca3 100644 --- a/src/main/java/com/chargebee/v4/models/event/responses/EventListResponse.java +++ b/src/main/java/com/chargebee/v4/models/event/responses/EventListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.event.Event; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.EventService; @@ -95,9 +96,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public EventListResponse nextPage() throws Exception { + public EventListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/export/params/ExportItemFamiliesParams.java b/src/main/java/com/chargebee/v4/models/export/params/ExportItemFamiliesParams.java index 89ecab9a..5ac5bfe2 100644 --- a/src/main/java/com/chargebee/v4/models/export/params/ExportItemFamiliesParams.java +++ b/src/main/java/com/chargebee/v4/models/export/params/ExportItemFamiliesParams.java @@ -116,37 +116,37 @@ public ExportItemFamiliesParams build() { public static final class BusinessEntityIdParams { - private final String is; - private final IsPresent isPresent; - private BusinessEntityIdParams(BusinessEntityIdBuilder builder) { + private final String is; - this.is = builder.is; + private BusinessEntityIdParams(BusinessEntityIdBuilder builder) { this.isPresent = builder.isPresent; - } - public String getIs() { - return is; + this.is = builder.is; } public IsPresent getIsPresent() { return isPresent; } + public String getIs() { + return is; + } + /** Get the form data for this request. */ public Map toFormData() { Map formData = new LinkedHashMap<>(); - if (this.is != null) { + if (this.isPresent != null) { - formData.put("is", this.is); + formData.put("is_present", this.isPresent); } - if (this.isPresent != null) { + if (this.is != null) { - formData.put("is_present", this.isPresent); + formData.put("is", this.is); } return formData; @@ -160,19 +160,19 @@ public static BusinessEntityIdBuilder builder() { public static final class BusinessEntityIdBuilder { - private String is; - private IsPresent isPresent; + private String is; + private BusinessEntityIdBuilder() {} - public BusinessEntityIdBuilder is(String value) { - this.is = value; + public BusinessEntityIdBuilder isPresent(IsPresent value) { + this.isPresent = value; return this; } - public BusinessEntityIdBuilder isPresent(IsPresent value) { - this.isPresent = value; + public BusinessEntityIdBuilder is(String value) { + this.is = value; return this; } diff --git a/src/main/java/com/chargebee/v4/models/export/params/ExportItemPricesParams.java b/src/main/java/com/chargebee/v4/models/export/params/ExportItemPricesParams.java index 8069bd17..c1956ce0 100644 --- a/src/main/java/com/chargebee/v4/models/export/params/ExportItemPricesParams.java +++ b/src/main/java/com/chargebee/v4/models/export/params/ExportItemPricesParams.java @@ -615,37 +615,37 @@ public CurrencyCodeParams build() { public static final class BusinessEntityIdParams { - private final String is; - private final IsPresent isPresent; - private BusinessEntityIdParams(BusinessEntityIdBuilder builder) { + private final String is; - this.is = builder.is; + private BusinessEntityIdParams(BusinessEntityIdBuilder builder) { this.isPresent = builder.isPresent; - } - public String getIs() { - return is; + this.is = builder.is; } public IsPresent getIsPresent() { return isPresent; } + public String getIs() { + return is; + } + /** Get the form data for this request. */ public Map toFormData() { Map formData = new LinkedHashMap<>(); - if (this.is != null) { + if (this.isPresent != null) { - formData.put("is", this.is); + formData.put("is_present", this.isPresent); } - if (this.isPresent != null) { + if (this.is != null) { - formData.put("is_present", this.isPresent); + formData.put("is", this.is); } return formData; @@ -659,19 +659,19 @@ public static BusinessEntityIdBuilder builder() { public static final class BusinessEntityIdBuilder { - private String is; - private IsPresent isPresent; + private String is; + private BusinessEntityIdBuilder() {} - public BusinessEntityIdBuilder is(String value) { - this.is = value; + public BusinessEntityIdBuilder isPresent(IsPresent value) { + this.isPresent = value; return this; } - public BusinessEntityIdBuilder isPresent(IsPresent value) { - this.isPresent = value; + public BusinessEntityIdBuilder is(String value) { + this.is = value; return this; } diff --git a/src/main/java/com/chargebee/v4/models/export/params/ExportItemsParams.java b/src/main/java/com/chargebee/v4/models/export/params/ExportItemsParams.java index 79f0ec66..7f3d7407 100644 --- a/src/main/java/com/chargebee/v4/models/export/params/ExportItemsParams.java +++ b/src/main/java/com/chargebee/v4/models/export/params/ExportItemsParams.java @@ -115,37 +115,37 @@ public ExportItemsParams build() { public static final class BusinessEntityIdParams { - private final String is; - private final IsPresent isPresent; - private BusinessEntityIdParams(BusinessEntityIdBuilder builder) { + private final String is; - this.is = builder.is; + private BusinessEntityIdParams(BusinessEntityIdBuilder builder) { this.isPresent = builder.isPresent; - } - public String getIs() { - return is; + this.is = builder.is; } public IsPresent getIsPresent() { return isPresent; } + public String getIs() { + return is; + } + /** Get the form data for this request. */ public Map toFormData() { Map formData = new LinkedHashMap<>(); - if (this.is != null) { + if (this.isPresent != null) { - formData.put("is", this.is); + formData.put("is_present", this.isPresent); } - if (this.isPresent != null) { + if (this.is != null) { - formData.put("is_present", this.isPresent); + formData.put("is", this.is); } return formData; @@ -159,19 +159,19 @@ public static BusinessEntityIdBuilder builder() { public static final class BusinessEntityIdBuilder { - private String is; - private IsPresent isPresent; + private String is; + private BusinessEntityIdBuilder() {} - public BusinessEntityIdBuilder is(String value) { - this.is = value; + public BusinessEntityIdBuilder isPresent(IsPresent value) { + this.isPresent = value; return this; } - public BusinessEntityIdBuilder isPresent(IsPresent value) { - this.isPresent = value; + public BusinessEntityIdBuilder is(String value) { + this.is = value; return this; } diff --git a/src/main/java/com/chargebee/v4/models/export/params/ExportPriceVariantsParams.java b/src/main/java/com/chargebee/v4/models/export/params/ExportPriceVariantsParams.java index 39ccdce2..2c7604c9 100644 --- a/src/main/java/com/chargebee/v4/models/export/params/ExportPriceVariantsParams.java +++ b/src/main/java/com/chargebee/v4/models/export/params/ExportPriceVariantsParams.java @@ -116,37 +116,37 @@ public ExportPriceVariantsParams build() { public static final class BusinessEntityIdParams { - private final String is; - private final IsPresent isPresent; - private BusinessEntityIdParams(BusinessEntityIdBuilder builder) { + private final String is; - this.is = builder.is; + private BusinessEntityIdParams(BusinessEntityIdBuilder builder) { this.isPresent = builder.isPresent; - } - public String getIs() { - return is; + this.is = builder.is; } public IsPresent getIsPresent() { return isPresent; } + public String getIs() { + return is; + } + /** Get the form data for this request. */ public Map toFormData() { Map formData = new LinkedHashMap<>(); - if (this.is != null) { + if (this.isPresent != null) { - formData.put("is", this.is); + formData.put("is_present", this.isPresent); } - if (this.isPresent != null) { + if (this.is != null) { - formData.put("is_present", this.isPresent); + formData.put("is", this.is); } return formData; @@ -160,19 +160,19 @@ public static BusinessEntityIdBuilder builder() { public static final class BusinessEntityIdBuilder { - private String is; - private IsPresent isPresent; + private String is; + private BusinessEntityIdBuilder() {} - public BusinessEntityIdBuilder is(String value) { - this.is = value; + public BusinessEntityIdBuilder isPresent(IsPresent value) { + this.isPresent = value; return this; } - public BusinessEntityIdBuilder isPresent(IsPresent value) { - this.isPresent = value; + public BusinessEntityIdBuilder is(String value) { + this.is = value; return this; } diff --git a/src/main/java/com/chargebee/v4/models/feature/params/ActivateCommandForFeatureParams.java b/src/main/java/com/chargebee/v4/models/feature/params/ActivateCommandForFeatureParams.java deleted file mode 100644 index 8ef46066..00000000 --- a/src/main/java/com/chargebee/v4/models/feature/params/ActivateCommandForFeatureParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.feature.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ActivateCommandForFeatureParams { - - private ActivateCommandForFeatureParams(ActivateCommandForFeatureBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for ActivateCommandForFeatureParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ActivateCommandForFeatureBuilder builder() { - return new ActivateCommandForFeatureBuilder(); - } - - public static final class ActivateCommandForFeatureBuilder { - - private ActivateCommandForFeatureBuilder() {} - - public ActivateCommandForFeatureParams build() { - return new ActivateCommandForFeatureParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/feature/params/ArchiveCommandForFeatureParams.java b/src/main/java/com/chargebee/v4/models/feature/params/ArchiveCommandForFeatureParams.java deleted file mode 100644 index 79a4fb03..00000000 --- a/src/main/java/com/chargebee/v4/models/feature/params/ArchiveCommandForFeatureParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.feature.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ArchiveCommandForFeatureParams { - - private ArchiveCommandForFeatureParams(ArchiveCommandForFeatureBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for ArchiveCommandForFeatureParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ArchiveCommandForFeatureBuilder builder() { - return new ArchiveCommandForFeatureBuilder(); - } - - public static final class ArchiveCommandForFeatureBuilder { - - private ArchiveCommandForFeatureBuilder() {} - - public ArchiveCommandForFeatureParams build() { - return new ArchiveCommandForFeatureParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/feature/params/DeleteFeatureParams.java b/src/main/java/com/chargebee/v4/models/feature/params/DeleteFeatureParams.java deleted file mode 100644 index d33231ec..00000000 --- a/src/main/java/com/chargebee/v4/models/feature/params/DeleteFeatureParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.feature.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteFeatureParams { - - private DeleteFeatureParams(DeleteFeatureBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteFeatureParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteFeatureBuilder builder() { - return new DeleteFeatureBuilder(); - } - - public static final class DeleteFeatureBuilder { - - private DeleteFeatureBuilder() {} - - public DeleteFeatureParams build() { - return new DeleteFeatureParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/feature/params/FeatureActivateParams.java b/src/main/java/com/chargebee/v4/models/feature/params/FeatureActivateParams.java new file mode 100644 index 00000000..f99288ff --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/feature/params/FeatureActivateParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.feature.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class FeatureActivateParams { + + private FeatureActivateParams(FeatureActivateBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for FeatureActivateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static FeatureActivateBuilder builder() { + return new FeatureActivateBuilder(); + } + + public static final class FeatureActivateBuilder { + + private FeatureActivateBuilder() {} + + public FeatureActivateParams build() { + return new FeatureActivateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/feature/params/FeatureArchiveParams.java b/src/main/java/com/chargebee/v4/models/feature/params/FeatureArchiveParams.java new file mode 100644 index 00000000..0cff933d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/feature/params/FeatureArchiveParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.feature.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class FeatureArchiveParams { + + private FeatureArchiveParams(FeatureArchiveBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for FeatureArchiveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static FeatureArchiveBuilder builder() { + return new FeatureArchiveBuilder(); + } + + public static final class FeatureArchiveBuilder { + + private FeatureArchiveBuilder() {} + + public FeatureArchiveParams build() { + return new FeatureArchiveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/feature/params/FeatureDeleteParams.java b/src/main/java/com/chargebee/v4/models/feature/params/FeatureDeleteParams.java new file mode 100644 index 00000000..3178152d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/feature/params/FeatureDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.feature.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class FeatureDeleteParams { + + private FeatureDeleteParams(FeatureDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for FeatureDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static FeatureDeleteBuilder builder() { + return new FeatureDeleteBuilder(); + } + + public static final class FeatureDeleteBuilder { + + private FeatureDeleteBuilder() {} + + public FeatureDeleteParams build() { + return new FeatureDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/feature/params/FeatureReactivateParams.java b/src/main/java/com/chargebee/v4/models/feature/params/FeatureReactivateParams.java new file mode 100644 index 00000000..4df5a476 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/feature/params/FeatureReactivateParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.feature.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class FeatureReactivateParams { + + private FeatureReactivateParams(FeatureReactivateBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for FeatureReactivateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static FeatureReactivateBuilder builder() { + return new FeatureReactivateBuilder(); + } + + public static final class FeatureReactivateBuilder { + + private FeatureReactivateBuilder() {} + + public FeatureReactivateParams build() { + return new FeatureReactivateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/feature/params/ReactivateCommandForFeatureParams.java b/src/main/java/com/chargebee/v4/models/feature/params/ReactivateCommandForFeatureParams.java deleted file mode 100644 index b505e69a..00000000 --- a/src/main/java/com/chargebee/v4/models/feature/params/ReactivateCommandForFeatureParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.feature.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ReactivateCommandForFeatureParams { - - private ReactivateCommandForFeatureParams(ReactivateCommandForFeatureBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for ReactivateCommandForFeatureParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ReactivateCommandForFeatureBuilder builder() { - return new ReactivateCommandForFeatureBuilder(); - } - - public static final class ReactivateCommandForFeatureBuilder { - - private ReactivateCommandForFeatureBuilder() {} - - public ReactivateCommandForFeatureParams build() { - return new ReactivateCommandForFeatureParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/feature/responses/ActivateCommandForFeatureResponse.java b/src/main/java/com/chargebee/v4/models/feature/responses/ActivateCommandForFeatureResponse.java deleted file mode 100644 index 475a6561..00000000 --- a/src/main/java/com/chargebee/v4/models/feature/responses/ActivateCommandForFeatureResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.feature.responses; - -import com.chargebee.v4.models.feature.Feature; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ActivateCommandForFeature operation. Contains the response data - * from the API. - */ -public final class ActivateCommandForFeatureResponse extends BaseResponse { - private final Feature feature; - - private ActivateCommandForFeatureResponse(Builder builder) { - super(builder.httpResponse); - - this.feature = builder.feature; - } - - /** Parse JSON response into ActivateCommandForFeatureResponse object. */ - public static ActivateCommandForFeatureResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ActivateCommandForFeatureResponse object with HTTP response. */ - public static ActivateCommandForFeatureResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __featureJson = JsonUtil.getObject(json, "feature"); - if (__featureJson != null) { - builder.feature(Feature.fromJson(__featureJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ActivateCommandForFeatureResponse from JSON", e); - } - } - - /** Create a new builder for ActivateCommandForFeatureResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ActivateCommandForFeatureResponse. */ - public static class Builder { - - private Feature feature; - - private Response httpResponse; - - private Builder() {} - - public Builder feature(Feature feature) { - this.feature = feature; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ActivateCommandForFeatureResponse build() { - return new ActivateCommandForFeatureResponse(this); - } - } - - /** Get the feature from the response. */ - public Feature getFeature() { - return feature; - } -} diff --git a/src/main/java/com/chargebee/v4/models/feature/responses/ArchiveCommandForFeatureResponse.java b/src/main/java/com/chargebee/v4/models/feature/responses/ArchiveCommandForFeatureResponse.java deleted file mode 100644 index dcc6d72e..00000000 --- a/src/main/java/com/chargebee/v4/models/feature/responses/ArchiveCommandForFeatureResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.feature.responses; - -import com.chargebee.v4.models.feature.Feature; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ArchiveCommandForFeature operation. Contains the response data from - * the API. - */ -public final class ArchiveCommandForFeatureResponse extends BaseResponse { - private final Feature feature; - - private ArchiveCommandForFeatureResponse(Builder builder) { - super(builder.httpResponse); - - this.feature = builder.feature; - } - - /** Parse JSON response into ArchiveCommandForFeatureResponse object. */ - public static ArchiveCommandForFeatureResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ArchiveCommandForFeatureResponse object with HTTP response. */ - public static ArchiveCommandForFeatureResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __featureJson = JsonUtil.getObject(json, "feature"); - if (__featureJson != null) { - builder.feature(Feature.fromJson(__featureJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ArchiveCommandForFeatureResponse from JSON", e); - } - } - - /** Create a new builder for ArchiveCommandForFeatureResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ArchiveCommandForFeatureResponse. */ - public static class Builder { - - private Feature feature; - - private Response httpResponse; - - private Builder() {} - - public Builder feature(Feature feature) { - this.feature = feature; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ArchiveCommandForFeatureResponse build() { - return new ArchiveCommandForFeatureResponse(this); - } - } - - /** Get the feature from the response. */ - public Feature getFeature() { - return feature; - } -} diff --git a/src/main/java/com/chargebee/v4/models/feature/responses/DeleteFeatureResponse.java b/src/main/java/com/chargebee/v4/models/feature/responses/DeleteFeatureResponse.java deleted file mode 100644 index 466d30d9..00000000 --- a/src/main/java/com/chargebee/v4/models/feature/responses/DeleteFeatureResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.feature.responses; - -import com.chargebee.v4.models.feature.Feature; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteFeature operation. Contains the response data from the API. - */ -public final class DeleteFeatureResponse extends BaseResponse { - private final Feature feature; - - private DeleteFeatureResponse(Builder builder) { - super(builder.httpResponse); - - this.feature = builder.feature; - } - - /** Parse JSON response into DeleteFeatureResponse object. */ - public static DeleteFeatureResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteFeatureResponse object with HTTP response. */ - public static DeleteFeatureResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __featureJson = JsonUtil.getObject(json, "feature"); - if (__featureJson != null) { - builder.feature(Feature.fromJson(__featureJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteFeatureResponse from JSON", e); - } - } - - /** Create a new builder for DeleteFeatureResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteFeatureResponse. */ - public static class Builder { - - private Feature feature; - - private Response httpResponse; - - private Builder() {} - - public Builder feature(Feature feature) { - this.feature = feature; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteFeatureResponse build() { - return new DeleteFeatureResponse(this); - } - } - - /** Get the feature from the response. */ - public Feature getFeature() { - return feature; - } -} diff --git a/src/main/java/com/chargebee/v4/models/feature/responses/FeatureActivateResponse.java b/src/main/java/com/chargebee/v4/models/feature/responses/FeatureActivateResponse.java new file mode 100644 index 00000000..67b4455a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/feature/responses/FeatureActivateResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.feature.responses; + +import com.chargebee.v4.models.feature.Feature; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for FeatureActivate operation. Contains the response data from the API. + */ +public final class FeatureActivateResponse extends BaseResponse { + private final Feature feature; + + private FeatureActivateResponse(Builder builder) { + super(builder.httpResponse); + + this.feature = builder.feature; + } + + /** Parse JSON response into FeatureActivateResponse object. */ + public static FeatureActivateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into FeatureActivateResponse object with HTTP response. */ + public static FeatureActivateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __featureJson = JsonUtil.getObject(json, "feature"); + if (__featureJson != null) { + builder.feature(Feature.fromJson(__featureJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse FeatureActivateResponse from JSON", e); + } + } + + /** Create a new builder for FeatureActivateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for FeatureActivateResponse. */ + public static class Builder { + + private Feature feature; + + private Response httpResponse; + + private Builder() {} + + public Builder feature(Feature feature) { + this.feature = feature; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public FeatureActivateResponse build() { + return new FeatureActivateResponse(this); + } + } + + /** Get the feature from the response. */ + public Feature getFeature() { + return feature; + } +} diff --git a/src/main/java/com/chargebee/v4/models/feature/responses/FeatureArchiveResponse.java b/src/main/java/com/chargebee/v4/models/feature/responses/FeatureArchiveResponse.java new file mode 100644 index 00000000..6b6e660b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/feature/responses/FeatureArchiveResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.feature.responses; + +import com.chargebee.v4.models.feature.Feature; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for FeatureArchive operation. Contains the response data from the API. + */ +public final class FeatureArchiveResponse extends BaseResponse { + private final Feature feature; + + private FeatureArchiveResponse(Builder builder) { + super(builder.httpResponse); + + this.feature = builder.feature; + } + + /** Parse JSON response into FeatureArchiveResponse object. */ + public static FeatureArchiveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into FeatureArchiveResponse object with HTTP response. */ + public static FeatureArchiveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __featureJson = JsonUtil.getObject(json, "feature"); + if (__featureJson != null) { + builder.feature(Feature.fromJson(__featureJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse FeatureArchiveResponse from JSON", e); + } + } + + /** Create a new builder for FeatureArchiveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for FeatureArchiveResponse. */ + public static class Builder { + + private Feature feature; + + private Response httpResponse; + + private Builder() {} + + public Builder feature(Feature feature) { + this.feature = feature; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public FeatureArchiveResponse build() { + return new FeatureArchiveResponse(this); + } + } + + /** Get the feature from the response. */ + public Feature getFeature() { + return feature; + } +} diff --git a/src/main/java/com/chargebee/v4/models/feature/responses/FeatureDeleteResponse.java b/src/main/java/com/chargebee/v4/models/feature/responses/FeatureDeleteResponse.java new file mode 100644 index 00000000..fd291c94 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/feature/responses/FeatureDeleteResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.feature.responses; + +import com.chargebee.v4.models.feature.Feature; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for FeatureDelete operation. Contains the response data from the API. + */ +public final class FeatureDeleteResponse extends BaseResponse { + private final Feature feature; + + private FeatureDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.feature = builder.feature; + } + + /** Parse JSON response into FeatureDeleteResponse object. */ + public static FeatureDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into FeatureDeleteResponse object with HTTP response. */ + public static FeatureDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __featureJson = JsonUtil.getObject(json, "feature"); + if (__featureJson != null) { + builder.feature(Feature.fromJson(__featureJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse FeatureDeleteResponse from JSON", e); + } + } + + /** Create a new builder for FeatureDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for FeatureDeleteResponse. */ + public static class Builder { + + private Feature feature; + + private Response httpResponse; + + private Builder() {} + + public Builder feature(Feature feature) { + this.feature = feature; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public FeatureDeleteResponse build() { + return new FeatureDeleteResponse(this); + } + } + + /** Get the feature from the response. */ + public Feature getFeature() { + return feature; + } +} diff --git a/src/main/java/com/chargebee/v4/models/feature/responses/FeatureListResponse.java b/src/main/java/com/chargebee/v4/models/feature/responses/FeatureListResponse.java index a6249d29..0b93136a 100644 --- a/src/main/java/com/chargebee/v4/models/feature/responses/FeatureListResponse.java +++ b/src/main/java/com/chargebee/v4/models/feature/responses/FeatureListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.feature.Feature; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.FeatureService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public FeatureListResponse nextPage() throws Exception { + public FeatureListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/feature/responses/FeatureReactivateResponse.java b/src/main/java/com/chargebee/v4/models/feature/responses/FeatureReactivateResponse.java new file mode 100644 index 00000000..b3599ad9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/feature/responses/FeatureReactivateResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.feature.responses; + +import com.chargebee.v4.models.feature.Feature; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for FeatureReactivate operation. Contains the response data from the + * API. + */ +public final class FeatureReactivateResponse extends BaseResponse { + private final Feature feature; + + private FeatureReactivateResponse(Builder builder) { + super(builder.httpResponse); + + this.feature = builder.feature; + } + + /** Parse JSON response into FeatureReactivateResponse object. */ + public static FeatureReactivateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into FeatureReactivateResponse object with HTTP response. */ + public static FeatureReactivateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __featureJson = JsonUtil.getObject(json, "feature"); + if (__featureJson != null) { + builder.feature(Feature.fromJson(__featureJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse FeatureReactivateResponse from JSON", e); + } + } + + /** Create a new builder for FeatureReactivateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for FeatureReactivateResponse. */ + public static class Builder { + + private Feature feature; + + private Response httpResponse; + + private Builder() {} + + public Builder feature(Feature feature) { + this.feature = feature; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public FeatureReactivateResponse build() { + return new FeatureReactivateResponse(this); + } + } + + /** Get the feature from the response. */ + public Feature getFeature() { + return feature; + } +} diff --git a/src/main/java/com/chargebee/v4/models/feature/responses/ReactivateCommandForFeatureResponse.java b/src/main/java/com/chargebee/v4/models/feature/responses/ReactivateCommandForFeatureResponse.java deleted file mode 100644 index 8f57f989..00000000 --- a/src/main/java/com/chargebee/v4/models/feature/responses/ReactivateCommandForFeatureResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.feature.responses; - -import com.chargebee.v4.models.feature.Feature; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ReactivateCommandForFeature operation. Contains the response data - * from the API. - */ -public final class ReactivateCommandForFeatureResponse extends BaseResponse { - private final Feature feature; - - private ReactivateCommandForFeatureResponse(Builder builder) { - super(builder.httpResponse); - - this.feature = builder.feature; - } - - /** Parse JSON response into ReactivateCommandForFeatureResponse object. */ - public static ReactivateCommandForFeatureResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ReactivateCommandForFeatureResponse object with HTTP response. */ - public static ReactivateCommandForFeatureResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __featureJson = JsonUtil.getObject(json, "feature"); - if (__featureJson != null) { - builder.feature(Feature.fromJson(__featureJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ReactivateCommandForFeatureResponse from JSON", e); - } - } - - /** Create a new builder for ReactivateCommandForFeatureResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ReactivateCommandForFeatureResponse. */ - public static class Builder { - - private Feature feature; - - private Response httpResponse; - - private Builder() {} - - public Builder feature(Feature feature) { - this.feature = feature; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ReactivateCommandForFeatureResponse build() { - return new ReactivateCommandForFeatureResponse(this); - } - } - - /** Get the feature from the response. */ - public Feature getFeature() { - return feature; - } -} diff --git a/src/main/java/com/chargebee/v4/models/gift/params/CancelForGiftParams.java b/src/main/java/com/chargebee/v4/models/gift/params/CancelForGiftParams.java deleted file mode 100644 index 685afcfd..00000000 --- a/src/main/java/com/chargebee/v4/models/gift/params/CancelForGiftParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.gift.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class CancelForGiftParams { - - private CancelForGiftParams(CancelForGiftBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for CancelForGiftParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CancelForGiftBuilder builder() { - return new CancelForGiftBuilder(); - } - - public static final class CancelForGiftBuilder { - - private CancelForGiftBuilder() {} - - public CancelForGiftParams build() { - return new CancelForGiftParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/gift/params/ClaimForGiftParams.java b/src/main/java/com/chargebee/v4/models/gift/params/ClaimForGiftParams.java deleted file mode 100644 index 1f3c491f..00000000 --- a/src/main/java/com/chargebee/v4/models/gift/params/ClaimForGiftParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.gift.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ClaimForGiftParams { - - private ClaimForGiftParams(ClaimForGiftBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for ClaimForGiftParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ClaimForGiftBuilder builder() { - return new ClaimForGiftBuilder(); - } - - public static final class ClaimForGiftBuilder { - - private ClaimForGiftBuilder() {} - - public ClaimForGiftParams build() { - return new ClaimForGiftParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/gift/params/GiftCancelParams.java b/src/main/java/com/chargebee/v4/models/gift/params/GiftCancelParams.java new file mode 100644 index 00000000..07894bde --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/gift/params/GiftCancelParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.gift.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class GiftCancelParams { + + private GiftCancelParams(GiftCancelBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for GiftCancelParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static GiftCancelBuilder builder() { + return new GiftCancelBuilder(); + } + + public static final class GiftCancelBuilder { + + private GiftCancelBuilder() {} + + public GiftCancelParams build() { + return new GiftCancelParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/gift/params/GiftClaimParams.java b/src/main/java/com/chargebee/v4/models/gift/params/GiftClaimParams.java new file mode 100644 index 00000000..40be4041 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/gift/params/GiftClaimParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.gift.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class GiftClaimParams { + + private GiftClaimParams(GiftClaimBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for GiftClaimParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static GiftClaimBuilder builder() { + return new GiftClaimBuilder(); + } + + public static final class GiftClaimBuilder { + + private GiftClaimBuilder() {} + + public GiftClaimParams build() { + return new GiftClaimParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/gift/params/UpdateGiftForGiftParams.java b/src/main/java/com/chargebee/v4/models/gift/params/UpdateGiftForGiftParams.java deleted file mode 100644 index 4c366c68..00000000 --- a/src/main/java/com/chargebee/v4/models/gift/params/UpdateGiftForGiftParams.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.gift.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class UpdateGiftForGiftParams { - - private final Timestamp scheduledAt; - - private final String comment; - - private UpdateGiftForGiftParams(UpdateGiftForGiftBuilder builder) { - - this.scheduledAt = builder.scheduledAt; - - this.comment = builder.comment; - } - - public Timestamp getScheduledAt() { - return scheduledAt; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.scheduledAt != null) { - - formData.put("scheduled_at", this.scheduledAt); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for UpdateGiftForGiftParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateGiftForGiftBuilder builder() { - return new UpdateGiftForGiftBuilder(); - } - - public static final class UpdateGiftForGiftBuilder { - - private Timestamp scheduledAt; - - private String comment; - - private UpdateGiftForGiftBuilder() {} - - public UpdateGiftForGiftBuilder scheduledAt(Timestamp value) { - this.scheduledAt = value; - return this; - } - - public UpdateGiftForGiftBuilder comment(String value) { - this.comment = value; - return this; - } - - public UpdateGiftForGiftParams build() { - return new UpdateGiftForGiftParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/gift/params/UpdateGiftParams.java b/src/main/java/com/chargebee/v4/models/gift/params/UpdateGiftParams.java new file mode 100644 index 00000000..93715faf --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/gift/params/UpdateGiftParams.java @@ -0,0 +1,81 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.gift.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class UpdateGiftParams { + + private final Timestamp scheduledAt; + + private final String comment; + + private UpdateGiftParams(UpdateGiftBuilder builder) { + + this.scheduledAt = builder.scheduledAt; + + this.comment = builder.comment; + } + + public Timestamp getScheduledAt() { + return scheduledAt; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.scheduledAt != null) { + + formData.put("scheduled_at", this.scheduledAt); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for UpdateGiftParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UpdateGiftBuilder builder() { + return new UpdateGiftBuilder(); + } + + public static final class UpdateGiftBuilder { + + private Timestamp scheduledAt; + + private String comment; + + private UpdateGiftBuilder() {} + + public UpdateGiftBuilder scheduledAt(Timestamp value) { + this.scheduledAt = value; + return this; + } + + public UpdateGiftBuilder comment(String value) { + this.comment = value; + return this; + } + + public UpdateGiftParams build() { + return new UpdateGiftParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/gift/responses/CancelForGiftResponse.java b/src/main/java/com/chargebee/v4/models/gift/responses/CancelForGiftResponse.java deleted file mode 100644 index 1d35863c..00000000 --- a/src/main/java/com/chargebee/v4/models/gift/responses/CancelForGiftResponse.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.chargebee.v4.models.gift.responses; - -import com.chargebee.v4.models.gift.Gift; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CancelForGift operation. Contains the response data from the API. - */ -public final class CancelForGiftResponse extends BaseResponse { - private final Gift gift; - - private final Subscription subscription; - - private CancelForGiftResponse(Builder builder) { - super(builder.httpResponse); - - this.gift = builder.gift; - - this.subscription = builder.subscription; - } - - /** Parse JSON response into CancelForGiftResponse object. */ - public static CancelForGiftResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into CancelForGiftResponse object with HTTP response. */ - public static CancelForGiftResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __giftJson = JsonUtil.getObject(json, "gift"); - if (__giftJson != null) { - builder.gift(Gift.fromJson(__giftJson)); - } - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse CancelForGiftResponse from JSON", e); - } - } - - /** Create a new builder for CancelForGiftResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CancelForGiftResponse. */ - public static class Builder { - - private Gift gift; - - private Subscription subscription; - - private Response httpResponse; - - private Builder() {} - - public Builder gift(Gift gift) { - this.gift = gift; - return this; - } - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CancelForGiftResponse build() { - return new CancelForGiftResponse(this); - } - } - - /** Get the gift from the response. */ - public Gift getGift() { - return gift; - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } -} diff --git a/src/main/java/com/chargebee/v4/models/gift/responses/ClaimForGiftResponse.java b/src/main/java/com/chargebee/v4/models/gift/responses/ClaimForGiftResponse.java deleted file mode 100644 index c7403a97..00000000 --- a/src/main/java/com/chargebee/v4/models/gift/responses/ClaimForGiftResponse.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.chargebee.v4.models.gift.responses; - -import com.chargebee.v4.models.gift.Gift; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ClaimForGift operation. Contains the response data from the API. - */ -public final class ClaimForGiftResponse extends BaseResponse { - private final Gift gift; - - private final Subscription subscription; - - private ClaimForGiftResponse(Builder builder) { - super(builder.httpResponse); - - this.gift = builder.gift; - - this.subscription = builder.subscription; - } - - /** Parse JSON response into ClaimForGiftResponse object. */ - public static ClaimForGiftResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ClaimForGiftResponse object with HTTP response. */ - public static ClaimForGiftResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __giftJson = JsonUtil.getObject(json, "gift"); - if (__giftJson != null) { - builder.gift(Gift.fromJson(__giftJson)); - } - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ClaimForGiftResponse from JSON", e); - } - } - - /** Create a new builder for ClaimForGiftResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ClaimForGiftResponse. */ - public static class Builder { - - private Gift gift; - - private Subscription subscription; - - private Response httpResponse; - - private Builder() {} - - public Builder gift(Gift gift) { - this.gift = gift; - return this; - } - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ClaimForGiftResponse build() { - return new ClaimForGiftResponse(this); - } - } - - /** Get the gift from the response. */ - public Gift getGift() { - return gift; - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } -} diff --git a/src/main/java/com/chargebee/v4/models/gift/responses/GiftCancelResponse.java b/src/main/java/com/chargebee/v4/models/gift/responses/GiftCancelResponse.java new file mode 100644 index 00000000..da96e8f0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/gift/responses/GiftCancelResponse.java @@ -0,0 +1,97 @@ +package com.chargebee.v4.models.gift.responses; + +import com.chargebee.v4.models.gift.Gift; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for GiftCancel operation. Contains the response data from the API. */ +public final class GiftCancelResponse extends BaseResponse { + private final Gift gift; + + private final Subscription subscription; + + private GiftCancelResponse(Builder builder) { + super(builder.httpResponse); + + this.gift = builder.gift; + + this.subscription = builder.subscription; + } + + /** Parse JSON response into GiftCancelResponse object. */ + public static GiftCancelResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into GiftCancelResponse object with HTTP response. */ + public static GiftCancelResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __giftJson = JsonUtil.getObject(json, "gift"); + if (__giftJson != null) { + builder.gift(Gift.fromJson(__giftJson)); + } + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse GiftCancelResponse from JSON", e); + } + } + + /** Create a new builder for GiftCancelResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for GiftCancelResponse. */ + public static class Builder { + + private Gift gift; + + private Subscription subscription; + + private Response httpResponse; + + private Builder() {} + + public Builder gift(Gift gift) { + this.gift = gift; + return this; + } + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public GiftCancelResponse build() { + return new GiftCancelResponse(this); + } + } + + /** Get the gift from the response. */ + public Gift getGift() { + return gift; + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } +} diff --git a/src/main/java/com/chargebee/v4/models/gift/responses/GiftClaimResponse.java b/src/main/java/com/chargebee/v4/models/gift/responses/GiftClaimResponse.java new file mode 100644 index 00000000..9d48cbeb --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/gift/responses/GiftClaimResponse.java @@ -0,0 +1,97 @@ +package com.chargebee.v4.models.gift.responses; + +import com.chargebee.v4.models.gift.Gift; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for GiftClaim operation. Contains the response data from the API. */ +public final class GiftClaimResponse extends BaseResponse { + private final Gift gift; + + private final Subscription subscription; + + private GiftClaimResponse(Builder builder) { + super(builder.httpResponse); + + this.gift = builder.gift; + + this.subscription = builder.subscription; + } + + /** Parse JSON response into GiftClaimResponse object. */ + public static GiftClaimResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into GiftClaimResponse object with HTTP response. */ + public static GiftClaimResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __giftJson = JsonUtil.getObject(json, "gift"); + if (__giftJson != null) { + builder.gift(Gift.fromJson(__giftJson)); + } + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse GiftClaimResponse from JSON", e); + } + } + + /** Create a new builder for GiftClaimResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for GiftClaimResponse. */ + public static class Builder { + + private Gift gift; + + private Subscription subscription; + + private Response httpResponse; + + private Builder() {} + + public Builder gift(Gift gift) { + this.gift = gift; + return this; + } + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public GiftClaimResponse build() { + return new GiftClaimResponse(this); + } + } + + /** Get the gift from the response. */ + public Gift getGift() { + return gift; + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } +} diff --git a/src/main/java/com/chargebee/v4/models/gift/responses/GiftListResponse.java b/src/main/java/com/chargebee/v4/models/gift/responses/GiftListResponse.java index 539512bc..c02e7b61 100644 --- a/src/main/java/com/chargebee/v4/models/gift/responses/GiftListResponse.java +++ b/src/main/java/com/chargebee/v4/models/gift/responses/GiftListResponse.java @@ -6,6 +6,7 @@ import com.chargebee.v4.models.subscription.Subscription; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.GiftService; @@ -97,9 +98,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public GiftListResponse nextPage() throws Exception { + public GiftListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/gift/responses/UpdateGiftForGiftResponse.java b/src/main/java/com/chargebee/v4/models/gift/responses/UpdateGiftForGiftResponse.java deleted file mode 100644 index f10cfe6e..00000000 --- a/src/main/java/com/chargebee/v4/models/gift/responses/UpdateGiftForGiftResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.gift.responses; - -import com.chargebee.v4.models.gift.Gift; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateGiftForGift operation. Contains the response data from the - * API. - */ -public final class UpdateGiftForGiftResponse extends BaseResponse { - private final Gift gift; - - private final Subscription subscription; - - private UpdateGiftForGiftResponse(Builder builder) { - super(builder.httpResponse); - - this.gift = builder.gift; - - this.subscription = builder.subscription; - } - - /** Parse JSON response into UpdateGiftForGiftResponse object. */ - public static UpdateGiftForGiftResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdateGiftForGiftResponse object with HTTP response. */ - public static UpdateGiftForGiftResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __giftJson = JsonUtil.getObject(json, "gift"); - if (__giftJson != null) { - builder.gift(Gift.fromJson(__giftJson)); - } - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UpdateGiftForGiftResponse from JSON", e); - } - } - - /** Create a new builder for UpdateGiftForGiftResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateGiftForGiftResponse. */ - public static class Builder { - - private Gift gift; - - private Subscription subscription; - - private Response httpResponse; - - private Builder() {} - - public Builder gift(Gift gift) { - this.gift = gift; - return this; - } - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateGiftForGiftResponse build() { - return new UpdateGiftForGiftResponse(this); - } - } - - /** Get the gift from the response. */ - public Gift getGift() { - return gift; - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } -} diff --git a/src/main/java/com/chargebee/v4/models/gift/responses/UpdateGiftResponse.java b/src/main/java/com/chargebee/v4/models/gift/responses/UpdateGiftResponse.java new file mode 100644 index 00000000..b9e5b92e --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/gift/responses/UpdateGiftResponse.java @@ -0,0 +1,97 @@ +package com.chargebee.v4.models.gift.responses; + +import com.chargebee.v4.models.gift.Gift; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for UpdateGift operation. Contains the response data from the API. */ +public final class UpdateGiftResponse extends BaseResponse { + private final Gift gift; + + private final Subscription subscription; + + private UpdateGiftResponse(Builder builder) { + super(builder.httpResponse); + + this.gift = builder.gift; + + this.subscription = builder.subscription; + } + + /** Parse JSON response into UpdateGiftResponse object. */ + public static UpdateGiftResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into UpdateGiftResponse object with HTTP response. */ + public static UpdateGiftResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __giftJson = JsonUtil.getObject(json, "gift"); + if (__giftJson != null) { + builder.gift(Gift.fromJson(__giftJson)); + } + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse UpdateGiftResponse from JSON", e); + } + } + + /** Create a new builder for UpdateGiftResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for UpdateGiftResponse. */ + public static class Builder { + + private Gift gift; + + private Subscription subscription; + + private Response httpResponse; + + private Builder() {} + + public Builder gift(Gift gift) { + this.gift = gift; + return this; + } + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public UpdateGiftResponse build() { + return new UpdateGiftResponse(this); + } + } + + /** Get the gift from the response. */ + public Gift getGift() { + return gift; + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } +} diff --git a/src/main/java/com/chargebee/v4/models/hostedPage/params/AcknowledgeForHostedPageParams.java b/src/main/java/com/chargebee/v4/models/hostedPage/params/AcknowledgeForHostedPageParams.java deleted file mode 100644 index 2c0a0895..00000000 --- a/src/main/java/com/chargebee/v4/models/hostedPage/params/AcknowledgeForHostedPageParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.hostedPage.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AcknowledgeForHostedPageParams { - - private AcknowledgeForHostedPageParams(AcknowledgeForHostedPageBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for AcknowledgeForHostedPageParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AcknowledgeForHostedPageBuilder builder() { - return new AcknowledgeForHostedPageBuilder(); - } - - public static final class AcknowledgeForHostedPageBuilder { - - private AcknowledgeForHostedPageBuilder() {} - - public AcknowledgeForHostedPageParams build() { - return new AcknowledgeForHostedPageParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/hostedPage/params/HostedPageAcknowledgeParams.java b/src/main/java/com/chargebee/v4/models/hostedPage/params/HostedPageAcknowledgeParams.java new file mode 100644 index 00000000..f665d1f4 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/hostedPage/params/HostedPageAcknowledgeParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.hostedPage.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class HostedPageAcknowledgeParams { + + private HostedPageAcknowledgeParams(HostedPageAcknowledgeBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for HostedPageAcknowledgeParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static HostedPageAcknowledgeBuilder builder() { + return new HostedPageAcknowledgeBuilder(); + } + + public static final class HostedPageAcknowledgeBuilder { + + private HostedPageAcknowledgeBuilder() {} + + public HostedPageAcknowledgeParams build() { + return new HostedPageAcknowledgeParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/hostedPage/responses/AcknowledgeForHostedPageResponse.java b/src/main/java/com/chargebee/v4/models/hostedPage/responses/AcknowledgeForHostedPageResponse.java deleted file mode 100644 index dff008df..00000000 --- a/src/main/java/com/chargebee/v4/models/hostedPage/responses/AcknowledgeForHostedPageResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.hostedPage.responses; - -import com.chargebee.v4.models.hostedPage.HostedPage; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AcknowledgeForHostedPage operation. Contains the response data from - * the API. - */ -public final class AcknowledgeForHostedPageResponse extends BaseResponse { - private final HostedPage hostedPage; - - private AcknowledgeForHostedPageResponse(Builder builder) { - super(builder.httpResponse); - - this.hostedPage = builder.hostedPage; - } - - /** Parse JSON response into AcknowledgeForHostedPageResponse object. */ - public static AcknowledgeForHostedPageResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AcknowledgeForHostedPageResponse object with HTTP response. */ - public static AcknowledgeForHostedPageResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __hostedPageJson = JsonUtil.getObject(json, "hosted_page"); - if (__hostedPageJson != null) { - builder.hostedPage(HostedPage.fromJson(__hostedPageJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AcknowledgeForHostedPageResponse from JSON", e); - } - } - - /** Create a new builder for AcknowledgeForHostedPageResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AcknowledgeForHostedPageResponse. */ - public static class Builder { - - private HostedPage hostedPage; - - private Response httpResponse; - - private Builder() {} - - public Builder hostedPage(HostedPage hostedPage) { - this.hostedPage = hostedPage; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AcknowledgeForHostedPageResponse build() { - return new AcknowledgeForHostedPageResponse(this); - } - } - - /** Get the hostedPage from the response. */ - public HostedPage getHostedPage() { - return hostedPage; - } -} diff --git a/src/main/java/com/chargebee/v4/models/hostedPage/responses/HostedPageAcknowledgeResponse.java b/src/main/java/com/chargebee/v4/models/hostedPage/responses/HostedPageAcknowledgeResponse.java new file mode 100644 index 00000000..9da68a40 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/hostedPage/responses/HostedPageAcknowledgeResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.hostedPage.responses; + +import com.chargebee.v4.models.hostedPage.HostedPage; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for HostedPageAcknowledge operation. Contains the response data from + * the API. + */ +public final class HostedPageAcknowledgeResponse extends BaseResponse { + private final HostedPage hostedPage; + + private HostedPageAcknowledgeResponse(Builder builder) { + super(builder.httpResponse); + + this.hostedPage = builder.hostedPage; + } + + /** Parse JSON response into HostedPageAcknowledgeResponse object. */ + public static HostedPageAcknowledgeResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into HostedPageAcknowledgeResponse object with HTTP response. */ + public static HostedPageAcknowledgeResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __hostedPageJson = JsonUtil.getObject(json, "hosted_page"); + if (__hostedPageJson != null) { + builder.hostedPage(HostedPage.fromJson(__hostedPageJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse HostedPageAcknowledgeResponse from JSON", e); + } + } + + /** Create a new builder for HostedPageAcknowledgeResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for HostedPageAcknowledgeResponse. */ + public static class Builder { + + private HostedPage hostedPage; + + private Response httpResponse; + + private Builder() {} + + public Builder hostedPage(HostedPage hostedPage) { + this.hostedPage = hostedPage; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public HostedPageAcknowledgeResponse build() { + return new HostedPageAcknowledgeResponse(this); + } + } + + /** Get the hostedPage from the response. */ + public HostedPage getHostedPage() { + return hostedPage; + } +} diff --git a/src/main/java/com/chargebee/v4/models/hostedPage/responses/HostedPageListResponse.java b/src/main/java/com/chargebee/v4/models/hostedPage/responses/HostedPageListResponse.java index a526114a..d2410fd3 100644 --- a/src/main/java/com/chargebee/v4/models/hostedPage/responses/HostedPageListResponse.java +++ b/src/main/java/com/chargebee/v4/models/hostedPage/responses/HostedPageListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.hostedPage.HostedPage; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.HostedPageService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public HostedPageListResponse nextPage() throws Exception { + public HostedPageListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/ImportReceiptForInAppSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/ImportReceiptForInAppSubscriptionParams.java deleted file mode 100644 index 031d7196..00000000 --- a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/ImportReceiptForInAppSubscriptionParams.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.inAppSubscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ImportReceiptForInAppSubscriptionParams { - - private final String receipt; - - private final ProductParams product; - - private final CustomerParams customer; - - private ImportReceiptForInAppSubscriptionParams( - ImportReceiptForInAppSubscriptionBuilder builder) { - - this.receipt = builder.receipt; - - this.product = builder.product; - - this.customer = builder.customer; - } - - public String getReceipt() { - return receipt; - } - - public ProductParams getProduct() { - return product; - } - - public CustomerParams getCustomer() { - return customer; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.receipt != null) { - - formData.put("receipt", this.receipt); - } - - if (this.product != null) { - - // Single object - Map nestedData = this.product.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "product[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.customer != null) { - - // Single object - Map nestedData = this.customer.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "customer[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for ImportReceiptForInAppSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ImportReceiptForInAppSubscriptionBuilder builder() { - return new ImportReceiptForInAppSubscriptionBuilder(); - } - - public static final class ImportReceiptForInAppSubscriptionBuilder { - - private String receipt; - - private ProductParams product; - - private CustomerParams customer; - - private ImportReceiptForInAppSubscriptionBuilder() {} - - public ImportReceiptForInAppSubscriptionBuilder receipt(String value) { - this.receipt = value; - return this; - } - - public ImportReceiptForInAppSubscriptionBuilder product(ProductParams value) { - this.product = value; - return this; - } - - public ImportReceiptForInAppSubscriptionBuilder customer(CustomerParams value) { - this.customer = value; - return this; - } - - public ImportReceiptForInAppSubscriptionParams build() { - return new ImportReceiptForInAppSubscriptionParams(this); - } - } - - public static final class ProductParams { - - private final String currencyCode; - - private ProductParams(ProductBuilder builder) { - - this.currencyCode = builder.currencyCode; - } - - public String getCurrencyCode() { - return currencyCode; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.currencyCode != null) { - - formData.put("currency_code", this.currencyCode); - } - - return formData; - } - - /** Create a new builder for ProductParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ProductBuilder builder() { - return new ProductBuilder(); - } - - public static final class ProductBuilder { - - private String currencyCode; - - private ProductBuilder() {} - - public ProductBuilder currencyCode(String value) { - this.currencyCode = value; - return this; - } - - public ProductParams build() { - return new ProductParams(this); - } - } - } - - public static final class CustomerParams { - - private final String id; - - private final String email; - - private CustomerParams(CustomerBuilder builder) { - - this.id = builder.id; - - this.email = builder.email; - } - - public String getId() { - return id; - } - - public String getEmail() { - return email; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - return formData; - } - - /** Create a new builder for CustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CustomerBuilder builder() { - return new CustomerBuilder(); - } - - public static final class CustomerBuilder { - - private String id; - - private String email; - - private CustomerBuilder() {} - - public CustomerBuilder id(String value) { - this.id = value; - return this; - } - - public CustomerBuilder email(String value) { - this.email = value; - return this; - } - - public CustomerParams build() { - return new CustomerParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/ImportSubscriptionForInAppSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/ImportSubscriptionForInAppSubscriptionParams.java deleted file mode 100644 index e9d32d38..00000000 --- a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/ImportSubscriptionForInAppSubscriptionParams.java +++ /dev/null @@ -1,348 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.inAppSubscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class ImportSubscriptionForInAppSubscriptionParams { - - private final SubscriptionParams subscription; - - private final CustomerParams customer; - - private ImportSubscriptionForInAppSubscriptionParams( - ImportSubscriptionForInAppSubscriptionBuilder builder) { - - this.subscription = builder.subscription; - - this.customer = builder.customer; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - public CustomerParams getCustomer() { - return customer; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.customer != null) { - - // Single object - Map nestedData = this.customer.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "customer[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for ImportSubscriptionForInAppSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ImportSubscriptionForInAppSubscriptionBuilder builder() { - return new ImportSubscriptionForInAppSubscriptionBuilder(); - } - - public static final class ImportSubscriptionForInAppSubscriptionBuilder { - - private SubscriptionParams subscription; - - private CustomerParams customer; - - private ImportSubscriptionForInAppSubscriptionBuilder() {} - - public ImportSubscriptionForInAppSubscriptionBuilder subscription(SubscriptionParams value) { - this.subscription = value; - return this; - } - - public ImportSubscriptionForInAppSubscriptionBuilder customer(CustomerParams value) { - this.customer = value; - return this; - } - - public ImportSubscriptionForInAppSubscriptionParams build() { - return new ImportSubscriptionForInAppSubscriptionParams(this); - } - } - - public static final class SubscriptionParams { - - private final String id; - - private final Timestamp startedAt; - - private final Timestamp termStart; - - private final Timestamp termEnd; - - private final String productId; - - private final String currencyCode; - - private final String transactionId; - - private final Boolean isTrial; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.id = builder.id; - - this.startedAt = builder.startedAt; - - this.termStart = builder.termStart; - - this.termEnd = builder.termEnd; - - this.productId = builder.productId; - - this.currencyCode = builder.currencyCode; - - this.transactionId = builder.transactionId; - - this.isTrial = builder.isTrial; - } - - public String getId() { - return id; - } - - public Timestamp getStartedAt() { - return startedAt; - } - - public Timestamp getTermStart() { - return termStart; - } - - public Timestamp getTermEnd() { - return termEnd; - } - - public String getProductId() { - return productId; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public String getTransactionId() { - return transactionId; - } - - public Boolean getIsTrial() { - return isTrial; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.startedAt != null) { - - formData.put("started_at", this.startedAt); - } - - if (this.termStart != null) { - - formData.put("term_start", this.termStart); - } - - if (this.termEnd != null) { - - formData.put("term_end", this.termEnd); - } - - if (this.productId != null) { - - formData.put("product_id", this.productId); - } - - if (this.currencyCode != null) { - - formData.put("currency_code", this.currencyCode); - } - - if (this.transactionId != null) { - - formData.put("transaction_id", this.transactionId); - } - - if (this.isTrial != null) { - - formData.put("is_trial", this.isTrial); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private String id; - - private Timestamp startedAt; - - private Timestamp termStart; - - private Timestamp termEnd; - - private String productId; - - private String currencyCode; - - private String transactionId; - - private Boolean isTrial; - - private SubscriptionBuilder() {} - - public SubscriptionBuilder id(String value) { - this.id = value; - return this; - } - - public SubscriptionBuilder startedAt(Timestamp value) { - this.startedAt = value; - return this; - } - - public SubscriptionBuilder termStart(Timestamp value) { - this.termStart = value; - return this; - } - - public SubscriptionBuilder termEnd(Timestamp value) { - this.termEnd = value; - return this; - } - - public SubscriptionBuilder productId(String value) { - this.productId = value; - return this; - } - - public SubscriptionBuilder currencyCode(String value) { - this.currencyCode = value; - return this; - } - - public SubscriptionBuilder transactionId(String value) { - this.transactionId = value; - return this; - } - - public SubscriptionBuilder isTrial(Boolean value) { - this.isTrial = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - } - - public static final class CustomerParams { - - private final String id; - - private final String email; - - private CustomerParams(CustomerBuilder builder) { - - this.id = builder.id; - - this.email = builder.email; - } - - public String getId() { - return id; - } - - public String getEmail() { - return email; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - return formData; - } - - /** Create a new builder for CustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CustomerBuilder builder() { - return new CustomerBuilder(); - } - - public static final class CustomerBuilder { - - private String id; - - private String email; - - private CustomerBuilder() {} - - public CustomerBuilder id(String value) { - this.id = value; - return this; - } - - public CustomerBuilder email(String value) { - this.email = value; - return this; - } - - public CustomerParams build() { - return new CustomerParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionImportReceiptParams.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionImportReceiptParams.java new file mode 100644 index 00000000..f37194ab --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionImportReceiptParams.java @@ -0,0 +1,226 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.inAppSubscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InAppSubscriptionImportReceiptParams { + + private final String receipt; + + private final ProductParams product; + + private final CustomerParams customer; + + private InAppSubscriptionImportReceiptParams(InAppSubscriptionImportReceiptBuilder builder) { + + this.receipt = builder.receipt; + + this.product = builder.product; + + this.customer = builder.customer; + } + + public String getReceipt() { + return receipt; + } + + public ProductParams getProduct() { + return product; + } + + public CustomerParams getCustomer() { + return customer; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.receipt != null) { + + formData.put("receipt", this.receipt); + } + + if (this.product != null) { + + // Single object + Map nestedData = this.product.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "product[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.customer != null) { + + // Single object + Map nestedData = this.customer.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "customer[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InAppSubscriptionImportReceiptParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InAppSubscriptionImportReceiptBuilder builder() { + return new InAppSubscriptionImportReceiptBuilder(); + } + + public static final class InAppSubscriptionImportReceiptBuilder { + + private String receipt; + + private ProductParams product; + + private CustomerParams customer; + + private InAppSubscriptionImportReceiptBuilder() {} + + public InAppSubscriptionImportReceiptBuilder receipt(String value) { + this.receipt = value; + return this; + } + + public InAppSubscriptionImportReceiptBuilder product(ProductParams value) { + this.product = value; + return this; + } + + public InAppSubscriptionImportReceiptBuilder customer(CustomerParams value) { + this.customer = value; + return this; + } + + public InAppSubscriptionImportReceiptParams build() { + return new InAppSubscriptionImportReceiptParams(this); + } + } + + public static final class ProductParams { + + private final String currencyCode; + + private ProductParams(ProductBuilder builder) { + + this.currencyCode = builder.currencyCode; + } + + public String getCurrencyCode() { + return currencyCode; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.currencyCode != null) { + + formData.put("currency_code", this.currencyCode); + } + + return formData; + } + + /** Create a new builder for ProductParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ProductBuilder builder() { + return new ProductBuilder(); + } + + public static final class ProductBuilder { + + private String currencyCode; + + private ProductBuilder() {} + + public ProductBuilder currencyCode(String value) { + this.currencyCode = value; + return this; + } + + public ProductParams build() { + return new ProductParams(this); + } + } + } + + public static final class CustomerParams { + + private final String id; + + private final String email; + + private CustomerParams(CustomerBuilder builder) { + + this.id = builder.id; + + this.email = builder.email; + } + + public String getId() { + return id; + } + + public String getEmail() { + return email; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + return formData; + } + + /** Create a new builder for CustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerBuilder builder() { + return new CustomerBuilder(); + } + + public static final class CustomerBuilder { + + private String id; + + private String email; + + private CustomerBuilder() {} + + public CustomerBuilder id(String value) { + this.id = value; + return this; + } + + public CustomerBuilder email(String value) { + this.email = value; + return this; + } + + public CustomerParams build() { + return new CustomerParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionImportSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionImportSubscriptionParams.java new file mode 100644 index 00000000..ea7659c9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionImportSubscriptionParams.java @@ -0,0 +1,348 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.inAppSubscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class InAppSubscriptionImportSubscriptionParams { + + private final SubscriptionParams subscription; + + private final CustomerParams customer; + + private InAppSubscriptionImportSubscriptionParams( + InAppSubscriptionImportSubscriptionBuilder builder) { + + this.subscription = builder.subscription; + + this.customer = builder.customer; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + public CustomerParams getCustomer() { + return customer; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.customer != null) { + + // Single object + Map nestedData = this.customer.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "customer[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InAppSubscriptionImportSubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InAppSubscriptionImportSubscriptionBuilder builder() { + return new InAppSubscriptionImportSubscriptionBuilder(); + } + + public static final class InAppSubscriptionImportSubscriptionBuilder { + + private SubscriptionParams subscription; + + private CustomerParams customer; + + private InAppSubscriptionImportSubscriptionBuilder() {} + + public InAppSubscriptionImportSubscriptionBuilder subscription(SubscriptionParams value) { + this.subscription = value; + return this; + } + + public InAppSubscriptionImportSubscriptionBuilder customer(CustomerParams value) { + this.customer = value; + return this; + } + + public InAppSubscriptionImportSubscriptionParams build() { + return new InAppSubscriptionImportSubscriptionParams(this); + } + } + + public static final class SubscriptionParams { + + private final String id; + + private final Timestamp startedAt; + + private final Timestamp termStart; + + private final Timestamp termEnd; + + private final String productId; + + private final String currencyCode; + + private final String transactionId; + + private final Boolean isTrial; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.id = builder.id; + + this.startedAt = builder.startedAt; + + this.termStart = builder.termStart; + + this.termEnd = builder.termEnd; + + this.productId = builder.productId; + + this.currencyCode = builder.currencyCode; + + this.transactionId = builder.transactionId; + + this.isTrial = builder.isTrial; + } + + public String getId() { + return id; + } + + public Timestamp getStartedAt() { + return startedAt; + } + + public Timestamp getTermStart() { + return termStart; + } + + public Timestamp getTermEnd() { + return termEnd; + } + + public String getProductId() { + return productId; + } + + public String getCurrencyCode() { + return currencyCode; + } + + public String getTransactionId() { + return transactionId; + } + + public Boolean getIsTrial() { + return isTrial; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.startedAt != null) { + + formData.put("started_at", this.startedAt); + } + + if (this.termStart != null) { + + formData.put("term_start", this.termStart); + } + + if (this.termEnd != null) { + + formData.put("term_end", this.termEnd); + } + + if (this.productId != null) { + + formData.put("product_id", this.productId); + } + + if (this.currencyCode != null) { + + formData.put("currency_code", this.currencyCode); + } + + if (this.transactionId != null) { + + formData.put("transaction_id", this.transactionId); + } + + if (this.isTrial != null) { + + formData.put("is_trial", this.isTrial); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private String id; + + private Timestamp startedAt; + + private Timestamp termStart; + + private Timestamp termEnd; + + private String productId; + + private String currencyCode; + + private String transactionId; + + private Boolean isTrial; + + private SubscriptionBuilder() {} + + public SubscriptionBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionBuilder startedAt(Timestamp value) { + this.startedAt = value; + return this; + } + + public SubscriptionBuilder termStart(Timestamp value) { + this.termStart = value; + return this; + } + + public SubscriptionBuilder termEnd(Timestamp value) { + this.termEnd = value; + return this; + } + + public SubscriptionBuilder productId(String value) { + this.productId = value; + return this; + } + + public SubscriptionBuilder currencyCode(String value) { + this.currencyCode = value; + return this; + } + + public SubscriptionBuilder transactionId(String value) { + this.transactionId = value; + return this; + } + + public SubscriptionBuilder isTrial(Boolean value) { + this.isTrial = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + } + + public static final class CustomerParams { + + private final String id; + + private final String email; + + private CustomerParams(CustomerBuilder builder) { + + this.id = builder.id; + + this.email = builder.email; + } + + public String getId() { + return id; + } + + public String getEmail() { + return email; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + return formData; + } + + /** Create a new builder for CustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerBuilder builder() { + return new CustomerBuilder(); + } + + public static final class CustomerBuilder { + + private String id; + + private String email; + + private CustomerBuilder() {} + + public CustomerBuilder id(String value) { + this.id = value; + return this; + } + + public CustomerBuilder email(String value) { + this.email = value; + return this; + } + + public CustomerParams build() { + return new CustomerParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionProcessReceiptParams.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionProcessReceiptParams.java new file mode 100644 index 00000000..1456a283 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionProcessReceiptParams.java @@ -0,0 +1,386 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.inAppSubscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InAppSubscriptionProcessReceiptParams { + + private final String receipt; + + private final ProductParams product; + + private final CustomerParams customer; + + private InAppSubscriptionProcessReceiptParams(InAppSubscriptionProcessReceiptBuilder builder) { + + this.receipt = builder.receipt; + + this.product = builder.product; + + this.customer = builder.customer; + } + + public String getReceipt() { + return receipt; + } + + public ProductParams getProduct() { + return product; + } + + public CustomerParams getCustomer() { + return customer; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.receipt != null) { + + formData.put("receipt", this.receipt); + } + + if (this.product != null) { + + // Single object + Map nestedData = this.product.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "product[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.customer != null) { + + // Single object + Map nestedData = this.customer.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "customer[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InAppSubscriptionProcessReceiptParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InAppSubscriptionProcessReceiptBuilder builder() { + return new InAppSubscriptionProcessReceiptBuilder(); + } + + public static final class InAppSubscriptionProcessReceiptBuilder { + + private String receipt; + + private ProductParams product; + + private CustomerParams customer; + + private InAppSubscriptionProcessReceiptBuilder() {} + + public InAppSubscriptionProcessReceiptBuilder receipt(String value) { + this.receipt = value; + return this; + } + + public InAppSubscriptionProcessReceiptBuilder product(ProductParams value) { + this.product = value; + return this; + } + + public InAppSubscriptionProcessReceiptBuilder customer(CustomerParams value) { + this.customer = value; + return this; + } + + public InAppSubscriptionProcessReceiptParams build() { + return new InAppSubscriptionProcessReceiptParams(this); + } + } + + public static final class ProductParams { + + private final String id; + + private final String currencyCode; + + private final Integer price; + + private final String name; + + private final String priceInDecimal; + + private final String period; + + private final String periodUnit; + + private ProductParams(ProductBuilder builder) { + + this.id = builder.id; + + this.currencyCode = builder.currencyCode; + + this.price = builder.price; + + this.name = builder.name; + + this.priceInDecimal = builder.priceInDecimal; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + } + + public String getId() { + return id; + } + + public String getCurrencyCode() { + return currencyCode; + } + + public Integer getPrice() { + return price; + } + + public String getName() { + return name; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public String getPeriod() { + return period; + } + + public String getPeriodUnit() { + return periodUnit; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.currencyCode != null) { + + formData.put("currency_code", this.currencyCode); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.name != null) { + + formData.put("name", this.name); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + return formData; + } + + /** Create a new builder for ProductParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ProductBuilder builder() { + return new ProductBuilder(); + } + + public static final class ProductBuilder { + + private String id; + + private String currencyCode; + + private Integer price; + + private String name; + + private String priceInDecimal; + + private String period; + + private String periodUnit; + + private ProductBuilder() {} + + public ProductBuilder id(String value) { + this.id = value; + return this; + } + + public ProductBuilder currencyCode(String value) { + this.currencyCode = value; + return this; + } + + public ProductBuilder price(Integer value) { + this.price = value; + return this; + } + + public ProductBuilder name(String value) { + this.name = value; + return this; + } + + public ProductBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ProductBuilder period(String value) { + this.period = value; + return this; + } + + public ProductBuilder periodUnit(String value) { + this.periodUnit = value; + return this; + } + + public ProductParams build() { + return new ProductParams(this); + } + } + } + + public static final class CustomerParams { + + private final String id; + + private final String email; + + private final String firstName; + + private final String lastName; + + private CustomerParams(CustomerBuilder builder) { + + this.id = builder.id; + + this.email = builder.email; + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + } + + public String getId() { + return id; + } + + public String getEmail() { + return email; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + return formData; + } + + /** Create a new builder for CustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerBuilder builder() { + return new CustomerBuilder(); + } + + public static final class CustomerBuilder { + + private String id; + + private String email; + + private String firstName; + + private String lastName; + + private CustomerBuilder() {} + + public CustomerBuilder id(String value) { + this.id = value; + return this; + } + + public CustomerBuilder email(String value) { + this.email = value; + return this; + } + + public CustomerBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public CustomerBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public CustomerParams build() { + return new CustomerParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionRetrieveStoreSubscriptionsParams.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionRetrieveStoreSubscriptionsParams.java new file mode 100644 index 00000000..5aeb7def --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/InAppSubscriptionRetrieveStoreSubscriptionsParams.java @@ -0,0 +1,61 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.inAppSubscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InAppSubscriptionRetrieveStoreSubscriptionsParams { + + private final String receipt; + + private InAppSubscriptionRetrieveStoreSubscriptionsParams( + InAppSubscriptionRetrieveStoreSubscriptionsBuilder builder) { + + this.receipt = builder.receipt; + } + + public String getReceipt() { + return receipt; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.receipt != null) { + + formData.put("receipt", this.receipt); + } + + return formData; + } + + /** Create a new builder for InAppSubscriptionRetrieveStoreSubscriptionsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InAppSubscriptionRetrieveStoreSubscriptionsBuilder builder() { + return new InAppSubscriptionRetrieveStoreSubscriptionsBuilder(); + } + + public static final class InAppSubscriptionRetrieveStoreSubscriptionsBuilder { + + private String receipt; + + private InAppSubscriptionRetrieveStoreSubscriptionsBuilder() {} + + public InAppSubscriptionRetrieveStoreSubscriptionsBuilder receipt(String value) { + this.receipt = value; + return this; + } + + public InAppSubscriptionRetrieveStoreSubscriptionsParams build() { + return new InAppSubscriptionRetrieveStoreSubscriptionsParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/ProcessPurchaseCommandForInAppSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/ProcessPurchaseCommandForInAppSubscriptionParams.java deleted file mode 100644 index 8a77195a..00000000 --- a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/ProcessPurchaseCommandForInAppSubscriptionParams.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.inAppSubscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ProcessPurchaseCommandForInAppSubscriptionParams { - - private final String receipt; - - private final ProductParams product; - - private final CustomerParams customer; - - private ProcessPurchaseCommandForInAppSubscriptionParams( - ProcessPurchaseCommandForInAppSubscriptionBuilder builder) { - - this.receipt = builder.receipt; - - this.product = builder.product; - - this.customer = builder.customer; - } - - public String getReceipt() { - return receipt; - } - - public ProductParams getProduct() { - return product; - } - - public CustomerParams getCustomer() { - return customer; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.receipt != null) { - - formData.put("receipt", this.receipt); - } - - if (this.product != null) { - - // Single object - Map nestedData = this.product.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "product[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.customer != null) { - - // Single object - Map nestedData = this.customer.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "customer[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for ProcessPurchaseCommandForInAppSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ProcessPurchaseCommandForInAppSubscriptionBuilder builder() { - return new ProcessPurchaseCommandForInAppSubscriptionBuilder(); - } - - public static final class ProcessPurchaseCommandForInAppSubscriptionBuilder { - - private String receipt; - - private ProductParams product; - - private CustomerParams customer; - - private ProcessPurchaseCommandForInAppSubscriptionBuilder() {} - - public ProcessPurchaseCommandForInAppSubscriptionBuilder receipt(String value) { - this.receipt = value; - return this; - } - - public ProcessPurchaseCommandForInAppSubscriptionBuilder product(ProductParams value) { - this.product = value; - return this; - } - - public ProcessPurchaseCommandForInAppSubscriptionBuilder customer(CustomerParams value) { - this.customer = value; - return this; - } - - public ProcessPurchaseCommandForInAppSubscriptionParams build() { - return new ProcessPurchaseCommandForInAppSubscriptionParams(this); - } - } - - public static final class ProductParams { - - private final String id; - - private final String currencyCode; - - private final Integer price; - - private final String name; - - private final String priceInDecimal; - - private final String period; - - private final String periodUnit; - - private ProductParams(ProductBuilder builder) { - - this.id = builder.id; - - this.currencyCode = builder.currencyCode; - - this.price = builder.price; - - this.name = builder.name; - - this.priceInDecimal = builder.priceInDecimal; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - } - - public String getId() { - return id; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public Integer getPrice() { - return price; - } - - public String getName() { - return name; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public String getPeriod() { - return period; - } - - public String getPeriodUnit() { - return periodUnit; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.currencyCode != null) { - - formData.put("currency_code", this.currencyCode); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.name != null) { - - formData.put("name", this.name); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - return formData; - } - - /** Create a new builder for ProductParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ProductBuilder builder() { - return new ProductBuilder(); - } - - public static final class ProductBuilder { - - private String id; - - private String currencyCode; - - private Integer price; - - private String name; - - private String priceInDecimal; - - private String period; - - private String periodUnit; - - private ProductBuilder() {} - - public ProductBuilder id(String value) { - this.id = value; - return this; - } - - public ProductBuilder currencyCode(String value) { - this.currencyCode = value; - return this; - } - - public ProductBuilder price(Integer value) { - this.price = value; - return this; - } - - public ProductBuilder name(String value) { - this.name = value; - return this; - } - - public ProductBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ProductBuilder period(String value) { - this.period = value; - return this; - } - - public ProductBuilder periodUnit(String value) { - this.periodUnit = value; - return this; - } - - public ProductParams build() { - return new ProductParams(this); - } - } - } - - public static final class CustomerParams { - - private final String id; - - private final String email; - - private final String firstName; - - private final String lastName; - - private CustomerParams(CustomerBuilder builder) { - - this.id = builder.id; - - this.email = builder.email; - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - } - - public String getId() { - return id; - } - - public String getEmail() { - return email; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - return formData; - } - - /** Create a new builder for CustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CustomerBuilder builder() { - return new CustomerBuilder(); - } - - public static final class CustomerBuilder { - - private String id; - - private String email; - - private String firstName; - - private String lastName; - - private CustomerBuilder() {} - - public CustomerBuilder id(String value) { - this.id = value; - return this; - } - - public CustomerBuilder email(String value) { - this.email = value; - return this; - } - - public CustomerBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public CustomerBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public CustomerParams build() { - return new CustomerParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/RetrieveInAppSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/params/RetrieveInAppSubscriptionParams.java deleted file mode 100644 index 8f5314d1..00000000 --- a/src/main/java/com/chargebee/v4/models/inAppSubscription/params/RetrieveInAppSubscriptionParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.inAppSubscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RetrieveInAppSubscriptionParams { - - private final String receipt; - - private RetrieveInAppSubscriptionParams(RetrieveInAppSubscriptionBuilder builder) { - - this.receipt = builder.receipt; - } - - public String getReceipt() { - return receipt; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.receipt != null) { - - formData.put("receipt", this.receipt); - } - - return formData; - } - - /** Create a new builder for RetrieveInAppSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RetrieveInAppSubscriptionBuilder builder() { - return new RetrieveInAppSubscriptionBuilder(); - } - - public static final class RetrieveInAppSubscriptionBuilder { - - private String receipt; - - private RetrieveInAppSubscriptionBuilder() {} - - public RetrieveInAppSubscriptionBuilder receipt(String value) { - this.receipt = value; - return this; - } - - public RetrieveInAppSubscriptionParams build() { - return new RetrieveInAppSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/ImportReceiptForInAppSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/ImportReceiptForInAppSubscriptionResponse.java deleted file mode 100644 index 35fc5ff8..00000000 --- a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/ImportReceiptForInAppSubscriptionResponse.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.chargebee.v4.models.inAppSubscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.inAppSubscription.InAppSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ImportReceiptForInAppSubscription operation. Contains the response - * data from the API. - */ -public final class ImportReceiptForInAppSubscriptionResponse extends BaseResponse { - private final List inAppSubscriptions; - - private ImportReceiptForInAppSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.inAppSubscriptions = builder.inAppSubscriptions; - } - - /** Parse JSON response into ImportReceiptForInAppSubscriptionResponse object. */ - public static ImportReceiptForInAppSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into ImportReceiptForInAppSubscriptionResponse object with HTTP response. - */ - public static ImportReceiptForInAppSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.inAppSubscriptions( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "in_app_subscriptions")).stream() - .map(InAppSubscription::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ImportReceiptForInAppSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ImportReceiptForInAppSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ImportReceiptForInAppSubscriptionResponse. */ - public static class Builder { - - private List inAppSubscriptions; - - private Response httpResponse; - - private Builder() {} - - public Builder inAppSubscriptions(List inAppSubscriptions) { - this.inAppSubscriptions = inAppSubscriptions; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ImportReceiptForInAppSubscriptionResponse build() { - return new ImportReceiptForInAppSubscriptionResponse(this); - } - } - - /** Get the inAppSubscriptions from the response. */ - public List getInAppSubscriptions() { - return inAppSubscriptions; - } -} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/ImportSubscriptionForInAppSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/ImportSubscriptionForInAppSubscriptionResponse.java deleted file mode 100644 index 55b10d9b..00000000 --- a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/ImportSubscriptionForInAppSubscriptionResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.inAppSubscription.responses; - -import com.chargebee.v4.models.inAppSubscription.InAppSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ImportSubscriptionForInAppSubscription operation. Contains the - * response data from the API. - */ -public final class ImportSubscriptionForInAppSubscriptionResponse extends BaseResponse { - private final InAppSubscription inAppSubscription; - - private ImportSubscriptionForInAppSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.inAppSubscription = builder.inAppSubscription; - } - - /** Parse JSON response into ImportSubscriptionForInAppSubscriptionResponse object. */ - public static ImportSubscriptionForInAppSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into ImportSubscriptionForInAppSubscriptionResponse object with HTTP - * response. - */ - public static ImportSubscriptionForInAppSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __inAppSubscriptionJson = JsonUtil.getObject(json, "in_app_subscription"); - if (__inAppSubscriptionJson != null) { - builder.inAppSubscription(InAppSubscription.fromJson(__inAppSubscriptionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ImportSubscriptionForInAppSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ImportSubscriptionForInAppSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ImportSubscriptionForInAppSubscriptionResponse. */ - public static class Builder { - - private InAppSubscription inAppSubscription; - - private Response httpResponse; - - private Builder() {} - - public Builder inAppSubscription(InAppSubscription inAppSubscription) { - this.inAppSubscription = inAppSubscription; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ImportSubscriptionForInAppSubscriptionResponse build() { - return new ImportSubscriptionForInAppSubscriptionResponse(this); - } - } - - /** Get the inAppSubscription from the response. */ - public InAppSubscription getInAppSubscription() { - return inAppSubscription; - } -} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionImportReceiptResponse.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionImportReceiptResponse.java new file mode 100644 index 00000000..29066aac --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionImportReceiptResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.inAppSubscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.inAppSubscription.InAppSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InAppSubscriptionImportReceipt operation. Contains the response + * data from the API. + */ +public final class InAppSubscriptionImportReceiptResponse extends BaseResponse { + private final List inAppSubscriptions; + + private InAppSubscriptionImportReceiptResponse(Builder builder) { + super(builder.httpResponse); + + this.inAppSubscriptions = builder.inAppSubscriptions; + } + + /** Parse JSON response into InAppSubscriptionImportReceiptResponse object. */ + public static InAppSubscriptionImportReceiptResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InAppSubscriptionImportReceiptResponse object with HTTP response. */ + public static InAppSubscriptionImportReceiptResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.inAppSubscriptions( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "in_app_subscriptions")).stream() + .map(InAppSubscription::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse InAppSubscriptionImportReceiptResponse from JSON", e); + } + } + + /** Create a new builder for InAppSubscriptionImportReceiptResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InAppSubscriptionImportReceiptResponse. */ + public static class Builder { + + private List inAppSubscriptions; + + private Response httpResponse; + + private Builder() {} + + public Builder inAppSubscriptions(List inAppSubscriptions) { + this.inAppSubscriptions = inAppSubscriptions; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InAppSubscriptionImportReceiptResponse build() { + return new InAppSubscriptionImportReceiptResponse(this); + } + } + + /** Get the inAppSubscriptions from the response. */ + public List getInAppSubscriptions() { + return inAppSubscriptions; + } +} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionImportSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionImportSubscriptionResponse.java new file mode 100644 index 00000000..1e8ccbf6 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionImportSubscriptionResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.inAppSubscription.responses; + +import com.chargebee.v4.models.inAppSubscription.InAppSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InAppSubscriptionImportSubscription operation. Contains the + * response data from the API. + */ +public final class InAppSubscriptionImportSubscriptionResponse extends BaseResponse { + private final InAppSubscription inAppSubscription; + + private InAppSubscriptionImportSubscriptionResponse(Builder builder) { + super(builder.httpResponse); + + this.inAppSubscription = builder.inAppSubscription; + } + + /** Parse JSON response into InAppSubscriptionImportSubscriptionResponse object. */ + public static InAppSubscriptionImportSubscriptionResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into InAppSubscriptionImportSubscriptionResponse object with HTTP response. + */ + public static InAppSubscriptionImportSubscriptionResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __inAppSubscriptionJson = JsonUtil.getObject(json, "in_app_subscription"); + if (__inAppSubscriptionJson != null) { + builder.inAppSubscription(InAppSubscription.fromJson(__inAppSubscriptionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse InAppSubscriptionImportSubscriptionResponse from JSON", e); + } + } + + /** Create a new builder for InAppSubscriptionImportSubscriptionResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InAppSubscriptionImportSubscriptionResponse. */ + public static class Builder { + + private InAppSubscription inAppSubscription; + + private Response httpResponse; + + private Builder() {} + + public Builder inAppSubscription(InAppSubscription inAppSubscription) { + this.inAppSubscription = inAppSubscription; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InAppSubscriptionImportSubscriptionResponse build() { + return new InAppSubscriptionImportSubscriptionResponse(this); + } + } + + /** Get the inAppSubscription from the response. */ + public InAppSubscription getInAppSubscription() { + return inAppSubscription; + } +} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionProcessReceiptResponse.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionProcessReceiptResponse.java new file mode 100644 index 00000000..4d8469fc --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionProcessReceiptResponse.java @@ -0,0 +1,79 @@ +package com.chargebee.v4.models.inAppSubscription.responses; + +import com.chargebee.v4.models.inAppSubscription.InAppSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InAppSubscriptionProcessReceipt operation. Contains the response + * data from the API. + */ +public final class InAppSubscriptionProcessReceiptResponse extends BaseResponse { + private final InAppSubscription inAppSubscription; + + private InAppSubscriptionProcessReceiptResponse(Builder builder) { + super(builder.httpResponse); + + this.inAppSubscription = builder.inAppSubscription; + } + + /** Parse JSON response into InAppSubscriptionProcessReceiptResponse object. */ + public static InAppSubscriptionProcessReceiptResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InAppSubscriptionProcessReceiptResponse object with HTTP response. */ + public static InAppSubscriptionProcessReceiptResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __inAppSubscriptionJson = JsonUtil.getObject(json, "in_app_subscription"); + if (__inAppSubscriptionJson != null) { + builder.inAppSubscription(InAppSubscription.fromJson(__inAppSubscriptionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse InAppSubscriptionProcessReceiptResponse from JSON", e); + } + } + + /** Create a new builder for InAppSubscriptionProcessReceiptResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InAppSubscriptionProcessReceiptResponse. */ + public static class Builder { + + private InAppSubscription inAppSubscription; + + private Response httpResponse; + + private Builder() {} + + public Builder inAppSubscription(InAppSubscription inAppSubscription) { + this.inAppSubscription = inAppSubscription; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InAppSubscriptionProcessReceiptResponse build() { + return new InAppSubscriptionProcessReceiptResponse(this); + } + } + + /** Get the inAppSubscription from the response. */ + public InAppSubscription getInAppSubscription() { + return inAppSubscription; + } +} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionRetrieveStoreSubscriptionsResponse.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionRetrieveStoreSubscriptionsResponse.java new file mode 100644 index 00000000..9458295a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/InAppSubscriptionRetrieveStoreSubscriptionsResponse.java @@ -0,0 +1,84 @@ +package com.chargebee.v4.models.inAppSubscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.inAppSubscription.InAppSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InAppSubscriptionRetrieveStoreSubscriptions operation. Contains the + * response data from the API. + */ +public final class InAppSubscriptionRetrieveStoreSubscriptionsResponse extends BaseResponse { + private final List inAppSubscriptions; + + private InAppSubscriptionRetrieveStoreSubscriptionsResponse(Builder builder) { + super(builder.httpResponse); + + this.inAppSubscriptions = builder.inAppSubscriptions; + } + + /** Parse JSON response into InAppSubscriptionRetrieveStoreSubscriptionsResponse object. */ + public static InAppSubscriptionRetrieveStoreSubscriptionsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into InAppSubscriptionRetrieveStoreSubscriptionsResponse object with HTTP + * response. + */ + public static InAppSubscriptionRetrieveStoreSubscriptionsResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.inAppSubscriptions( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "in_app_subscriptions")).stream() + .map(InAppSubscription::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse InAppSubscriptionRetrieveStoreSubscriptionsResponse from JSON", e); + } + } + + /** Create a new builder for InAppSubscriptionRetrieveStoreSubscriptionsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InAppSubscriptionRetrieveStoreSubscriptionsResponse. */ + public static class Builder { + + private List inAppSubscriptions; + + private Response httpResponse; + + private Builder() {} + + public Builder inAppSubscriptions(List inAppSubscriptions) { + this.inAppSubscriptions = inAppSubscriptions; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InAppSubscriptionRetrieveStoreSubscriptionsResponse build() { + return new InAppSubscriptionRetrieveStoreSubscriptionsResponse(this); + } + } + + /** Get the inAppSubscriptions from the response. */ + public List getInAppSubscriptions() { + return inAppSubscriptions; + } +} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/ProcessPurchaseCommandForInAppSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/ProcessPurchaseCommandForInAppSubscriptionResponse.java deleted file mode 100644 index 8275ec6b..00000000 --- a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/ProcessPurchaseCommandForInAppSubscriptionResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.inAppSubscription.responses; - -import com.chargebee.v4.models.inAppSubscription.InAppSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ProcessPurchaseCommandForInAppSubscription operation. Contains the - * response data from the API. - */ -public final class ProcessPurchaseCommandForInAppSubscriptionResponse extends BaseResponse { - private final InAppSubscription inAppSubscription; - - private ProcessPurchaseCommandForInAppSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.inAppSubscription = builder.inAppSubscription; - } - - /** Parse JSON response into ProcessPurchaseCommandForInAppSubscriptionResponse object. */ - public static ProcessPurchaseCommandForInAppSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into ProcessPurchaseCommandForInAppSubscriptionResponse object with HTTP - * response. - */ - public static ProcessPurchaseCommandForInAppSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __inAppSubscriptionJson = JsonUtil.getObject(json, "in_app_subscription"); - if (__inAppSubscriptionJson != null) { - builder.inAppSubscription(InAppSubscription.fromJson(__inAppSubscriptionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ProcessPurchaseCommandForInAppSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ProcessPurchaseCommandForInAppSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ProcessPurchaseCommandForInAppSubscriptionResponse. */ - public static class Builder { - - private InAppSubscription inAppSubscription; - - private Response httpResponse; - - private Builder() {} - - public Builder inAppSubscription(InAppSubscription inAppSubscription) { - this.inAppSubscription = inAppSubscription; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ProcessPurchaseCommandForInAppSubscriptionResponse build() { - return new ProcessPurchaseCommandForInAppSubscriptionResponse(this); - } - } - - /** Get the inAppSubscription from the response. */ - public InAppSubscription getInAppSubscription() { - return inAppSubscription; - } -} diff --git a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/RetrieveInAppSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/RetrieveInAppSubscriptionResponse.java deleted file mode 100644 index f8e221cf..00000000 --- a/src/main/java/com/chargebee/v4/models/inAppSubscription/responses/RetrieveInAppSubscriptionResponse.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.chargebee.v4.models.inAppSubscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.inAppSubscription.InAppSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RetrieveInAppSubscription operation. Contains the response data - * from the API. - */ -public final class RetrieveInAppSubscriptionResponse extends BaseResponse { - private final List inAppSubscriptions; - - private RetrieveInAppSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.inAppSubscriptions = builder.inAppSubscriptions; - } - - /** Parse JSON response into RetrieveInAppSubscriptionResponse object. */ - public static RetrieveInAppSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RetrieveInAppSubscriptionResponse object with HTTP response. */ - public static RetrieveInAppSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.inAppSubscriptions( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "in_app_subscriptions")).stream() - .map(InAppSubscription::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RetrieveInAppSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RetrieveInAppSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RetrieveInAppSubscriptionResponse. */ - public static class Builder { - - private List inAppSubscriptions; - - private Response httpResponse; - - private Builder() {} - - public Builder inAppSubscriptions(List inAppSubscriptions) { - this.inAppSubscriptions = inAppSubscriptions; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RetrieveInAppSubscriptionResponse build() { - return new RetrieveInAppSubscriptionResponse(this); - } - } - - /** Get the inAppSubscriptions from the response. */ - public List getInAppSubscriptions() { - return inAppSubscriptions; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/AddAddonChargeForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/AddAddonChargeForInvoiceParams.java deleted file mode 100644 index f961c4e8..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/AddAddonChargeForInvoiceParams.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class AddAddonChargeForInvoiceParams { - - private final String addonId; - - private final Integer addonQuantity; - - private final Long addonUnitPrice; - - private final String addonQuantityInDecimal; - - private final String addonUnitPriceInDecimal; - - private final String comment; - - private final String subscriptionId; - - private final LineItemParams lineItem; - - private AddAddonChargeForInvoiceParams(AddAddonChargeForInvoiceBuilder builder) { - - this.addonId = builder.addonId; - - this.addonQuantity = builder.addonQuantity; - - this.addonUnitPrice = builder.addonUnitPrice; - - this.addonQuantityInDecimal = builder.addonQuantityInDecimal; - - this.addonUnitPriceInDecimal = builder.addonUnitPriceInDecimal; - - this.comment = builder.comment; - - this.subscriptionId = builder.subscriptionId; - - this.lineItem = builder.lineItem; - } - - public String getAddonId() { - return addonId; - } - - public Integer getAddonQuantity() { - return addonQuantity; - } - - public Long getAddonUnitPrice() { - return addonUnitPrice; - } - - public String getAddonQuantityInDecimal() { - return addonQuantityInDecimal; - } - - public String getAddonUnitPriceInDecimal() { - return addonUnitPriceInDecimal; - } - - public String getComment() { - return comment; - } - - public String getSubscriptionId() { - return subscriptionId; - } - - public LineItemParams getLineItem() { - return lineItem; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.addonId != null) { - - formData.put("addon_id", this.addonId); - } - - if (this.addonQuantity != null) { - - formData.put("addon_quantity", this.addonQuantity); - } - - if (this.addonUnitPrice != null) { - - formData.put("addon_unit_price", this.addonUnitPrice); - } - - if (this.addonQuantityInDecimal != null) { - - formData.put("addon_quantity_in_decimal", this.addonQuantityInDecimal); - } - - if (this.addonUnitPriceInDecimal != null) { - - formData.put("addon_unit_price_in_decimal", this.addonUnitPriceInDecimal); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.subscriptionId != null) { - - formData.put("subscription_id", this.subscriptionId); - } - - if (this.lineItem != null) { - - // Single object - Map nestedData = this.lineItem.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "line_item[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for AddAddonChargeForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddAddonChargeForInvoiceBuilder builder() { - return new AddAddonChargeForInvoiceBuilder(); - } - - public static final class AddAddonChargeForInvoiceBuilder { - - private String addonId; - - private Integer addonQuantity; - - private Long addonUnitPrice; - - private String addonQuantityInDecimal; - - private String addonUnitPriceInDecimal; - - private String comment; - - private String subscriptionId; - - private LineItemParams lineItem; - - private AddAddonChargeForInvoiceBuilder() {} - - public AddAddonChargeForInvoiceBuilder addonId(String value) { - this.addonId = value; - return this; - } - - public AddAddonChargeForInvoiceBuilder addonQuantity(Integer value) { - this.addonQuantity = value; - return this; - } - - public AddAddonChargeForInvoiceBuilder addonUnitPrice(Long value) { - this.addonUnitPrice = value; - return this; - } - - public AddAddonChargeForInvoiceBuilder addonQuantityInDecimal(String value) { - this.addonQuantityInDecimal = value; - return this; - } - - public AddAddonChargeForInvoiceBuilder addonUnitPriceInDecimal(String value) { - this.addonUnitPriceInDecimal = value; - return this; - } - - public AddAddonChargeForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public AddAddonChargeForInvoiceBuilder subscriptionId(String value) { - this.subscriptionId = value; - return this; - } - - public AddAddonChargeForInvoiceBuilder lineItem(LineItemParams value) { - this.lineItem = value; - return this; - } - - public AddAddonChargeForInvoiceParams build() { - return new AddAddonChargeForInvoiceParams(this); - } - } - - public static final class LineItemParams { - - private final Timestamp dateFrom; - - private final Timestamp dateTo; - - private LineItemParams(LineItemBuilder builder) { - - this.dateFrom = builder.dateFrom; - - this.dateTo = builder.dateTo; - } - - public Timestamp getDateFrom() { - return dateFrom; - } - - public Timestamp getDateTo() { - return dateTo; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.dateFrom != null) { - - formData.put("date_from", this.dateFrom); - } - - if (this.dateTo != null) { - - formData.put("date_to", this.dateTo); - } - - return formData; - } - - /** Create a new builder for LineItemParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static LineItemBuilder builder() { - return new LineItemBuilder(); - } - - public static final class LineItemBuilder { - - private Timestamp dateFrom; - - private Timestamp dateTo; - - private LineItemBuilder() {} - - public LineItemBuilder dateFrom(Timestamp value) { - this.dateFrom = value; - return this; - } - - public LineItemBuilder dateTo(Timestamp value) { - this.dateTo = value; - return this; - } - - public LineItemParams build() { - return new LineItemParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/AddChargeForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/AddChargeForInvoiceParams.java deleted file mode 100644 index 23f28867..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/AddChargeForInvoiceParams.java +++ /dev/null @@ -1,366 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class AddChargeForInvoiceParams { - - private final Long amount; - - private final String description; - - private final AvalaraSaleType avalaraSaleType; - - private final Integer avalaraTransactionType; - - private final Integer avalaraServiceType; - - private final String avalaraTaxCode; - - private final String hsnCode; - - private final String taxjarProductCode; - - private final String comment; - - private final String subscriptionId; - - private final LineItemParams lineItem; - - private AddChargeForInvoiceParams(AddChargeForInvoiceBuilder builder) { - - this.amount = builder.amount; - - this.description = builder.description; - - this.avalaraSaleType = builder.avalaraSaleType; - - this.avalaraTransactionType = builder.avalaraTransactionType; - - this.avalaraServiceType = builder.avalaraServiceType; - - this.avalaraTaxCode = builder.avalaraTaxCode; - - this.hsnCode = builder.hsnCode; - - this.taxjarProductCode = builder.taxjarProductCode; - - this.comment = builder.comment; - - this.subscriptionId = builder.subscriptionId; - - this.lineItem = builder.lineItem; - } - - public Long getAmount() { - return amount; - } - - public String getDescription() { - return description; - } - - public AvalaraSaleType getAvalaraSaleType() { - return avalaraSaleType; - } - - public Integer getAvalaraTransactionType() { - return avalaraTransactionType; - } - - public Integer getAvalaraServiceType() { - return avalaraServiceType; - } - - public String getAvalaraTaxCode() { - return avalaraTaxCode; - } - - public String getHsnCode() { - return hsnCode; - } - - public String getTaxjarProductCode() { - return taxjarProductCode; - } - - public String getComment() { - return comment; - } - - public String getSubscriptionId() { - return subscriptionId; - } - - public LineItemParams getLineItem() { - return lineItem; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.avalaraSaleType != null) { - - formData.put("avalara_sale_type", this.avalaraSaleType); - } - - if (this.avalaraTransactionType != null) { - - formData.put("avalara_transaction_type", this.avalaraTransactionType); - } - - if (this.avalaraServiceType != null) { - - formData.put("avalara_service_type", this.avalaraServiceType); - } - - if (this.avalaraTaxCode != null) { - - formData.put("avalara_tax_code", this.avalaraTaxCode); - } - - if (this.hsnCode != null) { - - formData.put("hsn_code", this.hsnCode); - } - - if (this.taxjarProductCode != null) { - - formData.put("taxjar_product_code", this.taxjarProductCode); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.subscriptionId != null) { - - formData.put("subscription_id", this.subscriptionId); - } - - if (this.lineItem != null) { - - // Single object - Map nestedData = this.lineItem.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "line_item[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for AddChargeForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddChargeForInvoiceBuilder builder() { - return new AddChargeForInvoiceBuilder(); - } - - public static final class AddChargeForInvoiceBuilder { - - private Long amount; - - private String description; - - private AvalaraSaleType avalaraSaleType; - - private Integer avalaraTransactionType; - - private Integer avalaraServiceType; - - private String avalaraTaxCode; - - private String hsnCode; - - private String taxjarProductCode; - - private String comment; - - private String subscriptionId; - - private LineItemParams lineItem; - - private AddChargeForInvoiceBuilder() {} - - public AddChargeForInvoiceBuilder amount(Long value) { - this.amount = value; - return this; - } - - public AddChargeForInvoiceBuilder description(String value) { - this.description = value; - return this; - } - - public AddChargeForInvoiceBuilder avalaraSaleType(AvalaraSaleType value) { - this.avalaraSaleType = value; - return this; - } - - public AddChargeForInvoiceBuilder avalaraTransactionType(Integer value) { - this.avalaraTransactionType = value; - return this; - } - - public AddChargeForInvoiceBuilder avalaraServiceType(Integer value) { - this.avalaraServiceType = value; - return this; - } - - public AddChargeForInvoiceBuilder avalaraTaxCode(String value) { - this.avalaraTaxCode = value; - return this; - } - - public AddChargeForInvoiceBuilder hsnCode(String value) { - this.hsnCode = value; - return this; - } - - public AddChargeForInvoiceBuilder taxjarProductCode(String value) { - this.taxjarProductCode = value; - return this; - } - - public AddChargeForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public AddChargeForInvoiceBuilder subscriptionId(String value) { - this.subscriptionId = value; - return this; - } - - public AddChargeForInvoiceBuilder lineItem(LineItemParams value) { - this.lineItem = value; - return this; - } - - public AddChargeForInvoiceParams build() { - return new AddChargeForInvoiceParams(this); - } - } - - public enum AvalaraSaleType { - WHOLESALE("wholesale"), - - RETAIL("retail"), - - CONSUMED("consumed"), - - VENDOR_USE("vendor_use"), - - /** An enum member indicating that AvalaraSaleType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AvalaraSaleType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AvalaraSaleType fromString(String value) { - if (value == null) return _UNKNOWN; - for (AvalaraSaleType enumValue : AvalaraSaleType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class LineItemParams { - - private final Timestamp dateFrom; - - private final Timestamp dateTo; - - private LineItemParams(LineItemBuilder builder) { - - this.dateFrom = builder.dateFrom; - - this.dateTo = builder.dateTo; - } - - public Timestamp getDateFrom() { - return dateFrom; - } - - public Timestamp getDateTo() { - return dateTo; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.dateFrom != null) { - - formData.put("date_from", this.dateFrom); - } - - if (this.dateTo != null) { - - formData.put("date_to", this.dateTo); - } - - return formData; - } - - /** Create a new builder for LineItemParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static LineItemBuilder builder() { - return new LineItemBuilder(); - } - - public static final class LineItemBuilder { - - private Timestamp dateFrom; - - private Timestamp dateTo; - - private LineItemBuilder() {} - - public LineItemBuilder dateFrom(Timestamp value) { - this.dateFrom = value; - return this; - } - - public LineItemBuilder dateTo(Timestamp value) { - this.dateTo = value; - return this; - } - - public LineItemParams build() { - return new LineItemParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/AddChargeItemForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/AddChargeItemForInvoiceParams.java deleted file mode 100644 index ae7ae78e..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/AddChargeItemForInvoiceParams.java +++ /dev/null @@ -1,523 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class AddChargeItemForInvoiceParams { - - private final String comment; - - private final String subscriptionId; - - private final ItemPriceParams itemPrice; - - private final List itemTiers; - - private AddChargeItemForInvoiceParams(AddChargeItemForInvoiceBuilder builder) { - - this.comment = builder.comment; - - this.subscriptionId = builder.subscriptionId; - - this.itemPrice = builder.itemPrice; - - this.itemTiers = builder.itemTiers; - } - - public String getComment() { - return comment; - } - - public String getSubscriptionId() { - return subscriptionId; - } - - public ItemPriceParams getItemPrice() { - return itemPrice; - } - - public List getItemTiers() { - return itemTiers; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.subscriptionId != null) { - - formData.put("subscription_id", this.subscriptionId); - } - - if (this.itemPrice != null) { - - // Single object - Map nestedData = this.itemPrice.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "item_price[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for AddChargeItemForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddChargeItemForInvoiceBuilder builder() { - return new AddChargeItemForInvoiceBuilder(); - } - - public static final class AddChargeItemForInvoiceBuilder { - - private String comment; - - private String subscriptionId; - - private ItemPriceParams itemPrice; - - private List itemTiers; - - private AddChargeItemForInvoiceBuilder() {} - - public AddChargeItemForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public AddChargeItemForInvoiceBuilder subscriptionId(String value) { - this.subscriptionId = value; - return this; - } - - public AddChargeItemForInvoiceBuilder itemPrice(ItemPriceParams value) { - this.itemPrice = value; - return this; - } - - public AddChargeItemForInvoiceBuilder itemTiers(List value) { - this.itemTiers = value; - return this; - } - - public AddChargeItemForInvoiceParams build() { - return new AddChargeItemForInvoiceParams(this); - } - } - - public static final class ItemPriceParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Timestamp dateFrom; - - private final Timestamp dateTo; - - private ItemPriceParams(ItemPriceBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.dateFrom = builder.dateFrom; - - this.dateTo = builder.dateTo; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Timestamp getDateFrom() { - return dateFrom; - } - - public Timestamp getDateTo() { - return dateTo; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.dateFrom != null) { - - formData.put("date_from", this.dateFrom); - } - - if (this.dateTo != null) { - - formData.put("date_to", this.dateTo); - } - - return formData; - } - - /** Create a new builder for ItemPriceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemPriceBuilder builder() { - return new ItemPriceBuilder(); - } - - public static final class ItemPriceBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Timestamp dateFrom; - - private Timestamp dateTo; - - private ItemPriceBuilder() {} - - public ItemPriceBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemPriceBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public ItemPriceBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public ItemPriceBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public ItemPriceBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public ItemPriceBuilder dateFrom(Timestamp value) { - this.dateFrom = value; - return this; - } - - public ItemPriceBuilder dateTo(Timestamp value) { - this.dateTo = value; - return this; - } - - public ItemPriceParams build() { - return new ItemPriceParams(this); - } - } - } - - public static final class ItemTiersParams { - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/ApplyCreditsForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/ApplyCreditsForInvoiceParams.java deleted file mode 100644 index 4434fe8b..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/ApplyCreditsForInvoiceParams.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class ApplyCreditsForInvoiceParams { - - private final String comment; - - private final List creditNotes; - - private ApplyCreditsForInvoiceParams(ApplyCreditsForInvoiceBuilder builder) { - - this.comment = builder.comment; - - this.creditNotes = builder.creditNotes; - } - - public String getComment() { - return comment; - } - - public List getCreditNotes() { - return creditNotes; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.creditNotes != null) { - - // List of objects - for (int i = 0; i < this.creditNotes.size(); i++) { - CreditNotesParams item = this.creditNotes.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "credit_notes[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for ApplyCreditsForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ApplyCreditsForInvoiceBuilder builder() { - return new ApplyCreditsForInvoiceBuilder(); - } - - public static final class ApplyCreditsForInvoiceBuilder { - - private String comment; - - private List creditNotes; - - private ApplyCreditsForInvoiceBuilder() {} - - public ApplyCreditsForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public ApplyCreditsForInvoiceBuilder creditNotes(List value) { - this.creditNotes = value; - return this; - } - - public ApplyCreditsForInvoiceParams build() { - return new ApplyCreditsForInvoiceParams(this); - } - } - - public static final class CreditNotesParams { - - private final String id; - - private CreditNotesParams(CreditNotesBuilder builder) { - - this.id = builder.id; - } - - public String getId() { - return id; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - return formData; - } - - /** Create a new builder for CreditNotesParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreditNotesBuilder builder() { - return new CreditNotesBuilder(); - } - - public static final class CreditNotesBuilder { - - private String id; - - private CreditNotesBuilder() {} - - public CreditNotesBuilder id(String value) { - this.id = value; - return this; - } - - public CreditNotesParams build() { - return new CreditNotesParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/ApplyPaymentScheduleSchemeForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/ApplyPaymentScheduleSchemeForInvoiceParams.java deleted file mode 100644 index 2c86be15..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/ApplyPaymentScheduleSchemeForInvoiceParams.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ApplyPaymentScheduleSchemeForInvoiceParams { - - private final String schemeId; - - private final Long amount; - - private ApplyPaymentScheduleSchemeForInvoiceParams( - ApplyPaymentScheduleSchemeForInvoiceBuilder builder) { - - this.schemeId = builder.schemeId; - - this.amount = builder.amount; - } - - public String getSchemeId() { - return schemeId; - } - - public Long getAmount() { - return amount; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.schemeId != null) { - - formData.put("scheme_id", this.schemeId); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - return formData; - } - - /** Create a new builder for ApplyPaymentScheduleSchemeForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ApplyPaymentScheduleSchemeForInvoiceBuilder builder() { - return new ApplyPaymentScheduleSchemeForInvoiceBuilder(); - } - - public static final class ApplyPaymentScheduleSchemeForInvoiceBuilder { - - private String schemeId; - - private Long amount; - - private ApplyPaymentScheduleSchemeForInvoiceBuilder() {} - - public ApplyPaymentScheduleSchemeForInvoiceBuilder schemeId(String value) { - this.schemeId = value; - return this; - } - - public ApplyPaymentScheduleSchemeForInvoiceBuilder amount(Long value) { - this.amount = value; - return this; - } - - public ApplyPaymentScheduleSchemeForInvoiceParams build() { - return new ApplyPaymentScheduleSchemeForInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/ApplyPaymentsForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/ApplyPaymentsForInvoiceParams.java deleted file mode 100644 index 27b77c8e..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/ApplyPaymentsForInvoiceParams.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class ApplyPaymentsForInvoiceParams { - - private final String comment; - - private final List transactions; - - private ApplyPaymentsForInvoiceParams(ApplyPaymentsForInvoiceBuilder builder) { - - this.comment = builder.comment; - - this.transactions = builder.transactions; - } - - public String getComment() { - return comment; - } - - public List getTransactions() { - return transactions; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.transactions != null) { - - // List of objects - for (int i = 0; i < this.transactions.size(); i++) { - TransactionsParams item = this.transactions.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "transactions[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for ApplyPaymentsForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ApplyPaymentsForInvoiceBuilder builder() { - return new ApplyPaymentsForInvoiceBuilder(); - } - - public static final class ApplyPaymentsForInvoiceBuilder { - - private String comment; - - private List transactions; - - private ApplyPaymentsForInvoiceBuilder() {} - - public ApplyPaymentsForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public ApplyPaymentsForInvoiceBuilder transactions(List value) { - this.transactions = value; - return this; - } - - public ApplyPaymentsForInvoiceParams build() { - return new ApplyPaymentsForInvoiceParams(this); - } - } - - public static final class TransactionsParams { - - private final String id; - - private final Long amount; - - private TransactionsParams(TransactionsBuilder builder) { - - this.id = builder.id; - - this.amount = builder.amount; - } - - public String getId() { - return id; - } - - public Long getAmount() { - return amount; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - return formData; - } - - /** Create a new builder for TransactionsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TransactionsBuilder builder() { - return new TransactionsBuilder(); - } - - public static final class TransactionsBuilder { - - private String id; - - private Long amount; - - private TransactionsBuilder() {} - - public TransactionsBuilder id(String value) { - this.id = value; - return this; - } - - public TransactionsBuilder amount(Long value) { - this.amount = value; - return this; - } - - public TransactionsParams build() { - return new TransactionsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/CloseForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/CloseForInvoiceParams.java deleted file mode 100644 index 4854bc2c..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/CloseForInvoiceParams.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class CloseForInvoiceParams { - - private final String comment; - - private final String invoiceNote; - - private final Boolean removeGeneralNote; - - private final Timestamp invoiceDate; - - private final List notesToRemove; - - private final Map customFields; - - private CloseForInvoiceParams(CloseForInvoiceBuilder builder) { - - this.comment = builder.comment; - - this.invoiceNote = builder.invoiceNote; - - this.removeGeneralNote = builder.removeGeneralNote; - - this.invoiceDate = builder.invoiceDate; - - this.notesToRemove = builder.notesToRemove; - - this.customFields = - builder.customFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); - } - - public String getComment() { - return comment; - } - - public String getInvoiceNote() { - return invoiceNote; - } - - public Boolean getRemoveGeneralNote() { - return removeGeneralNote; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public List getNotesToRemove() { - return notesToRemove; - } - - public Map customFields() { - return customFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.invoiceNote != null) { - - formData.put("invoice_note", this.invoiceNote); - } - - if (this.removeGeneralNote != null) { - - formData.put("remove_general_note", this.removeGeneralNote); - } - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.notesToRemove != null) { - - // List of objects - for (int i = 0; i < this.notesToRemove.size(); i++) { - NotesToRemoveParams item = this.notesToRemove.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "notes_to_remove[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(customFields); - - return formData; - } - - /** Create a new builder for CloseForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CloseForInvoiceBuilder builder() { - return new CloseForInvoiceBuilder(); - } - - public static final class CloseForInvoiceBuilder { - - private String comment; - - private String invoiceNote; - - private Boolean removeGeneralNote; - - private Timestamp invoiceDate; - - private List notesToRemove; - - private Map customFields = new LinkedHashMap<>(); - - private CloseForInvoiceBuilder() {} - - public CloseForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public CloseForInvoiceBuilder invoiceNote(String value) { - this.invoiceNote = value; - return this; - } - - public CloseForInvoiceBuilder removeGeneralNote(Boolean value) { - this.removeGeneralNote = value; - return this; - } - - public CloseForInvoiceBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public CloseForInvoiceBuilder notesToRemove(List value) { - this.notesToRemove = value; - return this; - } - - /** - * Add a custom field to the request. Custom fields must start with "cf_". - * - * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") - * @param value the value of the custom field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cf_" - */ - public CloseForInvoiceBuilder customField(String fieldName, String value) { - if (fieldName == null || !fieldName.startsWith("cf_")) { - throw new IllegalArgumentException("Custom field name must start with 'cf_'"); - } - this.customFields.put(fieldName, value); - return this; - } - - /** - * Add multiple custom fields to the request. All field names must start with "cf_". - * - * @param customFields map of custom field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cf_" - */ - public CloseForInvoiceBuilder customFields(Map customFields) { - if (customFields != null) { - for (Map.Entry entry : customFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { - throw new IllegalArgumentException( - "Custom field name must start with 'cf_': " + entry.getKey()); - } - this.customFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public CloseForInvoiceParams build() { - return new CloseForInvoiceParams(this); - } - } - - public static final class NotesToRemoveParams { - - private final EntityType entityType; - - private final String entityId; - - private NotesToRemoveParams(NotesToRemoveBuilder builder) { - - this.entityType = builder.entityType; - - this.entityId = builder.entityId; - } - - public EntityType getEntityType() { - return entityType; - } - - public String getEntityId() { - return entityId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.entityType != null) { - - formData.put("entity_type", this.entityType); - } - - if (this.entityId != null) { - - formData.put("entity_id", this.entityId); - } - - return formData; - } - - /** Create a new builder for NotesToRemoveParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static NotesToRemoveBuilder builder() { - return new NotesToRemoveBuilder(); - } - - public static final class NotesToRemoveBuilder { - - private EntityType entityType; - - private String entityId; - - private NotesToRemoveBuilder() {} - - public NotesToRemoveBuilder entityType(EntityType value) { - this.entityType = value; - return this; - } - - public NotesToRemoveBuilder entityId(String value) { - this.entityId = value; - return this; - } - - public NotesToRemoveParams build() { - return new NotesToRemoveParams(this); - } - } - - public enum EntityType { - CUSTOMER("customer"), - - SUBSCRIPTION("subscription"), - - COUPON("coupon"), - - PLAN_ITEM_PRICE("plan_item_price"), - - ADDON_ITEM_PRICE("addon_item_price"), - - CHARGE_ITEM_PRICE("charge_item_price"), - - PLAN("plan"), - - ADDON("addon"), - - /** An enum member indicating that EntityType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - EntityType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static EntityType fromString(String value) { - if (value == null) return _UNKNOWN; - for (EntityType enumValue : EntityType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/CollectPaymentForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/CollectPaymentForInvoiceParams.java deleted file mode 100644 index 38c04629..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/CollectPaymentForInvoiceParams.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class CollectPaymentForInvoiceParams { - - private final Long amount; - - private final String authorizationTransactionId; - - private final String paymentSourceId; - - private final String comment; - - private final PaymentInitiator paymentInitiator; - - private CollectPaymentForInvoiceParams(CollectPaymentForInvoiceBuilder builder) { - - this.amount = builder.amount; - - this.authorizationTransactionId = builder.authorizationTransactionId; - - this.paymentSourceId = builder.paymentSourceId; - - this.comment = builder.comment; - - this.paymentInitiator = builder.paymentInitiator; - } - - public Long getAmount() { - return amount; - } - - public String getAuthorizationTransactionId() { - return authorizationTransactionId; - } - - public String getPaymentSourceId() { - return paymentSourceId; - } - - public String getComment() { - return comment; - } - - public PaymentInitiator getPaymentInitiator() { - return paymentInitiator; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.authorizationTransactionId != null) { - - formData.put("authorization_transaction_id", this.authorizationTransactionId); - } - - if (this.paymentSourceId != null) { - - formData.put("payment_source_id", this.paymentSourceId); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.paymentInitiator != null) { - - formData.put("payment_initiator", this.paymentInitiator); - } - - return formData; - } - - /** Create a new builder for CollectPaymentForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CollectPaymentForInvoiceBuilder builder() { - return new CollectPaymentForInvoiceBuilder(); - } - - public static final class CollectPaymentForInvoiceBuilder { - - private Long amount; - - private String authorizationTransactionId; - - private String paymentSourceId; - - private String comment; - - private PaymentInitiator paymentInitiator; - - private CollectPaymentForInvoiceBuilder() {} - - public CollectPaymentForInvoiceBuilder amount(Long value) { - this.amount = value; - return this; - } - - public CollectPaymentForInvoiceBuilder authorizationTransactionId(String value) { - this.authorizationTransactionId = value; - return this; - } - - public CollectPaymentForInvoiceBuilder paymentSourceId(String value) { - this.paymentSourceId = value; - return this; - } - - public CollectPaymentForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public CollectPaymentForInvoiceBuilder paymentInitiator(PaymentInitiator value) { - this.paymentInitiator = value; - return this; - } - - public CollectPaymentForInvoiceParams build() { - return new CollectPaymentForInvoiceParams(this); - } - } - - public enum PaymentInitiator { - CUSTOMER("customer"), - - MERCHANT("merchant"), - - /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentInitiator(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentInitiator fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentInitiator enumValue : PaymentInitiator.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/DeleteImportedForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/DeleteImportedForInvoiceParams.java deleted file mode 100644 index 91aab25a..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/DeleteImportedForInvoiceParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteImportedForInvoiceParams { - - private final String comment; - - private DeleteImportedForInvoiceParams(DeleteImportedForInvoiceBuilder builder) { - - this.comment = builder.comment; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for DeleteImportedForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteImportedForInvoiceBuilder builder() { - return new DeleteImportedForInvoiceBuilder(); - } - - public static final class DeleteImportedForInvoiceBuilder { - - private String comment; - - private DeleteImportedForInvoiceBuilder() {} - - public DeleteImportedForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public DeleteImportedForInvoiceParams build() { - return new DeleteImportedForInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/DeleteInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/DeleteInvoiceParams.java deleted file mode 100644 index f85eb6bb..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/DeleteInvoiceParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteInvoiceParams { - - private final String comment; - - private DeleteInvoiceParams(DeleteInvoiceBuilder builder) { - - this.comment = builder.comment; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for DeleteInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteInvoiceBuilder builder() { - return new DeleteInvoiceBuilder(); - } - - public static final class DeleteInvoiceBuilder { - - private String comment; - - private DeleteInvoiceBuilder() {} - - public DeleteInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public DeleteInvoiceParams build() { - return new DeleteInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/DeleteLineItemsForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/DeleteLineItemsForInvoiceParams.java deleted file mode 100644 index ea38fafc..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/DeleteLineItemsForInvoiceParams.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class DeleteLineItemsForInvoiceParams { - - private final List lineItems; - - private DeleteLineItemsForInvoiceParams(DeleteLineItemsForInvoiceBuilder builder) { - - this.lineItems = builder.lineItems; - } - - public List getLineItems() { - return lineItems; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.lineItems != null) { - - // List of objects - for (int i = 0; i < this.lineItems.size(); i++) { - LineItemsParams item = this.lineItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "line_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for DeleteLineItemsForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteLineItemsForInvoiceBuilder builder() { - return new DeleteLineItemsForInvoiceBuilder(); - } - - public static final class DeleteLineItemsForInvoiceBuilder { - - private List lineItems; - - private DeleteLineItemsForInvoiceBuilder() {} - - public DeleteLineItemsForInvoiceBuilder lineItems(List value) { - this.lineItems = value; - return this; - } - - public DeleteLineItemsForInvoiceParams build() { - return new DeleteLineItemsForInvoiceParams(this); - } - } - - public static final class LineItemsParams { - - private final String id; - - private LineItemsParams(LineItemsBuilder builder) { - - this.id = builder.id; - } - - public String getId() { - return id; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - return formData; - } - - /** Create a new builder for LineItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static LineItemsBuilder builder() { - return new LineItemsBuilder(); - } - - public static final class LineItemsBuilder { - - private String id; - - private LineItemsBuilder() {} - - public LineItemsBuilder id(String value) { - this.id = value; - return this; - } - - public LineItemsParams build() { - return new LineItemsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/DownloadEinvoiceForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/DownloadEinvoiceForInvoiceParams.java deleted file mode 100644 index 7dfde169..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/DownloadEinvoiceForInvoiceParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DownloadEinvoiceForInvoiceParams { - - private final Map queryParams; - - private DownloadEinvoiceForInvoiceParams(DownloadEinvoiceForInvoiceBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public DownloadEinvoiceForInvoiceBuilder toBuilder() { - DownloadEinvoiceForInvoiceBuilder builder = new DownloadEinvoiceForInvoiceBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for DownloadEinvoiceForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DownloadEinvoiceForInvoiceBuilder builder() { - return new DownloadEinvoiceForInvoiceBuilder(); - } - - public static final class DownloadEinvoiceForInvoiceBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private DownloadEinvoiceForInvoiceBuilder() {} - - public DownloadEinvoiceForInvoiceParams build() { - return new DownloadEinvoiceForInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/DownloadEinvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/DownloadEinvoiceParams.java new file mode 100644 index 00000000..7a292799 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/DownloadEinvoiceParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class DownloadEinvoiceParams { + + private final Map queryParams; + + private DownloadEinvoiceParams(DownloadEinvoiceBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public DownloadEinvoiceBuilder toBuilder() { + DownloadEinvoiceBuilder builder = new DownloadEinvoiceBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for DownloadEinvoiceParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DownloadEinvoiceBuilder builder() { + return new DownloadEinvoiceBuilder(); + } + + public static final class DownloadEinvoiceBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private DownloadEinvoiceBuilder() {} + + public DownloadEinvoiceParams build() { + return new DownloadEinvoiceParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceAddAddonChargeParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceAddAddonChargeParams.java new file mode 100644 index 00000000..ad3b512d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceAddAddonChargeParams.java @@ -0,0 +1,274 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class InvoiceAddAddonChargeParams { + + private final String addonId; + + private final Integer addonQuantity; + + private final Long addonUnitPrice; + + private final String addonQuantityInDecimal; + + private final String addonUnitPriceInDecimal; + + private final String comment; + + private final String subscriptionId; + + private final LineItemParams lineItem; + + private InvoiceAddAddonChargeParams(InvoiceAddAddonChargeBuilder builder) { + + this.addonId = builder.addonId; + + this.addonQuantity = builder.addonQuantity; + + this.addonUnitPrice = builder.addonUnitPrice; + + this.addonQuantityInDecimal = builder.addonQuantityInDecimal; + + this.addonUnitPriceInDecimal = builder.addonUnitPriceInDecimal; + + this.comment = builder.comment; + + this.subscriptionId = builder.subscriptionId; + + this.lineItem = builder.lineItem; + } + + public String getAddonId() { + return addonId; + } + + public Integer getAddonQuantity() { + return addonQuantity; + } + + public Long getAddonUnitPrice() { + return addonUnitPrice; + } + + public String getAddonQuantityInDecimal() { + return addonQuantityInDecimal; + } + + public String getAddonUnitPriceInDecimal() { + return addonUnitPriceInDecimal; + } + + public String getComment() { + return comment; + } + + public String getSubscriptionId() { + return subscriptionId; + } + + public LineItemParams getLineItem() { + return lineItem; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.addonId != null) { + + formData.put("addon_id", this.addonId); + } + + if (this.addonQuantity != null) { + + formData.put("addon_quantity", this.addonQuantity); + } + + if (this.addonUnitPrice != null) { + + formData.put("addon_unit_price", this.addonUnitPrice); + } + + if (this.addonQuantityInDecimal != null) { + + formData.put("addon_quantity_in_decimal", this.addonQuantityInDecimal); + } + + if (this.addonUnitPriceInDecimal != null) { + + formData.put("addon_unit_price_in_decimal", this.addonUnitPriceInDecimal); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.subscriptionId != null) { + + formData.put("subscription_id", this.subscriptionId); + } + + if (this.lineItem != null) { + + // Single object + Map nestedData = this.lineItem.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "line_item[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InvoiceAddAddonChargeParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceAddAddonChargeBuilder builder() { + return new InvoiceAddAddonChargeBuilder(); + } + + public static final class InvoiceAddAddonChargeBuilder { + + private String addonId; + + private Integer addonQuantity; + + private Long addonUnitPrice; + + private String addonQuantityInDecimal; + + private String addonUnitPriceInDecimal; + + private String comment; + + private String subscriptionId; + + private LineItemParams lineItem; + + private InvoiceAddAddonChargeBuilder() {} + + public InvoiceAddAddonChargeBuilder addonId(String value) { + this.addonId = value; + return this; + } + + public InvoiceAddAddonChargeBuilder addonQuantity(Integer value) { + this.addonQuantity = value; + return this; + } + + public InvoiceAddAddonChargeBuilder addonUnitPrice(Long value) { + this.addonUnitPrice = value; + return this; + } + + public InvoiceAddAddonChargeBuilder addonQuantityInDecimal(String value) { + this.addonQuantityInDecimal = value; + return this; + } + + public InvoiceAddAddonChargeBuilder addonUnitPriceInDecimal(String value) { + this.addonUnitPriceInDecimal = value; + return this; + } + + public InvoiceAddAddonChargeBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceAddAddonChargeBuilder subscriptionId(String value) { + this.subscriptionId = value; + return this; + } + + public InvoiceAddAddonChargeBuilder lineItem(LineItemParams value) { + this.lineItem = value; + return this; + } + + public InvoiceAddAddonChargeParams build() { + return new InvoiceAddAddonChargeParams(this); + } + } + + public static final class LineItemParams { + + private final Timestamp dateFrom; + + private final Timestamp dateTo; + + private LineItemParams(LineItemBuilder builder) { + + this.dateFrom = builder.dateFrom; + + this.dateTo = builder.dateTo; + } + + public Timestamp getDateFrom() { + return dateFrom; + } + + public Timestamp getDateTo() { + return dateTo; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.dateFrom != null) { + + formData.put("date_from", this.dateFrom); + } + + if (this.dateTo != null) { + + formData.put("date_to", this.dateTo); + } + + return formData; + } + + /** Create a new builder for LineItemParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static LineItemBuilder builder() { + return new LineItemBuilder(); + } + + public static final class LineItemBuilder { + + private Timestamp dateFrom; + + private Timestamp dateTo; + + private LineItemBuilder() {} + + public LineItemBuilder dateFrom(Timestamp value) { + this.dateFrom = value; + return this; + } + + public LineItemBuilder dateTo(Timestamp value) { + this.dateTo = value; + return this; + } + + public LineItemParams build() { + return new LineItemParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceAddChargeItemParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceAddChargeItemParams.java new file mode 100644 index 00000000..52e72ed7 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceAddChargeItemParams.java @@ -0,0 +1,523 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class InvoiceAddChargeItemParams { + + private final String comment; + + private final String subscriptionId; + + private final ItemPriceParams itemPrice; + + private final List itemTiers; + + private InvoiceAddChargeItemParams(InvoiceAddChargeItemBuilder builder) { + + this.comment = builder.comment; + + this.subscriptionId = builder.subscriptionId; + + this.itemPrice = builder.itemPrice; + + this.itemTiers = builder.itemTiers; + } + + public String getComment() { + return comment; + } + + public String getSubscriptionId() { + return subscriptionId; + } + + public ItemPriceParams getItemPrice() { + return itemPrice; + } + + public List getItemTiers() { + return itemTiers; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.subscriptionId != null) { + + formData.put("subscription_id", this.subscriptionId); + } + + if (this.itemPrice != null) { + + // Single object + Map nestedData = this.itemPrice.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "item_price[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for InvoiceAddChargeItemParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceAddChargeItemBuilder builder() { + return new InvoiceAddChargeItemBuilder(); + } + + public static final class InvoiceAddChargeItemBuilder { + + private String comment; + + private String subscriptionId; + + private ItemPriceParams itemPrice; + + private List itemTiers; + + private InvoiceAddChargeItemBuilder() {} + + public InvoiceAddChargeItemBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceAddChargeItemBuilder subscriptionId(String value) { + this.subscriptionId = value; + return this; + } + + public InvoiceAddChargeItemBuilder itemPrice(ItemPriceParams value) { + this.itemPrice = value; + return this; + } + + public InvoiceAddChargeItemBuilder itemTiers(List value) { + this.itemTiers = value; + return this; + } + + public InvoiceAddChargeItemParams build() { + return new InvoiceAddChargeItemParams(this); + } + } + + public static final class ItemPriceParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Timestamp dateFrom; + + private final Timestamp dateTo; + + private ItemPriceParams(ItemPriceBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.dateFrom = builder.dateFrom; + + this.dateTo = builder.dateTo; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Timestamp getDateFrom() { + return dateFrom; + } + + public Timestamp getDateTo() { + return dateTo; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.dateFrom != null) { + + formData.put("date_from", this.dateFrom); + } + + if (this.dateTo != null) { + + formData.put("date_to", this.dateTo); + } + + return formData; + } + + /** Create a new builder for ItemPriceParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemPriceBuilder builder() { + return new ItemPriceBuilder(); + } + + public static final class ItemPriceBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Timestamp dateFrom; + + private Timestamp dateTo; + + private ItemPriceBuilder() {} + + public ItemPriceBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemPriceBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public ItemPriceBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public ItemPriceBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public ItemPriceBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public ItemPriceBuilder dateFrom(Timestamp value) { + this.dateFrom = value; + return this; + } + + public ItemPriceBuilder dateTo(Timestamp value) { + this.dateTo = value; + return this; + } + + public ItemPriceParams build() { + return new ItemPriceParams(this); + } + } + } + + public static final class ItemTiersParams { + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceAddChargeParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceAddChargeParams.java new file mode 100644 index 00000000..2900745d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceAddChargeParams.java @@ -0,0 +1,366 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class InvoiceAddChargeParams { + + private final Long amount; + + private final String description; + + private final AvalaraSaleType avalaraSaleType; + + private final Integer avalaraTransactionType; + + private final Integer avalaraServiceType; + + private final String avalaraTaxCode; + + private final String hsnCode; + + private final String taxjarProductCode; + + private final String comment; + + private final String subscriptionId; + + private final LineItemParams lineItem; + + private InvoiceAddChargeParams(InvoiceAddChargeBuilder builder) { + + this.amount = builder.amount; + + this.description = builder.description; + + this.avalaraSaleType = builder.avalaraSaleType; + + this.avalaraTransactionType = builder.avalaraTransactionType; + + this.avalaraServiceType = builder.avalaraServiceType; + + this.avalaraTaxCode = builder.avalaraTaxCode; + + this.hsnCode = builder.hsnCode; + + this.taxjarProductCode = builder.taxjarProductCode; + + this.comment = builder.comment; + + this.subscriptionId = builder.subscriptionId; + + this.lineItem = builder.lineItem; + } + + public Long getAmount() { + return amount; + } + + public String getDescription() { + return description; + } + + public AvalaraSaleType getAvalaraSaleType() { + return avalaraSaleType; + } + + public Integer getAvalaraTransactionType() { + return avalaraTransactionType; + } + + public Integer getAvalaraServiceType() { + return avalaraServiceType; + } + + public String getAvalaraTaxCode() { + return avalaraTaxCode; + } + + public String getHsnCode() { + return hsnCode; + } + + public String getTaxjarProductCode() { + return taxjarProductCode; + } + + public String getComment() { + return comment; + } + + public String getSubscriptionId() { + return subscriptionId; + } + + public LineItemParams getLineItem() { + return lineItem; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.avalaraSaleType != null) { + + formData.put("avalara_sale_type", this.avalaraSaleType); + } + + if (this.avalaraTransactionType != null) { + + formData.put("avalara_transaction_type", this.avalaraTransactionType); + } + + if (this.avalaraServiceType != null) { + + formData.put("avalara_service_type", this.avalaraServiceType); + } + + if (this.avalaraTaxCode != null) { + + formData.put("avalara_tax_code", this.avalaraTaxCode); + } + + if (this.hsnCode != null) { + + formData.put("hsn_code", this.hsnCode); + } + + if (this.taxjarProductCode != null) { + + formData.put("taxjar_product_code", this.taxjarProductCode); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.subscriptionId != null) { + + formData.put("subscription_id", this.subscriptionId); + } + + if (this.lineItem != null) { + + // Single object + Map nestedData = this.lineItem.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "line_item[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InvoiceAddChargeParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceAddChargeBuilder builder() { + return new InvoiceAddChargeBuilder(); + } + + public static final class InvoiceAddChargeBuilder { + + private Long amount; + + private String description; + + private AvalaraSaleType avalaraSaleType; + + private Integer avalaraTransactionType; + + private Integer avalaraServiceType; + + private String avalaraTaxCode; + + private String hsnCode; + + private String taxjarProductCode; + + private String comment; + + private String subscriptionId; + + private LineItemParams lineItem; + + private InvoiceAddChargeBuilder() {} + + public InvoiceAddChargeBuilder amount(Long value) { + this.amount = value; + return this; + } + + public InvoiceAddChargeBuilder description(String value) { + this.description = value; + return this; + } + + public InvoiceAddChargeBuilder avalaraSaleType(AvalaraSaleType value) { + this.avalaraSaleType = value; + return this; + } + + public InvoiceAddChargeBuilder avalaraTransactionType(Integer value) { + this.avalaraTransactionType = value; + return this; + } + + public InvoiceAddChargeBuilder avalaraServiceType(Integer value) { + this.avalaraServiceType = value; + return this; + } + + public InvoiceAddChargeBuilder avalaraTaxCode(String value) { + this.avalaraTaxCode = value; + return this; + } + + public InvoiceAddChargeBuilder hsnCode(String value) { + this.hsnCode = value; + return this; + } + + public InvoiceAddChargeBuilder taxjarProductCode(String value) { + this.taxjarProductCode = value; + return this; + } + + public InvoiceAddChargeBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceAddChargeBuilder subscriptionId(String value) { + this.subscriptionId = value; + return this; + } + + public InvoiceAddChargeBuilder lineItem(LineItemParams value) { + this.lineItem = value; + return this; + } + + public InvoiceAddChargeParams build() { + return new InvoiceAddChargeParams(this); + } + } + + public enum AvalaraSaleType { + WHOLESALE("wholesale"), + + RETAIL("retail"), + + CONSUMED("consumed"), + + VENDOR_USE("vendor_use"), + + /** An enum member indicating that AvalaraSaleType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AvalaraSaleType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AvalaraSaleType fromString(String value) { + if (value == null) return _UNKNOWN; + for (AvalaraSaleType enumValue : AvalaraSaleType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class LineItemParams { + + private final Timestamp dateFrom; + + private final Timestamp dateTo; + + private LineItemParams(LineItemBuilder builder) { + + this.dateFrom = builder.dateFrom; + + this.dateTo = builder.dateTo; + } + + public Timestamp getDateFrom() { + return dateFrom; + } + + public Timestamp getDateTo() { + return dateTo; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.dateFrom != null) { + + formData.put("date_from", this.dateFrom); + } + + if (this.dateTo != null) { + + formData.put("date_to", this.dateTo); + } + + return formData; + } + + /** Create a new builder for LineItemParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static LineItemBuilder builder() { + return new LineItemBuilder(); + } + + public static final class LineItemBuilder { + + private Timestamp dateFrom; + + private Timestamp dateTo; + + private LineItemBuilder() {} + + public LineItemBuilder dateFrom(Timestamp value) { + this.dateFrom = value; + return this; + } + + public LineItemBuilder dateTo(Timestamp value) { + this.dateTo = value; + return this; + } + + public LineItemParams build() { + return new LineItemParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceApplyCreditsParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceApplyCreditsParams.java new file mode 100644 index 00000000..61143c0b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceApplyCreditsParams.java @@ -0,0 +1,139 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class InvoiceApplyCreditsParams { + + private final String comment; + + private final List creditNotes; + + private InvoiceApplyCreditsParams(InvoiceApplyCreditsBuilder builder) { + + this.comment = builder.comment; + + this.creditNotes = builder.creditNotes; + } + + public String getComment() { + return comment; + } + + public List getCreditNotes() { + return creditNotes; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.creditNotes != null) { + + // List of objects + for (int i = 0; i < this.creditNotes.size(); i++) { + CreditNotesParams item = this.creditNotes.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "credit_notes[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for InvoiceApplyCreditsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceApplyCreditsBuilder builder() { + return new InvoiceApplyCreditsBuilder(); + } + + public static final class InvoiceApplyCreditsBuilder { + + private String comment; + + private List creditNotes; + + private InvoiceApplyCreditsBuilder() {} + + public InvoiceApplyCreditsBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceApplyCreditsBuilder creditNotes(List value) { + this.creditNotes = value; + return this; + } + + public InvoiceApplyCreditsParams build() { + return new InvoiceApplyCreditsParams(this); + } + } + + public static final class CreditNotesParams { + + private final String id; + + private CreditNotesParams(CreditNotesBuilder builder) { + + this.id = builder.id; + } + + public String getId() { + return id; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + return formData; + } + + /** Create a new builder for CreditNotesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNotesBuilder builder() { + return new CreditNotesBuilder(); + } + + public static final class CreditNotesBuilder { + + private String id; + + private CreditNotesBuilder() {} + + public CreditNotesBuilder id(String value) { + this.id = value; + return this; + } + + public CreditNotesParams build() { + return new CreditNotesParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceApplyPaymentScheduleSchemeParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceApplyPaymentScheduleSchemeParams.java new file mode 100644 index 00000000..9b4560bb --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceApplyPaymentScheduleSchemeParams.java @@ -0,0 +1,81 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceApplyPaymentScheduleSchemeParams { + + private final String schemeId; + + private final Long amount; + + private InvoiceApplyPaymentScheduleSchemeParams( + InvoiceApplyPaymentScheduleSchemeBuilder builder) { + + this.schemeId = builder.schemeId; + + this.amount = builder.amount; + } + + public String getSchemeId() { + return schemeId; + } + + public Long getAmount() { + return amount; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.schemeId != null) { + + formData.put("scheme_id", this.schemeId); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + return formData; + } + + /** Create a new builder for InvoiceApplyPaymentScheduleSchemeParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceApplyPaymentScheduleSchemeBuilder builder() { + return new InvoiceApplyPaymentScheduleSchemeBuilder(); + } + + public static final class InvoiceApplyPaymentScheduleSchemeBuilder { + + private String schemeId; + + private Long amount; + + private InvoiceApplyPaymentScheduleSchemeBuilder() {} + + public InvoiceApplyPaymentScheduleSchemeBuilder schemeId(String value) { + this.schemeId = value; + return this; + } + + public InvoiceApplyPaymentScheduleSchemeBuilder amount(Long value) { + this.amount = value; + return this; + } + + public InvoiceApplyPaymentScheduleSchemeParams build() { + return new InvoiceApplyPaymentScheduleSchemeParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceApplyPaymentsParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceApplyPaymentsParams.java new file mode 100644 index 00000000..7d14fe11 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceApplyPaymentsParams.java @@ -0,0 +1,159 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class InvoiceApplyPaymentsParams { + + private final String comment; + + private final List transactions; + + private InvoiceApplyPaymentsParams(InvoiceApplyPaymentsBuilder builder) { + + this.comment = builder.comment; + + this.transactions = builder.transactions; + } + + public String getComment() { + return comment; + } + + public List getTransactions() { + return transactions; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.transactions != null) { + + // List of objects + for (int i = 0; i < this.transactions.size(); i++) { + TransactionsParams item = this.transactions.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "transactions[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for InvoiceApplyPaymentsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceApplyPaymentsBuilder builder() { + return new InvoiceApplyPaymentsBuilder(); + } + + public static final class InvoiceApplyPaymentsBuilder { + + private String comment; + + private List transactions; + + private InvoiceApplyPaymentsBuilder() {} + + public InvoiceApplyPaymentsBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceApplyPaymentsBuilder transactions(List value) { + this.transactions = value; + return this; + } + + public InvoiceApplyPaymentsParams build() { + return new InvoiceApplyPaymentsParams(this); + } + } + + public static final class TransactionsParams { + + private final String id; + + private final Long amount; + + private TransactionsParams(TransactionsBuilder builder) { + + this.id = builder.id; + + this.amount = builder.amount; + } + + public String getId() { + return id; + } + + public Long getAmount() { + return amount; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + return formData; + } + + /** Create a new builder for TransactionsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TransactionsBuilder builder() { + return new TransactionsBuilder(); + } + + public static final class TransactionsBuilder { + + private String id; + + private Long amount; + + private TransactionsBuilder() {} + + public TransactionsBuilder id(String value) { + this.id = value; + return this; + } + + public TransactionsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public TransactionsParams build() { + return new TransactionsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCloseParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCloseParams.java new file mode 100644 index 00000000..b6daae6c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCloseParams.java @@ -0,0 +1,312 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class InvoiceCloseParams { + + private final String comment; + + private final String invoiceNote; + + private final Boolean removeGeneralNote; + + private final Timestamp invoiceDate; + + private final List notesToRemove; + + private final Map customFields; + + private InvoiceCloseParams(InvoiceCloseBuilder builder) { + + this.comment = builder.comment; + + this.invoiceNote = builder.invoiceNote; + + this.removeGeneralNote = builder.removeGeneralNote; + + this.invoiceDate = builder.invoiceDate; + + this.notesToRemove = builder.notesToRemove; + + this.customFields = + builder.customFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); + } + + public String getComment() { + return comment; + } + + public String getInvoiceNote() { + return invoiceNote; + } + + public Boolean getRemoveGeneralNote() { + return removeGeneralNote; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public List getNotesToRemove() { + return notesToRemove; + } + + public Map customFields() { + return customFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.invoiceNote != null) { + + formData.put("invoice_note", this.invoiceNote); + } + + if (this.removeGeneralNote != null) { + + formData.put("remove_general_note", this.removeGeneralNote); + } + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.notesToRemove != null) { + + // List of objects + for (int i = 0; i < this.notesToRemove.size(); i++) { + NotesToRemoveParams item = this.notesToRemove.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "notes_to_remove[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(customFields); + + return formData; + } + + /** Create a new builder for InvoiceCloseParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceCloseBuilder builder() { + return new InvoiceCloseBuilder(); + } + + public static final class InvoiceCloseBuilder { + + private String comment; + + private String invoiceNote; + + private Boolean removeGeneralNote; + + private Timestamp invoiceDate; + + private List notesToRemove; + + private Map customFields = new LinkedHashMap<>(); + + private InvoiceCloseBuilder() {} + + public InvoiceCloseBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceCloseBuilder invoiceNote(String value) { + this.invoiceNote = value; + return this; + } + + public InvoiceCloseBuilder removeGeneralNote(Boolean value) { + this.removeGeneralNote = value; + return this; + } + + public InvoiceCloseBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public InvoiceCloseBuilder notesToRemove(List value) { + this.notesToRemove = value; + return this; + } + + /** + * Add a custom field to the request. Custom fields must start with "cf_". + * + * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") + * @param value the value of the custom field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cf_" + */ + public InvoiceCloseBuilder customField(String fieldName, String value) { + if (fieldName == null || !fieldName.startsWith("cf_")) { + throw new IllegalArgumentException("Custom field name must start with 'cf_'"); + } + this.customFields.put(fieldName, value); + return this; + } + + /** + * Add multiple custom fields to the request. All field names must start with "cf_". + * + * @param customFields map of custom field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cf_" + */ + public InvoiceCloseBuilder customFields(Map customFields) { + if (customFields != null) { + for (Map.Entry entry : customFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { + throw new IllegalArgumentException( + "Custom field name must start with 'cf_': " + entry.getKey()); + } + this.customFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public InvoiceCloseParams build() { + return new InvoiceCloseParams(this); + } + } + + public static final class NotesToRemoveParams { + + private final EntityType entityType; + + private final String entityId; + + private NotesToRemoveParams(NotesToRemoveBuilder builder) { + + this.entityType = builder.entityType; + + this.entityId = builder.entityId; + } + + public EntityType getEntityType() { + return entityType; + } + + public String getEntityId() { + return entityId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.entityType != null) { + + formData.put("entity_type", this.entityType); + } + + if (this.entityId != null) { + + formData.put("entity_id", this.entityId); + } + + return formData; + } + + /** Create a new builder for NotesToRemoveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static NotesToRemoveBuilder builder() { + return new NotesToRemoveBuilder(); + } + + public static final class NotesToRemoveBuilder { + + private EntityType entityType; + + private String entityId; + + private NotesToRemoveBuilder() {} + + public NotesToRemoveBuilder entityType(EntityType value) { + this.entityType = value; + return this; + } + + public NotesToRemoveBuilder entityId(String value) { + this.entityId = value; + return this; + } + + public NotesToRemoveParams build() { + return new NotesToRemoveParams(this); + } + } + + public enum EntityType { + CUSTOMER("customer"), + + SUBSCRIPTION("subscription"), + + COUPON("coupon"), + + PLAN_ITEM_PRICE("plan_item_price"), + + ADDON_ITEM_PRICE("addon_item_price"), + + CHARGE_ITEM_PRICE("charge_item_price"), + + PLAN("plan"), + + ADDON("addon"), + + /** An enum member indicating that EntityType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + EntityType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EntityType fromString(String value) { + if (value == null) return _UNKNOWN; + for (EntityType enumValue : EntityType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCollectPaymentParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCollectPaymentParams.java new file mode 100644 index 00000000..5857c98f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCollectPaymentParams.java @@ -0,0 +1,168 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceCollectPaymentParams { + + private final Long amount; + + private final String authorizationTransactionId; + + private final String paymentSourceId; + + private final String comment; + + private final PaymentInitiator paymentInitiator; + + private InvoiceCollectPaymentParams(InvoiceCollectPaymentBuilder builder) { + + this.amount = builder.amount; + + this.authorizationTransactionId = builder.authorizationTransactionId; + + this.paymentSourceId = builder.paymentSourceId; + + this.comment = builder.comment; + + this.paymentInitiator = builder.paymentInitiator; + } + + public Long getAmount() { + return amount; + } + + public String getAuthorizationTransactionId() { + return authorizationTransactionId; + } + + public String getPaymentSourceId() { + return paymentSourceId; + } + + public String getComment() { + return comment; + } + + public PaymentInitiator getPaymentInitiator() { + return paymentInitiator; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.authorizationTransactionId != null) { + + formData.put("authorization_transaction_id", this.authorizationTransactionId); + } + + if (this.paymentSourceId != null) { + + formData.put("payment_source_id", this.paymentSourceId); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.paymentInitiator != null) { + + formData.put("payment_initiator", this.paymentInitiator); + } + + return formData; + } + + /** Create a new builder for InvoiceCollectPaymentParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceCollectPaymentBuilder builder() { + return new InvoiceCollectPaymentBuilder(); + } + + public static final class InvoiceCollectPaymentBuilder { + + private Long amount; + + private String authorizationTransactionId; + + private String paymentSourceId; + + private String comment; + + private PaymentInitiator paymentInitiator; + + private InvoiceCollectPaymentBuilder() {} + + public InvoiceCollectPaymentBuilder amount(Long value) { + this.amount = value; + return this; + } + + public InvoiceCollectPaymentBuilder authorizationTransactionId(String value) { + this.authorizationTransactionId = value; + return this; + } + + public InvoiceCollectPaymentBuilder paymentSourceId(String value) { + this.paymentSourceId = value; + return this; + } + + public InvoiceCollectPaymentBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceCollectPaymentBuilder paymentInitiator(PaymentInitiator value) { + this.paymentInitiator = value; + return this; + } + + public InvoiceCollectPaymentParams build() { + return new InvoiceCollectPaymentParams(this); + } + } + + public enum PaymentInitiator { + CUSTOMER("customer"), + + MERCHANT("merchant"), + + /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentInitiator(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentInitiator fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentInitiator enumValue : PaymentInitiator.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceDeleteImportedParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceDeleteImportedParams.java new file mode 100644 index 00000000..f8bef357 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceDeleteImportedParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceDeleteImportedParams { + + private final String comment; + + private InvoiceDeleteImportedParams(InvoiceDeleteImportedBuilder builder) { + + this.comment = builder.comment; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for InvoiceDeleteImportedParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceDeleteImportedBuilder builder() { + return new InvoiceDeleteImportedBuilder(); + } + + public static final class InvoiceDeleteImportedBuilder { + + private String comment; + + private InvoiceDeleteImportedBuilder() {} + + public InvoiceDeleteImportedBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceDeleteImportedParams build() { + return new InvoiceDeleteImportedParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceDeleteLineItemsParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceDeleteLineItemsParams.java new file mode 100644 index 00000000..1f0b0a44 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceDeleteLineItemsParams.java @@ -0,0 +1,119 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class InvoiceDeleteLineItemsParams { + + private final List lineItems; + + private InvoiceDeleteLineItemsParams(InvoiceDeleteLineItemsBuilder builder) { + + this.lineItems = builder.lineItems; + } + + public List getLineItems() { + return lineItems; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.lineItems != null) { + + // List of objects + for (int i = 0; i < this.lineItems.size(); i++) { + LineItemsParams item = this.lineItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "line_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for InvoiceDeleteLineItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceDeleteLineItemsBuilder builder() { + return new InvoiceDeleteLineItemsBuilder(); + } + + public static final class InvoiceDeleteLineItemsBuilder { + + private List lineItems; + + private InvoiceDeleteLineItemsBuilder() {} + + public InvoiceDeleteLineItemsBuilder lineItems(List value) { + this.lineItems = value; + return this; + } + + public InvoiceDeleteLineItemsParams build() { + return new InvoiceDeleteLineItemsParams(this); + } + } + + public static final class LineItemsParams { + + private final String id; + + private LineItemsParams(LineItemsBuilder builder) { + + this.id = builder.id; + } + + public String getId() { + return id; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + return formData; + } + + /** Create a new builder for LineItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static LineItemsBuilder builder() { + return new LineItemsBuilder(); + } + + public static final class LineItemsBuilder { + + private String id; + + private LineItemsBuilder() {} + + public LineItemsBuilder id(String value) { + this.id = value; + return this; + } + + public LineItemsParams build() { + return new LineItemsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceDeleteParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceDeleteParams.java new file mode 100644 index 00000000..a63a4abc --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceDeleteParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceDeleteParams { + + private final String comment; + + private InvoiceDeleteParams(InvoiceDeleteBuilder builder) { + + this.comment = builder.comment; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for InvoiceDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceDeleteBuilder builder() { + return new InvoiceDeleteBuilder(); + } + + public static final class InvoiceDeleteBuilder { + + private String comment; + + private InvoiceDeleteBuilder() {} + + public InvoiceDeleteBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceDeleteParams build() { + return new InvoiceDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoicePauseDunningParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoicePauseDunningParams.java new file mode 100644 index 00000000..969f6f05 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoicePauseDunningParams.java @@ -0,0 +1,81 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class InvoicePauseDunningParams { + + private final Timestamp expectedPaymentDate; + + private final String comment; + + private InvoicePauseDunningParams(InvoicePauseDunningBuilder builder) { + + this.expectedPaymentDate = builder.expectedPaymentDate; + + this.comment = builder.comment; + } + + public Timestamp getExpectedPaymentDate() { + return expectedPaymentDate; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.expectedPaymentDate != null) { + + formData.put("expected_payment_date", this.expectedPaymentDate); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for InvoicePauseDunningParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoicePauseDunningBuilder builder() { + return new InvoicePauseDunningBuilder(); + } + + public static final class InvoicePauseDunningBuilder { + + private Timestamp expectedPaymentDate; + + private String comment; + + private InvoicePauseDunningBuilder() {} + + public InvoicePauseDunningBuilder expectedPaymentDate(Timestamp value) { + this.expectedPaymentDate = value; + return this; + } + + public InvoicePauseDunningBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoicePauseDunningParams build() { + return new InvoicePauseDunningParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoicePaymentSchedulesParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoicePaymentSchedulesParams.java new file mode 100644 index 00000000..d669f9a4 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoicePaymentSchedulesParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoicePaymentSchedulesParams { + + private final Map queryParams; + + private InvoicePaymentSchedulesParams(InvoicePaymentSchedulesBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public InvoicePaymentSchedulesBuilder toBuilder() { + InvoicePaymentSchedulesBuilder builder = new InvoicePaymentSchedulesBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for InvoicePaymentSchedulesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoicePaymentSchedulesBuilder builder() { + return new InvoicePaymentSchedulesBuilder(); + } + + public static final class InvoicePaymentSchedulesBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private InvoicePaymentSchedulesBuilder() {} + + public InvoicePaymentSchedulesParams build() { + return new InvoicePaymentSchedulesParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoicePdfParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoicePdfParams.java new file mode 100644 index 00000000..0e871dee --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoicePdfParams.java @@ -0,0 +1,88 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoicePdfParams { + + private final DispositionType dispositionType; + + private InvoicePdfParams(InvoicePdfBuilder builder) { + + this.dispositionType = builder.dispositionType; + } + + public DispositionType getDispositionType() { + return dispositionType; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.dispositionType != null) { + + formData.put("disposition_type", this.dispositionType); + } + + return formData; + } + + /** Create a new builder for InvoicePdfParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoicePdfBuilder builder() { + return new InvoicePdfBuilder(); + } + + public static final class InvoicePdfBuilder { + + private DispositionType dispositionType; + + private InvoicePdfBuilder() {} + + public InvoicePdfBuilder dispositionType(DispositionType value) { + this.dispositionType = value; + return this; + } + + public InvoicePdfParams build() { + return new InvoicePdfParams(this); + } + } + + public enum DispositionType { + ATTACHMENT("attachment"), + + INLINE("inline"), + + /** An enum member indicating that DispositionType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DispositionType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DispositionType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DispositionType enumValue : DispositionType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordPaymentParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordPaymentParams.java new file mode 100644 index 00000000..abbcba9d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordPaymentParams.java @@ -0,0 +1,362 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class InvoiceRecordPaymentParams { + + private final String comment; + + private final TransactionParams transaction; + + private InvoiceRecordPaymentParams(InvoiceRecordPaymentBuilder builder) { + + this.comment = builder.comment; + + this.transaction = builder.transaction; + } + + public String getComment() { + return comment; + } + + public TransactionParams getTransaction() { + return transaction; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.transaction != null) { + + // Single object + Map nestedData = this.transaction.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "transaction[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InvoiceRecordPaymentParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceRecordPaymentBuilder builder() { + return new InvoiceRecordPaymentBuilder(); + } + + public static final class InvoiceRecordPaymentBuilder { + + private String comment; + + private TransactionParams transaction; + + private InvoiceRecordPaymentBuilder() {} + + public InvoiceRecordPaymentBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceRecordPaymentBuilder transaction(TransactionParams value) { + this.transaction = value; + return this; + } + + public InvoiceRecordPaymentParams build() { + return new InvoiceRecordPaymentParams(this); + } + } + + public static final class TransactionParams { + + private final Long amount; + + private final PaymentMethod paymentMethod; + + private final String referenceNumber; + + private final String customPaymentMethodId; + + private final String idAtGateway; + + private final Status status; + + private final Timestamp date; + + private final String errorCode; + + private final String errorText; + + private TransactionParams(TransactionBuilder builder) { + + this.amount = builder.amount; + + this.paymentMethod = builder.paymentMethod; + + this.referenceNumber = builder.referenceNumber; + + this.customPaymentMethodId = builder.customPaymentMethodId; + + this.idAtGateway = builder.idAtGateway; + + this.status = builder.status; + + this.date = builder.date; + + this.errorCode = builder.errorCode; + + this.errorText = builder.errorText; + } + + public Long getAmount() { + return amount; + } + + public PaymentMethod getPaymentMethod() { + return paymentMethod; + } + + public String getReferenceNumber() { + return referenceNumber; + } + + public String getCustomPaymentMethodId() { + return customPaymentMethodId; + } + + public String getIdAtGateway() { + return idAtGateway; + } + + public Status getStatus() { + return status; + } + + public Timestamp getDate() { + return date; + } + + public String getErrorCode() { + return errorCode; + } + + public String getErrorText() { + return errorText; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.paymentMethod != null) { + + formData.put("payment_method", this.paymentMethod); + } + + if (this.referenceNumber != null) { + + formData.put("reference_number", this.referenceNumber); + } + + if (this.customPaymentMethodId != null) { + + formData.put("custom_payment_method_id", this.customPaymentMethodId); + } + + if (this.idAtGateway != null) { + + formData.put("id_at_gateway", this.idAtGateway); + } + + if (this.status != null) { + + formData.put("status", this.status); + } + + if (this.date != null) { + + formData.put("date", this.date); + } + + if (this.errorCode != null) { + + formData.put("error_code", this.errorCode); + } + + if (this.errorText != null) { + + formData.put("error_text", this.errorText); + } + + return formData; + } + + /** Create a new builder for TransactionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TransactionBuilder builder() { + return new TransactionBuilder(); + } + + public static final class TransactionBuilder { + + private Long amount; + + private PaymentMethod paymentMethod; + + private String referenceNumber; + + private String customPaymentMethodId; + + private String idAtGateway; + + private Status status; + + private Timestamp date; + + private String errorCode; + + private String errorText; + + private TransactionBuilder() {} + + public TransactionBuilder amount(Long value) { + this.amount = value; + return this; + } + + public TransactionBuilder paymentMethod(PaymentMethod value) { + this.paymentMethod = value; + return this; + } + + public TransactionBuilder referenceNumber(String value) { + this.referenceNumber = value; + return this; + } + + public TransactionBuilder customPaymentMethodId(String value) { + this.customPaymentMethodId = value; + return this; + } + + public TransactionBuilder idAtGateway(String value) { + this.idAtGateway = value; + return this; + } + + public TransactionBuilder status(Status value) { + this.status = value; + return this; + } + + public TransactionBuilder date(Timestamp value) { + this.date = value; + return this; + } + + public TransactionBuilder errorCode(String value) { + this.errorCode = value; + return this; + } + + public TransactionBuilder errorText(String value) { + this.errorText = value; + return this; + } + + public TransactionParams build() { + return new TransactionParams(this); + } + } + + public enum PaymentMethod { + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + OTHER("other"), + + APP_STORE("app_store"), + + PLAY_STORE("play_store"), + + CUSTOM("custom"), + + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethod enumValue : PaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum Status { + SUCCESS("success"), + + FAILURE("failure"), + + LATE_FAILURE("late_failure"), + + /** An enum member indicating that Status was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Status(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Status fromString(String value) { + if (value == null) return _UNKNOWN; + for (Status enumValue : Status.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordRefundParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordRefundParams.java new file mode 100644 index 00000000..bcfab083 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordRefundParams.java @@ -0,0 +1,405 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class InvoiceRecordRefundParams { + + private final String comment; + + private final String customerNotes; + + private final TransactionParams transaction; + + private final CreditNoteParams creditNote; + + private InvoiceRecordRefundParams(InvoiceRecordRefundBuilder builder) { + + this.comment = builder.comment; + + this.customerNotes = builder.customerNotes; + + this.transaction = builder.transaction; + + this.creditNote = builder.creditNote; + } + + public String getComment() { + return comment; + } + + public String getCustomerNotes() { + return customerNotes; + } + + public TransactionParams getTransaction() { + return transaction; + } + + public CreditNoteParams getCreditNote() { + return creditNote; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.customerNotes != null) { + + formData.put("customer_notes", this.customerNotes); + } + + if (this.transaction != null) { + + // Single object + Map nestedData = this.transaction.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "transaction[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.creditNote != null) { + + // Single object + Map nestedData = this.creditNote.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "credit_note[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InvoiceRecordRefundParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceRecordRefundBuilder builder() { + return new InvoiceRecordRefundBuilder(); + } + + public static final class InvoiceRecordRefundBuilder { + + private String comment; + + private String customerNotes; + + private TransactionParams transaction; + + private CreditNoteParams creditNote; + + private InvoiceRecordRefundBuilder() {} + + public InvoiceRecordRefundBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceRecordRefundBuilder customerNotes(String value) { + this.customerNotes = value; + return this; + } + + public InvoiceRecordRefundBuilder transaction(TransactionParams value) { + this.transaction = value; + return this; + } + + public InvoiceRecordRefundBuilder creditNote(CreditNoteParams value) { + this.creditNote = value; + return this; + } + + public InvoiceRecordRefundParams build() { + return new InvoiceRecordRefundParams(this); + } + } + + public static final class TransactionParams { + + private final Long amount; + + private final PaymentMethod paymentMethod; + + private final String referenceNumber; + + private final String customPaymentMethodId; + + private final Timestamp date; + + private TransactionParams(TransactionBuilder builder) { + + this.amount = builder.amount; + + this.paymentMethod = builder.paymentMethod; + + this.referenceNumber = builder.referenceNumber; + + this.customPaymentMethodId = builder.customPaymentMethodId; + + this.date = builder.date; + } + + public Long getAmount() { + return amount; + } + + public PaymentMethod getPaymentMethod() { + return paymentMethod; + } + + public String getReferenceNumber() { + return referenceNumber; + } + + public String getCustomPaymentMethodId() { + return customPaymentMethodId; + } + + public Timestamp getDate() { + return date; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.paymentMethod != null) { + + formData.put("payment_method", this.paymentMethod); + } + + if (this.referenceNumber != null) { + + formData.put("reference_number", this.referenceNumber); + } + + if (this.customPaymentMethodId != null) { + + formData.put("custom_payment_method_id", this.customPaymentMethodId); + } + + if (this.date != null) { + + formData.put("date", this.date); + } + + return formData; + } + + /** Create a new builder for TransactionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TransactionBuilder builder() { + return new TransactionBuilder(); + } + + public static final class TransactionBuilder { + + private Long amount; + + private PaymentMethod paymentMethod; + + private String referenceNumber; + + private String customPaymentMethodId; + + private Timestamp date; + + private TransactionBuilder() {} + + public TransactionBuilder amount(Long value) { + this.amount = value; + return this; + } + + public TransactionBuilder paymentMethod(PaymentMethod value) { + this.paymentMethod = value; + return this; + } + + public TransactionBuilder referenceNumber(String value) { + this.referenceNumber = value; + return this; + } + + public TransactionBuilder customPaymentMethodId(String value) { + this.customPaymentMethodId = value; + return this; + } + + public TransactionBuilder date(Timestamp value) { + this.date = value; + return this; + } + + public TransactionParams build() { + return new TransactionParams(this); + } + } + + public enum PaymentMethod { + CASH("cash"), + + CHECK("check"), + + CHARGEBACK("chargeback"), + + BANK_TRANSFER("bank_transfer"), + + OTHER("other"), + + APP_STORE("app_store"), + + PLAY_STORE("play_store"), + + CUSTOM("custom"), + + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethod enumValue : PaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CreditNoteParams { + + private final ReasonCode reasonCode; + + private final String createReasonCode; + + private CreditNoteParams(CreditNoteBuilder builder) { + + this.reasonCode = builder.reasonCode; + + this.createReasonCode = builder.createReasonCode; + } + + public ReasonCode getReasonCode() { + return reasonCode; + } + + public String getCreateReasonCode() { + return createReasonCode; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.reasonCode != null) { + + formData.put("reason_code", this.reasonCode); + } + + if (this.createReasonCode != null) { + + formData.put("create_reason_code", this.createReasonCode); + } + + return formData; + } + + /** Create a new builder for CreditNoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteBuilder builder() { + return new CreditNoteBuilder(); + } + + public static final class CreditNoteBuilder { + + private ReasonCode reasonCode; + + private String createReasonCode; + + private CreditNoteBuilder() {} + + public CreditNoteBuilder reasonCode(ReasonCode value) { + this.reasonCode = value; + return this; + } + + public CreditNoteBuilder createReasonCode(String value) { + this.createReasonCode = value; + return this; + } + + public CreditNoteParams build() { + return new CreditNoteParams(this); + } + } + + public enum ReasonCode { + CHARGEBACK("chargeback"), + + PRODUCT_UNSATISFACTORY("product_unsatisfactory"), + + SERVICE_UNSATISFACTORY("service_unsatisfactory"), + + ORDER_CHANGE("order_change"), + + ORDER_CANCELLATION("order_cancellation"), + + WAIVER("waiver"), + + OTHER("other"), + + /** An enum member indicating that ReasonCode was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ReasonCode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ReasonCode fromString(String value) { + if (value == null) return _UNKNOWN; + for (ReasonCode enumValue : ReasonCode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordTaxWithheldParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordTaxWithheldParams.java new file mode 100644 index 00000000..8442d77b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordTaxWithheldParams.java @@ -0,0 +1,174 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class InvoiceRecordTaxWithheldParams { + + private final TaxWithheldParams taxWithheld; + + private InvoiceRecordTaxWithheldParams(InvoiceRecordTaxWithheldBuilder builder) { + + this.taxWithheld = builder.taxWithheld; + } + + public TaxWithheldParams getTaxWithheld() { + return taxWithheld; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.taxWithheld != null) { + + // Single object + Map nestedData = this.taxWithheld.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "tax_withheld[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InvoiceRecordTaxWithheldParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceRecordTaxWithheldBuilder builder() { + return new InvoiceRecordTaxWithheldBuilder(); + } + + public static final class InvoiceRecordTaxWithheldBuilder { + + private TaxWithheldParams taxWithheld; + + private InvoiceRecordTaxWithheldBuilder() {} + + public InvoiceRecordTaxWithheldBuilder taxWithheld(TaxWithheldParams value) { + this.taxWithheld = value; + return this; + } + + public InvoiceRecordTaxWithheldParams build() { + return new InvoiceRecordTaxWithheldParams(this); + } + } + + public static final class TaxWithheldParams { + + private final Long amount; + + private final String referenceNumber; + + private final Timestamp date; + + private final String description; + + private TaxWithheldParams(TaxWithheldBuilder builder) { + + this.amount = builder.amount; + + this.referenceNumber = builder.referenceNumber; + + this.date = builder.date; + + this.description = builder.description; + } + + public Long getAmount() { + return amount; + } + + public String getReferenceNumber() { + return referenceNumber; + } + + public Timestamp getDate() { + return date; + } + + public String getDescription() { + return description; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.referenceNumber != null) { + + formData.put("reference_number", this.referenceNumber); + } + + if (this.date != null) { + + formData.put("date", this.date); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + return formData; + } + + /** Create a new builder for TaxWithheldParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TaxWithheldBuilder builder() { + return new TaxWithheldBuilder(); + } + + public static final class TaxWithheldBuilder { + + private Long amount; + + private String referenceNumber; + + private Timestamp date; + + private String description; + + private TaxWithheldBuilder() {} + + public TaxWithheldBuilder amount(Long value) { + this.amount = value; + return this; + } + + public TaxWithheldBuilder referenceNumber(String value) { + this.referenceNumber = value; + return this; + } + + public TaxWithheldBuilder date(Timestamp value) { + this.date = value; + return this; + } + + public TaxWithheldBuilder description(String value) { + this.description = value; + return this; + } + + public TaxWithheldParams build() { + return new TaxWithheldParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRefundParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRefundParams.java new file mode 100644 index 00000000..1b0e90a3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRefundParams.java @@ -0,0 +1,229 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceRefundParams { + + private final Long refundAmount; + + private final String comment; + + private final String customerNotes; + + private final CreditNoteParams creditNote; + + private InvoiceRefundParams(InvoiceRefundBuilder builder) { + + this.refundAmount = builder.refundAmount; + + this.comment = builder.comment; + + this.customerNotes = builder.customerNotes; + + this.creditNote = builder.creditNote; + } + + public Long getRefundAmount() { + return refundAmount; + } + + public String getComment() { + return comment; + } + + public String getCustomerNotes() { + return customerNotes; + } + + public CreditNoteParams getCreditNote() { + return creditNote; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.refundAmount != null) { + + formData.put("refund_amount", this.refundAmount); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.customerNotes != null) { + + formData.put("customer_notes", this.customerNotes); + } + + if (this.creditNote != null) { + + // Single object + Map nestedData = this.creditNote.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "credit_note[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InvoiceRefundParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceRefundBuilder builder() { + return new InvoiceRefundBuilder(); + } + + public static final class InvoiceRefundBuilder { + + private Long refundAmount; + + private String comment; + + private String customerNotes; + + private CreditNoteParams creditNote; + + private InvoiceRefundBuilder() {} + + public InvoiceRefundBuilder refundAmount(Long value) { + this.refundAmount = value; + return this; + } + + public InvoiceRefundBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceRefundBuilder customerNotes(String value) { + this.customerNotes = value; + return this; + } + + public InvoiceRefundBuilder creditNote(CreditNoteParams value) { + this.creditNote = value; + return this; + } + + public InvoiceRefundParams build() { + return new InvoiceRefundParams(this); + } + } + + public static final class CreditNoteParams { + + private final ReasonCode reasonCode; + + private final String createReasonCode; + + private CreditNoteParams(CreditNoteBuilder builder) { + + this.reasonCode = builder.reasonCode; + + this.createReasonCode = builder.createReasonCode; + } + + public ReasonCode getReasonCode() { + return reasonCode; + } + + public String getCreateReasonCode() { + return createReasonCode; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.reasonCode != null) { + + formData.put("reason_code", this.reasonCode); + } + + if (this.createReasonCode != null) { + + formData.put("create_reason_code", this.createReasonCode); + } + + return formData; + } + + /** Create a new builder for CreditNoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteBuilder builder() { + return new CreditNoteBuilder(); + } + + public static final class CreditNoteBuilder { + + private ReasonCode reasonCode; + + private String createReasonCode; + + private CreditNoteBuilder() {} + + public CreditNoteBuilder reasonCode(ReasonCode value) { + this.reasonCode = value; + return this; + } + + public CreditNoteBuilder createReasonCode(String value) { + this.createReasonCode = value; + return this; + } + + public CreditNoteParams build() { + return new CreditNoteParams(this); + } + } + + public enum ReasonCode { + PRODUCT_UNSATISFACTORY("product_unsatisfactory"), + + SERVICE_UNSATISFACTORY("service_unsatisfactory"), + + ORDER_CHANGE("order_change"), + + ORDER_CANCELLATION("order_cancellation"), + + WAIVER("waiver"), + + OTHER("other"), + + /** An enum member indicating that ReasonCode was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ReasonCode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ReasonCode fromString(String value) { + if (value == null) return _UNKNOWN; + for (ReasonCode enumValue : ReasonCode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRemoveCreditNoteParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRemoveCreditNoteParams.java new file mode 100644 index 00000000..38bb283c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRemoveCreditNoteParams.java @@ -0,0 +1,113 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceRemoveCreditNoteParams { + + private final CreditNoteParams creditNote; + + private InvoiceRemoveCreditNoteParams(InvoiceRemoveCreditNoteBuilder builder) { + + this.creditNote = builder.creditNote; + } + + public CreditNoteParams getCreditNote() { + return creditNote; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.creditNote != null) { + + // Single object + Map nestedData = this.creditNote.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "credit_note[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InvoiceRemoveCreditNoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceRemoveCreditNoteBuilder builder() { + return new InvoiceRemoveCreditNoteBuilder(); + } + + public static final class InvoiceRemoveCreditNoteBuilder { + + private CreditNoteParams creditNote; + + private InvoiceRemoveCreditNoteBuilder() {} + + public InvoiceRemoveCreditNoteBuilder creditNote(CreditNoteParams value) { + this.creditNote = value; + return this; + } + + public InvoiceRemoveCreditNoteParams build() { + return new InvoiceRemoveCreditNoteParams(this); + } + } + + public static final class CreditNoteParams { + + private final String id; + + private CreditNoteParams(CreditNoteBuilder builder) { + + this.id = builder.id; + } + + public String getId() { + return id; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + return formData; + } + + /** Create a new builder for CreditNoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteBuilder builder() { + return new CreditNoteBuilder(); + } + + public static final class CreditNoteBuilder { + + private String id; + + private CreditNoteBuilder() {} + + public CreditNoteBuilder id(String value) { + this.id = value; + return this; + } + + public CreditNoteParams build() { + return new CreditNoteParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRemovePaymentParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRemovePaymentParams.java new file mode 100644 index 00000000..cd2c257f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRemovePaymentParams.java @@ -0,0 +1,113 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceRemovePaymentParams { + + private final TransactionParams transaction; + + private InvoiceRemovePaymentParams(InvoiceRemovePaymentBuilder builder) { + + this.transaction = builder.transaction; + } + + public TransactionParams getTransaction() { + return transaction; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.transaction != null) { + + // Single object + Map nestedData = this.transaction.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "transaction[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InvoiceRemovePaymentParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceRemovePaymentBuilder builder() { + return new InvoiceRemovePaymentBuilder(); + } + + public static final class InvoiceRemovePaymentBuilder { + + private TransactionParams transaction; + + private InvoiceRemovePaymentBuilder() {} + + public InvoiceRemovePaymentBuilder transaction(TransactionParams value) { + this.transaction = value; + return this; + } + + public InvoiceRemovePaymentParams build() { + return new InvoiceRemovePaymentParams(this); + } + } + + public static final class TransactionParams { + + private final String id; + + private TransactionParams(TransactionBuilder builder) { + + this.id = builder.id; + } + + public String getId() { + return id; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + return formData; + } + + /** Create a new builder for TransactionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TransactionBuilder builder() { + return new TransactionBuilder(); + } + + public static final class TransactionBuilder { + + private String id; + + private TransactionBuilder() {} + + public TransactionBuilder id(String value) { + this.id = value; + return this; + } + + public TransactionParams build() { + return new TransactionParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRemoveTaxWithheldParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRemoveTaxWithheldParams.java new file mode 100644 index 00000000..e02606a0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRemoveTaxWithheldParams.java @@ -0,0 +1,113 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceRemoveTaxWithheldParams { + + private final TaxWithheldParams taxWithheld; + + private InvoiceRemoveTaxWithheldParams(InvoiceRemoveTaxWithheldBuilder builder) { + + this.taxWithheld = builder.taxWithheld; + } + + public TaxWithheldParams getTaxWithheld() { + return taxWithheld; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.taxWithheld != null) { + + // Single object + Map nestedData = this.taxWithheld.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "tax_withheld[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for InvoiceRemoveTaxWithheldParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceRemoveTaxWithheldBuilder builder() { + return new InvoiceRemoveTaxWithheldBuilder(); + } + + public static final class InvoiceRemoveTaxWithheldBuilder { + + private TaxWithheldParams taxWithheld; + + private InvoiceRemoveTaxWithheldBuilder() {} + + public InvoiceRemoveTaxWithheldBuilder taxWithheld(TaxWithheldParams value) { + this.taxWithheld = value; + return this; + } + + public InvoiceRemoveTaxWithheldParams build() { + return new InvoiceRemoveTaxWithheldParams(this); + } + } + + public static final class TaxWithheldParams { + + private final String id; + + private TaxWithheldParams(TaxWithheldBuilder builder) { + + this.id = builder.id; + } + + public String getId() { + return id; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + return formData; + } + + /** Create a new builder for TaxWithheldParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TaxWithheldBuilder builder() { + return new TaxWithheldBuilder(); + } + + public static final class TaxWithheldBuilder { + + private String id; + + private TaxWithheldBuilder() {} + + public TaxWithheldBuilder id(String value) { + this.id = value; + return this; + } + + public TaxWithheldParams build() { + return new TaxWithheldParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceResumeDunningParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceResumeDunningParams.java new file mode 100644 index 00000000..70f24cb9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceResumeDunningParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceResumeDunningParams { + + private final String comment; + + private InvoiceResumeDunningParams(InvoiceResumeDunningBuilder builder) { + + this.comment = builder.comment; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for InvoiceResumeDunningParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceResumeDunningBuilder builder() { + return new InvoiceResumeDunningBuilder(); + } + + public static final class InvoiceResumeDunningBuilder { + + private String comment; + + private InvoiceResumeDunningBuilder() {} + + public InvoiceResumeDunningBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceResumeDunningParams build() { + return new InvoiceResumeDunningParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceStopDunningParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceStopDunningParams.java new file mode 100644 index 00000000..4476eed6 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceStopDunningParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceStopDunningParams { + + private final String comment; + + private InvoiceStopDunningParams(InvoiceStopDunningBuilder builder) { + + this.comment = builder.comment; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for InvoiceStopDunningParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceStopDunningBuilder builder() { + return new InvoiceStopDunningBuilder(); + } + + public static final class InvoiceStopDunningBuilder { + + private String comment; + + private InvoiceStopDunningBuilder() {} + + public InvoiceStopDunningBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceStopDunningParams build() { + return new InvoiceStopDunningParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceSyncUsagesParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceSyncUsagesParams.java new file mode 100644 index 00000000..021fca06 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceSyncUsagesParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceSyncUsagesParams { + + private InvoiceSyncUsagesParams(InvoiceSyncUsagesBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for InvoiceSyncUsagesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceSyncUsagesBuilder builder() { + return new InvoiceSyncUsagesBuilder(); + } + + public static final class InvoiceSyncUsagesBuilder { + + private InvoiceSyncUsagesBuilder() {} + + public InvoiceSyncUsagesParams build() { + return new InvoiceSyncUsagesParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceUpdateDetailsParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceUpdateDetailsParams.java new file mode 100644 index 00000000..e5ee0b0e --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceUpdateDetailsParams.java @@ -0,0 +1,975 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceUpdateDetailsParams { + + private final String vatNumber; + + private final String vatNumberPrefix; + + private final String poNumber; + + private final String comment; + + private final BillingAddressParams billingAddress; + + private final ShippingAddressParams shippingAddress; + + private final StatementDescriptorParams statementDescriptor; + + private final Map customFields; + + private InvoiceUpdateDetailsParams(InvoiceUpdateDetailsBuilder builder) { + + this.vatNumber = builder.vatNumber; + + this.vatNumberPrefix = builder.vatNumberPrefix; + + this.poNumber = builder.poNumber; + + this.comment = builder.comment; + + this.billingAddress = builder.billingAddress; + + this.shippingAddress = builder.shippingAddress; + + this.statementDescriptor = builder.statementDescriptor; + + this.customFields = + builder.customFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); + } + + public String getVatNumber() { + return vatNumber; + } + + public String getVatNumberPrefix() { + return vatNumberPrefix; + } + + public String getPoNumber() { + return poNumber; + } + + public String getComment() { + return comment; + } + + public BillingAddressParams getBillingAddress() { + return billingAddress; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public StatementDescriptorParams getStatementDescriptor() { + return statementDescriptor; + } + + public Map customFields() { + return customFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.vatNumber != null) { + + formData.put("vat_number", this.vatNumber); + } + + if (this.vatNumberPrefix != null) { + + formData.put("vat_number_prefix", this.vatNumberPrefix); + } + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.billingAddress != null) { + + // Single object + Map nestedData = this.billingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.statementDescriptor != null) { + + // Single object + Map nestedData = this.statementDescriptor.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "statement_descriptor[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + formData.putAll(customFields); + + return formData; + } + + /** Create a new builder for InvoiceUpdateDetailsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceUpdateDetailsBuilder builder() { + return new InvoiceUpdateDetailsBuilder(); + } + + public static final class InvoiceUpdateDetailsBuilder { + + private String vatNumber; + + private String vatNumberPrefix; + + private String poNumber; + + private String comment; + + private BillingAddressParams billingAddress; + + private ShippingAddressParams shippingAddress; + + private StatementDescriptorParams statementDescriptor; + + private Map customFields = new LinkedHashMap<>(); + + private InvoiceUpdateDetailsBuilder() {} + + public InvoiceUpdateDetailsBuilder vatNumber(String value) { + this.vatNumber = value; + return this; + } + + public InvoiceUpdateDetailsBuilder vatNumberPrefix(String value) { + this.vatNumberPrefix = value; + return this; + } + + public InvoiceUpdateDetailsBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public InvoiceUpdateDetailsBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceUpdateDetailsBuilder billingAddress(BillingAddressParams value) { + this.billingAddress = value; + return this; + } + + public InvoiceUpdateDetailsBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public InvoiceUpdateDetailsBuilder statementDescriptor(StatementDescriptorParams value) { + this.statementDescriptor = value; + return this; + } + + /** + * Add a custom field to the request. Custom fields must start with "cf_". + * + * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") + * @param value the value of the custom field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cf_" + */ + public InvoiceUpdateDetailsBuilder customField(String fieldName, String value) { + if (fieldName == null || !fieldName.startsWith("cf_")) { + throw new IllegalArgumentException("Custom field name must start with 'cf_'"); + } + this.customFields.put(fieldName, value); + return this; + } + + /** + * Add multiple custom fields to the request. All field names must start with "cf_". + * + * @param customFields map of custom field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cf_" + */ + public InvoiceUpdateDetailsBuilder customFields(Map customFields) { + if (customFields != null) { + for (Map.Entry entry : customFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { + throw new IllegalArgumentException( + "Custom field name must start with 'cf_': " + entry.getKey()); + } + this.customFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public InvoiceUpdateDetailsParams build() { + return new InvoiceUpdateDetailsParams(this); + } + } + + public static final class BillingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private BillingAddressParams(BillingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for BillingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingAddressBuilder builder() { + return new BillingAddressBuilder(); + } + + public static final class BillingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private BillingAddressBuilder() {} + + public BillingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public BillingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public BillingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public BillingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public BillingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public BillingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public BillingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public BillingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public BillingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public BillingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public BillingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public BillingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public BillingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public BillingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public BillingAddressParams build() { + return new BillingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class StatementDescriptorParams { + + private final String descriptor; + + private StatementDescriptorParams(StatementDescriptorBuilder builder) { + + this.descriptor = builder.descriptor; + } + + public String getDescriptor() { + return descriptor; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.descriptor != null) { + + formData.put("descriptor", this.descriptor); + } + + return formData; + } + + /** Create a new builder for StatementDescriptorParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static StatementDescriptorBuilder builder() { + return new StatementDescriptorBuilder(); + } + + public static final class StatementDescriptorBuilder { + + private String descriptor; + + private StatementDescriptorBuilder() {} + + public StatementDescriptorBuilder descriptor(String value) { + this.descriptor = value; + return this; + } + + public StatementDescriptorParams build() { + return new StatementDescriptorParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceWriteOffParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceWriteOffParams.java new file mode 100644 index 00000000..caaba092 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceWriteOffParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class InvoiceWriteOffParams { + + private final String comment; + + private InvoiceWriteOffParams(InvoiceWriteOffBuilder builder) { + + this.comment = builder.comment; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for InvoiceWriteOffParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static InvoiceWriteOffBuilder builder() { + return new InvoiceWriteOffBuilder(); + } + + public static final class InvoiceWriteOffBuilder { + + private String comment; + + private InvoiceWriteOffBuilder() {} + + public InvoiceWriteOffBuilder comment(String value) { + this.comment = value; + return this; + } + + public InvoiceWriteOffParams build() { + return new InvoiceWriteOffParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/PauseDunningForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/PauseDunningForInvoiceParams.java deleted file mode 100644 index b58fe79e..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/PauseDunningForInvoiceParams.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class PauseDunningForInvoiceParams { - - private final Timestamp expectedPaymentDate; - - private final String comment; - - private PauseDunningForInvoiceParams(PauseDunningForInvoiceBuilder builder) { - - this.expectedPaymentDate = builder.expectedPaymentDate; - - this.comment = builder.comment; - } - - public Timestamp getExpectedPaymentDate() { - return expectedPaymentDate; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.expectedPaymentDate != null) { - - formData.put("expected_payment_date", this.expectedPaymentDate); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for PauseDunningForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PauseDunningForInvoiceBuilder builder() { - return new PauseDunningForInvoiceBuilder(); - } - - public static final class PauseDunningForInvoiceBuilder { - - private Timestamp expectedPaymentDate; - - private String comment; - - private PauseDunningForInvoiceBuilder() {} - - public PauseDunningForInvoiceBuilder expectedPaymentDate(Timestamp value) { - this.expectedPaymentDate = value; - return this; - } - - public PauseDunningForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public PauseDunningForInvoiceParams build() { - return new PauseDunningForInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/PaymentSchedulesForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/PaymentSchedulesForInvoiceParams.java deleted file mode 100644 index 320b7b38..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/PaymentSchedulesForInvoiceParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class PaymentSchedulesForInvoiceParams { - - private final Map queryParams; - - private PaymentSchedulesForInvoiceParams(PaymentSchedulesForInvoiceBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public PaymentSchedulesForInvoiceBuilder toBuilder() { - PaymentSchedulesForInvoiceBuilder builder = new PaymentSchedulesForInvoiceBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for PaymentSchedulesForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PaymentSchedulesForInvoiceBuilder builder() { - return new PaymentSchedulesForInvoiceBuilder(); - } - - public static final class PaymentSchedulesForInvoiceBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private PaymentSchedulesForInvoiceBuilder() {} - - public PaymentSchedulesForInvoiceParams build() { - return new PaymentSchedulesForInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/PdfForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/PdfForInvoiceParams.java deleted file mode 100644 index cbf59925..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/PdfForInvoiceParams.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class PdfForInvoiceParams { - - private final DispositionType dispositionType; - - private PdfForInvoiceParams(PdfForInvoiceBuilder builder) { - - this.dispositionType = builder.dispositionType; - } - - public DispositionType getDispositionType() { - return dispositionType; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.dispositionType != null) { - - formData.put("disposition_type", this.dispositionType); - } - - return formData; - } - - /** Create a new builder for PdfForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PdfForInvoiceBuilder builder() { - return new PdfForInvoiceBuilder(); - } - - public static final class PdfForInvoiceBuilder { - - private DispositionType dispositionType; - - private PdfForInvoiceBuilder() {} - - public PdfForInvoiceBuilder dispositionType(DispositionType value) { - this.dispositionType = value; - return this; - } - - public PdfForInvoiceParams build() { - return new PdfForInvoiceParams(this); - } - } - - public enum DispositionType { - ATTACHMENT("attachment"), - - INLINE("inline"), - - /** An enum member indicating that DispositionType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DispositionType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DispositionType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DispositionType enumValue : DispositionType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/RecordPaymentForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/RecordPaymentForInvoiceParams.java deleted file mode 100644 index 8c5f6f2e..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/RecordPaymentForInvoiceParams.java +++ /dev/null @@ -1,362 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class RecordPaymentForInvoiceParams { - - private final String comment; - - private final TransactionParams transaction; - - private RecordPaymentForInvoiceParams(RecordPaymentForInvoiceBuilder builder) { - - this.comment = builder.comment; - - this.transaction = builder.transaction; - } - - public String getComment() { - return comment; - } - - public TransactionParams getTransaction() { - return transaction; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.transaction != null) { - - // Single object - Map nestedData = this.transaction.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "transaction[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for RecordPaymentForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RecordPaymentForInvoiceBuilder builder() { - return new RecordPaymentForInvoiceBuilder(); - } - - public static final class RecordPaymentForInvoiceBuilder { - - private String comment; - - private TransactionParams transaction; - - private RecordPaymentForInvoiceBuilder() {} - - public RecordPaymentForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public RecordPaymentForInvoiceBuilder transaction(TransactionParams value) { - this.transaction = value; - return this; - } - - public RecordPaymentForInvoiceParams build() { - return new RecordPaymentForInvoiceParams(this); - } - } - - public static final class TransactionParams { - - private final Long amount; - - private final PaymentMethod paymentMethod; - - private final String referenceNumber; - - private final String customPaymentMethodId; - - private final String idAtGateway; - - private final Status status; - - private final Timestamp date; - - private final String errorCode; - - private final String errorText; - - private TransactionParams(TransactionBuilder builder) { - - this.amount = builder.amount; - - this.paymentMethod = builder.paymentMethod; - - this.referenceNumber = builder.referenceNumber; - - this.customPaymentMethodId = builder.customPaymentMethodId; - - this.idAtGateway = builder.idAtGateway; - - this.status = builder.status; - - this.date = builder.date; - - this.errorCode = builder.errorCode; - - this.errorText = builder.errorText; - } - - public Long getAmount() { - return amount; - } - - public PaymentMethod getPaymentMethod() { - return paymentMethod; - } - - public String getReferenceNumber() { - return referenceNumber; - } - - public String getCustomPaymentMethodId() { - return customPaymentMethodId; - } - - public String getIdAtGateway() { - return idAtGateway; - } - - public Status getStatus() { - return status; - } - - public Timestamp getDate() { - return date; - } - - public String getErrorCode() { - return errorCode; - } - - public String getErrorText() { - return errorText; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.paymentMethod != null) { - - formData.put("payment_method", this.paymentMethod); - } - - if (this.referenceNumber != null) { - - formData.put("reference_number", this.referenceNumber); - } - - if (this.customPaymentMethodId != null) { - - formData.put("custom_payment_method_id", this.customPaymentMethodId); - } - - if (this.idAtGateway != null) { - - formData.put("id_at_gateway", this.idAtGateway); - } - - if (this.status != null) { - - formData.put("status", this.status); - } - - if (this.date != null) { - - formData.put("date", this.date); - } - - if (this.errorCode != null) { - - formData.put("error_code", this.errorCode); - } - - if (this.errorText != null) { - - formData.put("error_text", this.errorText); - } - - return formData; - } - - /** Create a new builder for TransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TransactionBuilder builder() { - return new TransactionBuilder(); - } - - public static final class TransactionBuilder { - - private Long amount; - - private PaymentMethod paymentMethod; - - private String referenceNumber; - - private String customPaymentMethodId; - - private String idAtGateway; - - private Status status; - - private Timestamp date; - - private String errorCode; - - private String errorText; - - private TransactionBuilder() {} - - public TransactionBuilder amount(Long value) { - this.amount = value; - return this; - } - - public TransactionBuilder paymentMethod(PaymentMethod value) { - this.paymentMethod = value; - return this; - } - - public TransactionBuilder referenceNumber(String value) { - this.referenceNumber = value; - return this; - } - - public TransactionBuilder customPaymentMethodId(String value) { - this.customPaymentMethodId = value; - return this; - } - - public TransactionBuilder idAtGateway(String value) { - this.idAtGateway = value; - return this; - } - - public TransactionBuilder status(Status value) { - this.status = value; - return this; - } - - public TransactionBuilder date(Timestamp value) { - this.date = value; - return this; - } - - public TransactionBuilder errorCode(String value) { - this.errorCode = value; - return this; - } - - public TransactionBuilder errorText(String value) { - this.errorText = value; - return this; - } - - public TransactionParams build() { - return new TransactionParams(this); - } - } - - public enum PaymentMethod { - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - OTHER("other"), - - APP_STORE("app_store"), - - PLAY_STORE("play_store"), - - CUSTOM("custom"), - - /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethod enumValue : PaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum Status { - SUCCESS("success"), - - FAILURE("failure"), - - LATE_FAILURE("late_failure"), - - /** An enum member indicating that Status was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Status(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Status fromString(String value) { - if (value == null) return _UNKNOWN; - for (Status enumValue : Status.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/RecordRefundForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/RecordRefundForInvoiceParams.java deleted file mode 100644 index 77fb81b8..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/RecordRefundForInvoiceParams.java +++ /dev/null @@ -1,405 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class RecordRefundForInvoiceParams { - - private final String comment; - - private final String customerNotes; - - private final TransactionParams transaction; - - private final CreditNoteParams creditNote; - - private RecordRefundForInvoiceParams(RecordRefundForInvoiceBuilder builder) { - - this.comment = builder.comment; - - this.customerNotes = builder.customerNotes; - - this.transaction = builder.transaction; - - this.creditNote = builder.creditNote; - } - - public String getComment() { - return comment; - } - - public String getCustomerNotes() { - return customerNotes; - } - - public TransactionParams getTransaction() { - return transaction; - } - - public CreditNoteParams getCreditNote() { - return creditNote; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.customerNotes != null) { - - formData.put("customer_notes", this.customerNotes); - } - - if (this.transaction != null) { - - // Single object - Map nestedData = this.transaction.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "transaction[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.creditNote != null) { - - // Single object - Map nestedData = this.creditNote.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "credit_note[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for RecordRefundForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RecordRefundForInvoiceBuilder builder() { - return new RecordRefundForInvoiceBuilder(); - } - - public static final class RecordRefundForInvoiceBuilder { - - private String comment; - - private String customerNotes; - - private TransactionParams transaction; - - private CreditNoteParams creditNote; - - private RecordRefundForInvoiceBuilder() {} - - public RecordRefundForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public RecordRefundForInvoiceBuilder customerNotes(String value) { - this.customerNotes = value; - return this; - } - - public RecordRefundForInvoiceBuilder transaction(TransactionParams value) { - this.transaction = value; - return this; - } - - public RecordRefundForInvoiceBuilder creditNote(CreditNoteParams value) { - this.creditNote = value; - return this; - } - - public RecordRefundForInvoiceParams build() { - return new RecordRefundForInvoiceParams(this); - } - } - - public static final class TransactionParams { - - private final Long amount; - - private final PaymentMethod paymentMethod; - - private final String referenceNumber; - - private final String customPaymentMethodId; - - private final Timestamp date; - - private TransactionParams(TransactionBuilder builder) { - - this.amount = builder.amount; - - this.paymentMethod = builder.paymentMethod; - - this.referenceNumber = builder.referenceNumber; - - this.customPaymentMethodId = builder.customPaymentMethodId; - - this.date = builder.date; - } - - public Long getAmount() { - return amount; - } - - public PaymentMethod getPaymentMethod() { - return paymentMethod; - } - - public String getReferenceNumber() { - return referenceNumber; - } - - public String getCustomPaymentMethodId() { - return customPaymentMethodId; - } - - public Timestamp getDate() { - return date; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.paymentMethod != null) { - - formData.put("payment_method", this.paymentMethod); - } - - if (this.referenceNumber != null) { - - formData.put("reference_number", this.referenceNumber); - } - - if (this.customPaymentMethodId != null) { - - formData.put("custom_payment_method_id", this.customPaymentMethodId); - } - - if (this.date != null) { - - formData.put("date", this.date); - } - - return formData; - } - - /** Create a new builder for TransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TransactionBuilder builder() { - return new TransactionBuilder(); - } - - public static final class TransactionBuilder { - - private Long amount; - - private PaymentMethod paymentMethod; - - private String referenceNumber; - - private String customPaymentMethodId; - - private Timestamp date; - - private TransactionBuilder() {} - - public TransactionBuilder amount(Long value) { - this.amount = value; - return this; - } - - public TransactionBuilder paymentMethod(PaymentMethod value) { - this.paymentMethod = value; - return this; - } - - public TransactionBuilder referenceNumber(String value) { - this.referenceNumber = value; - return this; - } - - public TransactionBuilder customPaymentMethodId(String value) { - this.customPaymentMethodId = value; - return this; - } - - public TransactionBuilder date(Timestamp value) { - this.date = value; - return this; - } - - public TransactionParams build() { - return new TransactionParams(this); - } - } - - public enum PaymentMethod { - CASH("cash"), - - CHECK("check"), - - CHARGEBACK("chargeback"), - - BANK_TRANSFER("bank_transfer"), - - OTHER("other"), - - APP_STORE("app_store"), - - PLAY_STORE("play_store"), - - CUSTOM("custom"), - - /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethod enumValue : PaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CreditNoteParams { - - private final ReasonCode reasonCode; - - private final String createReasonCode; - - private CreditNoteParams(CreditNoteBuilder builder) { - - this.reasonCode = builder.reasonCode; - - this.createReasonCode = builder.createReasonCode; - } - - public ReasonCode getReasonCode() { - return reasonCode; - } - - public String getCreateReasonCode() { - return createReasonCode; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.reasonCode != null) { - - formData.put("reason_code", this.reasonCode); - } - - if (this.createReasonCode != null) { - - formData.put("create_reason_code", this.createReasonCode); - } - - return formData; - } - - /** Create a new builder for CreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreditNoteBuilder builder() { - return new CreditNoteBuilder(); - } - - public static final class CreditNoteBuilder { - - private ReasonCode reasonCode; - - private String createReasonCode; - - private CreditNoteBuilder() {} - - public CreditNoteBuilder reasonCode(ReasonCode value) { - this.reasonCode = value; - return this; - } - - public CreditNoteBuilder createReasonCode(String value) { - this.createReasonCode = value; - return this; - } - - public CreditNoteParams build() { - return new CreditNoteParams(this); - } - } - - public enum ReasonCode { - CHARGEBACK("chargeback"), - - PRODUCT_UNSATISFACTORY("product_unsatisfactory"), - - SERVICE_UNSATISFACTORY("service_unsatisfactory"), - - ORDER_CHANGE("order_change"), - - ORDER_CANCELLATION("order_cancellation"), - - WAIVER("waiver"), - - OTHER("other"), - - /** An enum member indicating that ReasonCode was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ReasonCode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ReasonCode fromString(String value) { - if (value == null) return _UNKNOWN; - for (ReasonCode enumValue : ReasonCode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/RecordTaxWithheldForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/RecordTaxWithheldForInvoiceParams.java deleted file mode 100644 index c1bf24c7..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/RecordTaxWithheldForInvoiceParams.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class RecordTaxWithheldForInvoiceParams { - - private final TaxWithheldParams taxWithheld; - - private RecordTaxWithheldForInvoiceParams(RecordTaxWithheldForInvoiceBuilder builder) { - - this.taxWithheld = builder.taxWithheld; - } - - public TaxWithheldParams getTaxWithheld() { - return taxWithheld; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.taxWithheld != null) { - - // Single object - Map nestedData = this.taxWithheld.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "tax_withheld[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for RecordTaxWithheldForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RecordTaxWithheldForInvoiceBuilder builder() { - return new RecordTaxWithheldForInvoiceBuilder(); - } - - public static final class RecordTaxWithheldForInvoiceBuilder { - - private TaxWithheldParams taxWithheld; - - private RecordTaxWithheldForInvoiceBuilder() {} - - public RecordTaxWithheldForInvoiceBuilder taxWithheld(TaxWithheldParams value) { - this.taxWithheld = value; - return this; - } - - public RecordTaxWithheldForInvoiceParams build() { - return new RecordTaxWithheldForInvoiceParams(this); - } - } - - public static final class TaxWithheldParams { - - private final Long amount; - - private final String referenceNumber; - - private final Timestamp date; - - private final String description; - - private TaxWithheldParams(TaxWithheldBuilder builder) { - - this.amount = builder.amount; - - this.referenceNumber = builder.referenceNumber; - - this.date = builder.date; - - this.description = builder.description; - } - - public Long getAmount() { - return amount; - } - - public String getReferenceNumber() { - return referenceNumber; - } - - public Timestamp getDate() { - return date; - } - - public String getDescription() { - return description; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.referenceNumber != null) { - - formData.put("reference_number", this.referenceNumber); - } - - if (this.date != null) { - - formData.put("date", this.date); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - return formData; - } - - /** Create a new builder for TaxWithheldParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TaxWithheldBuilder builder() { - return new TaxWithheldBuilder(); - } - - public static final class TaxWithheldBuilder { - - private Long amount; - - private String referenceNumber; - - private Timestamp date; - - private String description; - - private TaxWithheldBuilder() {} - - public TaxWithheldBuilder amount(Long value) { - this.amount = value; - return this; - } - - public TaxWithheldBuilder referenceNumber(String value) { - this.referenceNumber = value; - return this; - } - - public TaxWithheldBuilder date(Timestamp value) { - this.date = value; - return this; - } - - public TaxWithheldBuilder description(String value) { - this.description = value; - return this; - } - - public TaxWithheldParams build() { - return new TaxWithheldParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/RefundForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/RefundForInvoiceParams.java deleted file mode 100644 index b634f7e8..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/RefundForInvoiceParams.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RefundForInvoiceParams { - - private final Long refundAmount; - - private final String comment; - - private final String customerNotes; - - private final CreditNoteParams creditNote; - - private RefundForInvoiceParams(RefundForInvoiceBuilder builder) { - - this.refundAmount = builder.refundAmount; - - this.comment = builder.comment; - - this.customerNotes = builder.customerNotes; - - this.creditNote = builder.creditNote; - } - - public Long getRefundAmount() { - return refundAmount; - } - - public String getComment() { - return comment; - } - - public String getCustomerNotes() { - return customerNotes; - } - - public CreditNoteParams getCreditNote() { - return creditNote; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.refundAmount != null) { - - formData.put("refund_amount", this.refundAmount); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.customerNotes != null) { - - formData.put("customer_notes", this.customerNotes); - } - - if (this.creditNote != null) { - - // Single object - Map nestedData = this.creditNote.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "credit_note[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for RefundForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RefundForInvoiceBuilder builder() { - return new RefundForInvoiceBuilder(); - } - - public static final class RefundForInvoiceBuilder { - - private Long refundAmount; - - private String comment; - - private String customerNotes; - - private CreditNoteParams creditNote; - - private RefundForInvoiceBuilder() {} - - public RefundForInvoiceBuilder refundAmount(Long value) { - this.refundAmount = value; - return this; - } - - public RefundForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public RefundForInvoiceBuilder customerNotes(String value) { - this.customerNotes = value; - return this; - } - - public RefundForInvoiceBuilder creditNote(CreditNoteParams value) { - this.creditNote = value; - return this; - } - - public RefundForInvoiceParams build() { - return new RefundForInvoiceParams(this); - } - } - - public static final class CreditNoteParams { - - private final ReasonCode reasonCode; - - private final String createReasonCode; - - private CreditNoteParams(CreditNoteBuilder builder) { - - this.reasonCode = builder.reasonCode; - - this.createReasonCode = builder.createReasonCode; - } - - public ReasonCode getReasonCode() { - return reasonCode; - } - - public String getCreateReasonCode() { - return createReasonCode; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.reasonCode != null) { - - formData.put("reason_code", this.reasonCode); - } - - if (this.createReasonCode != null) { - - formData.put("create_reason_code", this.createReasonCode); - } - - return formData; - } - - /** Create a new builder for CreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreditNoteBuilder builder() { - return new CreditNoteBuilder(); - } - - public static final class CreditNoteBuilder { - - private ReasonCode reasonCode; - - private String createReasonCode; - - private CreditNoteBuilder() {} - - public CreditNoteBuilder reasonCode(ReasonCode value) { - this.reasonCode = value; - return this; - } - - public CreditNoteBuilder createReasonCode(String value) { - this.createReasonCode = value; - return this; - } - - public CreditNoteParams build() { - return new CreditNoteParams(this); - } - } - - public enum ReasonCode { - PRODUCT_UNSATISFACTORY("product_unsatisfactory"), - - SERVICE_UNSATISFACTORY("service_unsatisfactory"), - - ORDER_CHANGE("order_change"), - - ORDER_CANCELLATION("order_cancellation"), - - WAIVER("waiver"), - - OTHER("other"), - - /** An enum member indicating that ReasonCode was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ReasonCode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ReasonCode fromString(String value) { - if (value == null) return _UNKNOWN; - for (ReasonCode enumValue : ReasonCode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/RemoveCreditNoteForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/RemoveCreditNoteForInvoiceParams.java deleted file mode 100644 index 9427b786..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/RemoveCreditNoteForInvoiceParams.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RemoveCreditNoteForInvoiceParams { - - private final CreditNoteParams creditNote; - - private RemoveCreditNoteForInvoiceParams(RemoveCreditNoteForInvoiceBuilder builder) { - - this.creditNote = builder.creditNote; - } - - public CreditNoteParams getCreditNote() { - return creditNote; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.creditNote != null) { - - // Single object - Map nestedData = this.creditNote.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "credit_note[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for RemoveCreditNoteForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RemoveCreditNoteForInvoiceBuilder builder() { - return new RemoveCreditNoteForInvoiceBuilder(); - } - - public static final class RemoveCreditNoteForInvoiceBuilder { - - private CreditNoteParams creditNote; - - private RemoveCreditNoteForInvoiceBuilder() {} - - public RemoveCreditNoteForInvoiceBuilder creditNote(CreditNoteParams value) { - this.creditNote = value; - return this; - } - - public RemoveCreditNoteForInvoiceParams build() { - return new RemoveCreditNoteForInvoiceParams(this); - } - } - - public static final class CreditNoteParams { - - private final String id; - - private CreditNoteParams(CreditNoteBuilder builder) { - - this.id = builder.id; - } - - public String getId() { - return id; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - return formData; - } - - /** Create a new builder for CreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreditNoteBuilder builder() { - return new CreditNoteBuilder(); - } - - public static final class CreditNoteBuilder { - - private String id; - - private CreditNoteBuilder() {} - - public CreditNoteBuilder id(String value) { - this.id = value; - return this; - } - - public CreditNoteParams build() { - return new CreditNoteParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/RemovePaymentForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/RemovePaymentForInvoiceParams.java deleted file mode 100644 index 63a77e83..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/RemovePaymentForInvoiceParams.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RemovePaymentForInvoiceParams { - - private final TransactionParams transaction; - - private RemovePaymentForInvoiceParams(RemovePaymentForInvoiceBuilder builder) { - - this.transaction = builder.transaction; - } - - public TransactionParams getTransaction() { - return transaction; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.transaction != null) { - - // Single object - Map nestedData = this.transaction.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "transaction[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for RemovePaymentForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RemovePaymentForInvoiceBuilder builder() { - return new RemovePaymentForInvoiceBuilder(); - } - - public static final class RemovePaymentForInvoiceBuilder { - - private TransactionParams transaction; - - private RemovePaymentForInvoiceBuilder() {} - - public RemovePaymentForInvoiceBuilder transaction(TransactionParams value) { - this.transaction = value; - return this; - } - - public RemovePaymentForInvoiceParams build() { - return new RemovePaymentForInvoiceParams(this); - } - } - - public static final class TransactionParams { - - private final String id; - - private TransactionParams(TransactionBuilder builder) { - - this.id = builder.id; - } - - public String getId() { - return id; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - return formData; - } - - /** Create a new builder for TransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TransactionBuilder builder() { - return new TransactionBuilder(); - } - - public static final class TransactionBuilder { - - private String id; - - private TransactionBuilder() {} - - public TransactionBuilder id(String value) { - this.id = value; - return this; - } - - public TransactionParams build() { - return new TransactionParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/RemoveTaxWithheldForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/RemoveTaxWithheldForInvoiceParams.java deleted file mode 100644 index 68a6a752..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/RemoveTaxWithheldForInvoiceParams.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RemoveTaxWithheldForInvoiceParams { - - private final TaxWithheldParams taxWithheld; - - private RemoveTaxWithheldForInvoiceParams(RemoveTaxWithheldForInvoiceBuilder builder) { - - this.taxWithheld = builder.taxWithheld; - } - - public TaxWithheldParams getTaxWithheld() { - return taxWithheld; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.taxWithheld != null) { - - // Single object - Map nestedData = this.taxWithheld.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "tax_withheld[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for RemoveTaxWithheldForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RemoveTaxWithheldForInvoiceBuilder builder() { - return new RemoveTaxWithheldForInvoiceBuilder(); - } - - public static final class RemoveTaxWithheldForInvoiceBuilder { - - private TaxWithheldParams taxWithheld; - - private RemoveTaxWithheldForInvoiceBuilder() {} - - public RemoveTaxWithheldForInvoiceBuilder taxWithheld(TaxWithheldParams value) { - this.taxWithheld = value; - return this; - } - - public RemoveTaxWithheldForInvoiceParams build() { - return new RemoveTaxWithheldForInvoiceParams(this); - } - } - - public static final class TaxWithheldParams { - - private final String id; - - private TaxWithheldParams(TaxWithheldBuilder builder) { - - this.id = builder.id; - } - - public String getId() { - return id; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - return formData; - } - - /** Create a new builder for TaxWithheldParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TaxWithheldBuilder builder() { - return new TaxWithheldBuilder(); - } - - public static final class TaxWithheldBuilder { - - private String id; - - private TaxWithheldBuilder() {} - - public TaxWithheldBuilder id(String value) { - this.id = value; - return this; - } - - public TaxWithheldParams build() { - return new TaxWithheldParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/ResendEinvoiceForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/ResendEinvoiceForInvoiceParams.java deleted file mode 100644 index 59aa91b2..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/ResendEinvoiceForInvoiceParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ResendEinvoiceForInvoiceParams { - - private ResendEinvoiceForInvoiceParams(ResendEinvoiceForInvoiceBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for ResendEinvoiceForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ResendEinvoiceForInvoiceBuilder builder() { - return new ResendEinvoiceForInvoiceBuilder(); - } - - public static final class ResendEinvoiceForInvoiceBuilder { - - private ResendEinvoiceForInvoiceBuilder() {} - - public ResendEinvoiceForInvoiceParams build() { - return new ResendEinvoiceForInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/ResendEinvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/ResendEinvoiceParams.java new file mode 100644 index 00000000..06a68200 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/ResendEinvoiceParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ResendEinvoiceParams { + + private ResendEinvoiceParams(ResendEinvoiceBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for ResendEinvoiceParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ResendEinvoiceBuilder builder() { + return new ResendEinvoiceBuilder(); + } + + public static final class ResendEinvoiceBuilder { + + private ResendEinvoiceBuilder() {} + + public ResendEinvoiceParams build() { + return new ResendEinvoiceParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/ResumeDunningForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/ResumeDunningForInvoiceParams.java deleted file mode 100644 index 5a6b9a7e..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/ResumeDunningForInvoiceParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ResumeDunningForInvoiceParams { - - private final String comment; - - private ResumeDunningForInvoiceParams(ResumeDunningForInvoiceBuilder builder) { - - this.comment = builder.comment; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for ResumeDunningForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ResumeDunningForInvoiceBuilder builder() { - return new ResumeDunningForInvoiceBuilder(); - } - - public static final class ResumeDunningForInvoiceBuilder { - - private String comment; - - private ResumeDunningForInvoiceBuilder() {} - - public ResumeDunningForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public ResumeDunningForInvoiceParams build() { - return new ResumeDunningForInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/SendEinvoiceForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/SendEinvoiceForInvoiceParams.java deleted file mode 100644 index 97c2d23e..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/SendEinvoiceForInvoiceParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class SendEinvoiceForInvoiceParams { - - private SendEinvoiceForInvoiceParams(SendEinvoiceForInvoiceBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for SendEinvoiceForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SendEinvoiceForInvoiceBuilder builder() { - return new SendEinvoiceForInvoiceBuilder(); - } - - public static final class SendEinvoiceForInvoiceBuilder { - - private SendEinvoiceForInvoiceBuilder() {} - - public SendEinvoiceForInvoiceParams build() { - return new SendEinvoiceForInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/SendEinvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/SendEinvoiceParams.java new file mode 100644 index 00000000..91b74384 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/params/SendEinvoiceParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.invoice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SendEinvoiceParams { + + private SendEinvoiceParams(SendEinvoiceBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for SendEinvoiceParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SendEinvoiceBuilder builder() { + return new SendEinvoiceBuilder(); + } + + public static final class SendEinvoiceBuilder { + + private SendEinvoiceBuilder() {} + + public SendEinvoiceParams build() { + return new SendEinvoiceParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/StopDunningForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/StopDunningForInvoiceParams.java deleted file mode 100644 index e0e16a6a..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/StopDunningForInvoiceParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class StopDunningForInvoiceParams { - - private final String comment; - - private StopDunningForInvoiceParams(StopDunningForInvoiceBuilder builder) { - - this.comment = builder.comment; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for StopDunningForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static StopDunningForInvoiceBuilder builder() { - return new StopDunningForInvoiceBuilder(); - } - - public static final class StopDunningForInvoiceBuilder { - - private String comment; - - private StopDunningForInvoiceBuilder() {} - - public StopDunningForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public StopDunningForInvoiceParams build() { - return new StopDunningForInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/SyncUsagesForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/SyncUsagesForInvoiceParams.java deleted file mode 100644 index 41baac99..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/SyncUsagesForInvoiceParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class SyncUsagesForInvoiceParams { - - private SyncUsagesForInvoiceParams(SyncUsagesForInvoiceBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for SyncUsagesForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SyncUsagesForInvoiceBuilder builder() { - return new SyncUsagesForInvoiceBuilder(); - } - - public static final class SyncUsagesForInvoiceBuilder { - - private SyncUsagesForInvoiceBuilder() {} - - public SyncUsagesForInvoiceParams build() { - return new SyncUsagesForInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/UpdateDetailsForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/UpdateDetailsForInvoiceParams.java deleted file mode 100644 index 445000ef..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/UpdateDetailsForInvoiceParams.java +++ /dev/null @@ -1,975 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UpdateDetailsForInvoiceParams { - - private final String vatNumber; - - private final String vatNumberPrefix; - - private final String poNumber; - - private final String comment; - - private final BillingAddressParams billingAddress; - - private final ShippingAddressParams shippingAddress; - - private final StatementDescriptorParams statementDescriptor; - - private final Map customFields; - - private UpdateDetailsForInvoiceParams(UpdateDetailsForInvoiceBuilder builder) { - - this.vatNumber = builder.vatNumber; - - this.vatNumberPrefix = builder.vatNumberPrefix; - - this.poNumber = builder.poNumber; - - this.comment = builder.comment; - - this.billingAddress = builder.billingAddress; - - this.shippingAddress = builder.shippingAddress; - - this.statementDescriptor = builder.statementDescriptor; - - this.customFields = - builder.customFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); - } - - public String getVatNumber() { - return vatNumber; - } - - public String getVatNumberPrefix() { - return vatNumberPrefix; - } - - public String getPoNumber() { - return poNumber; - } - - public String getComment() { - return comment; - } - - public BillingAddressParams getBillingAddress() { - return billingAddress; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public StatementDescriptorParams getStatementDescriptor() { - return statementDescriptor; - } - - public Map customFields() { - return customFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.vatNumber != null) { - - formData.put("vat_number", this.vatNumber); - } - - if (this.vatNumberPrefix != null) { - - formData.put("vat_number_prefix", this.vatNumberPrefix); - } - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.billingAddress != null) { - - // Single object - Map nestedData = this.billingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.statementDescriptor != null) { - - // Single object - Map nestedData = this.statementDescriptor.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "statement_descriptor[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - formData.putAll(customFields); - - return formData; - } - - /** Create a new builder for UpdateDetailsForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateDetailsForInvoiceBuilder builder() { - return new UpdateDetailsForInvoiceBuilder(); - } - - public static final class UpdateDetailsForInvoiceBuilder { - - private String vatNumber; - - private String vatNumberPrefix; - - private String poNumber; - - private String comment; - - private BillingAddressParams billingAddress; - - private ShippingAddressParams shippingAddress; - - private StatementDescriptorParams statementDescriptor; - - private Map customFields = new LinkedHashMap<>(); - - private UpdateDetailsForInvoiceBuilder() {} - - public UpdateDetailsForInvoiceBuilder vatNumber(String value) { - this.vatNumber = value; - return this; - } - - public UpdateDetailsForInvoiceBuilder vatNumberPrefix(String value) { - this.vatNumberPrefix = value; - return this; - } - - public UpdateDetailsForInvoiceBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public UpdateDetailsForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public UpdateDetailsForInvoiceBuilder billingAddress(BillingAddressParams value) { - this.billingAddress = value; - return this; - } - - public UpdateDetailsForInvoiceBuilder shippingAddress(ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public UpdateDetailsForInvoiceBuilder statementDescriptor(StatementDescriptorParams value) { - this.statementDescriptor = value; - return this; - } - - /** - * Add a custom field to the request. Custom fields must start with "cf_". - * - * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") - * @param value the value of the custom field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cf_" - */ - public UpdateDetailsForInvoiceBuilder customField(String fieldName, String value) { - if (fieldName == null || !fieldName.startsWith("cf_")) { - throw new IllegalArgumentException("Custom field name must start with 'cf_'"); - } - this.customFields.put(fieldName, value); - return this; - } - - /** - * Add multiple custom fields to the request. All field names must start with "cf_". - * - * @param customFields map of custom field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cf_" - */ - public UpdateDetailsForInvoiceBuilder customFields(Map customFields) { - if (customFields != null) { - for (Map.Entry entry : customFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { - throw new IllegalArgumentException( - "Custom field name must start with 'cf_': " + entry.getKey()); - } - this.customFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public UpdateDetailsForInvoiceParams build() { - return new UpdateDetailsForInvoiceParams(this); - } - } - - public static final class BillingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private BillingAddressParams(BillingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for BillingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingAddressBuilder builder() { - return new BillingAddressBuilder(); - } - - public static final class BillingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private BillingAddressBuilder() {} - - public BillingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public BillingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public BillingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public BillingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public BillingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public BillingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public BillingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public BillingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public BillingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public BillingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public BillingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public BillingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public BillingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public BillingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public BillingAddressParams build() { - return new BillingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class StatementDescriptorParams { - - private final String descriptor; - - private StatementDescriptorParams(StatementDescriptorBuilder builder) { - - this.descriptor = builder.descriptor; - } - - public String getDescriptor() { - return descriptor; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.descriptor != null) { - - formData.put("descriptor", this.descriptor); - } - - return formData; - } - - /** Create a new builder for StatementDescriptorParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static StatementDescriptorBuilder builder() { - return new StatementDescriptorBuilder(); - } - - public static final class StatementDescriptorBuilder { - - private String descriptor; - - private StatementDescriptorBuilder() {} - - public StatementDescriptorBuilder descriptor(String value) { - this.descriptor = value; - return this; - } - - public StatementDescriptorParams build() { - return new StatementDescriptorParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/WriteOffForInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/WriteOffForInvoiceParams.java deleted file mode 100644 index 58284c2e..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/params/WriteOffForInvoiceParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.invoice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class WriteOffForInvoiceParams { - - private final String comment; - - private WriteOffForInvoiceParams(WriteOffForInvoiceBuilder builder) { - - this.comment = builder.comment; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for WriteOffForInvoiceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static WriteOffForInvoiceBuilder builder() { - return new WriteOffForInvoiceBuilder(); - } - - public static final class WriteOffForInvoiceBuilder { - - private String comment; - - private WriteOffForInvoiceBuilder() {} - - public WriteOffForInvoiceBuilder comment(String value) { - this.comment = value; - return this; - } - - public WriteOffForInvoiceParams build() { - return new WriteOffForInvoiceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/AddAddonChargeForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/AddAddonChargeForInvoiceResponse.java deleted file mode 100644 index 47a0d9fa..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/AddAddonChargeForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddAddonChargeForInvoice operation. Contains the response data from - * the API. - */ -public final class AddAddonChargeForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private AddAddonChargeForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into AddAddonChargeForInvoiceResponse object. */ - public static AddAddonChargeForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddAddonChargeForInvoiceResponse object with HTTP response. */ - public static AddAddonChargeForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddAddonChargeForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for AddAddonChargeForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddAddonChargeForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddAddonChargeForInvoiceResponse build() { - return new AddAddonChargeForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/AddChargeForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/AddChargeForInvoiceResponse.java deleted file mode 100644 index 655ca04e..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/AddChargeForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddChargeForInvoice operation. Contains the response data from the - * API. - */ -public final class AddChargeForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private AddChargeForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into AddChargeForInvoiceResponse object. */ - public static AddChargeForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddChargeForInvoiceResponse object with HTTP response. */ - public static AddChargeForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddChargeForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for AddChargeForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddChargeForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddChargeForInvoiceResponse build() { - return new AddChargeForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/AddChargeItemForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/AddChargeItemForInvoiceResponse.java deleted file mode 100644 index 695b9199..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/AddChargeItemForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddChargeItemForInvoice operation. Contains the response data from - * the API. - */ -public final class AddChargeItemForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private AddChargeItemForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into AddChargeItemForInvoiceResponse object. */ - public static AddChargeItemForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddChargeItemForInvoiceResponse object with HTTP response. */ - public static AddChargeItemForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddChargeItemForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for AddChargeItemForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddChargeItemForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddChargeItemForInvoiceResponse build() { - return new AddChargeItemForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/ApplyCreditsForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/ApplyCreditsForInvoiceResponse.java deleted file mode 100644 index 6558309c..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/ApplyCreditsForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ApplyCreditsForInvoice operation. Contains the response data from - * the API. - */ -public final class ApplyCreditsForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private ApplyCreditsForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into ApplyCreditsForInvoiceResponse object. */ - public static ApplyCreditsForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ApplyCreditsForInvoiceResponse object with HTTP response. */ - public static ApplyCreditsForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ApplyCreditsForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for ApplyCreditsForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ApplyCreditsForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ApplyCreditsForInvoiceResponse build() { - return new ApplyCreditsForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/ApplyPaymentScheduleSchemeForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/ApplyPaymentScheduleSchemeForInvoiceResponse.java deleted file mode 100644 index 8c547e18..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/ApplyPaymentScheduleSchemeForInvoiceResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ApplyPaymentScheduleSchemeForInvoice operation. Contains the - * response data from the API. - */ -public final class ApplyPaymentScheduleSchemeForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private ApplyPaymentScheduleSchemeForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into ApplyPaymentScheduleSchemeForInvoiceResponse object. */ - public static ApplyPaymentScheduleSchemeForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into ApplyPaymentScheduleSchemeForInvoiceResponse object with HTTP - * response. - */ - public static ApplyPaymentScheduleSchemeForInvoiceResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ApplyPaymentScheduleSchemeForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for ApplyPaymentScheduleSchemeForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ApplyPaymentScheduleSchemeForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ApplyPaymentScheduleSchemeForInvoiceResponse build() { - return new ApplyPaymentScheduleSchemeForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/ApplyPaymentsForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/ApplyPaymentsForInvoiceResponse.java deleted file mode 100644 index fd6db796..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/ApplyPaymentsForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ApplyPaymentsForInvoice operation. Contains the response data from - * the API. - */ -public final class ApplyPaymentsForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private ApplyPaymentsForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into ApplyPaymentsForInvoiceResponse object. */ - public static ApplyPaymentsForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ApplyPaymentsForInvoiceResponse object with HTTP response. */ - public static ApplyPaymentsForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ApplyPaymentsForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for ApplyPaymentsForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ApplyPaymentsForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ApplyPaymentsForInvoiceResponse build() { - return new ApplyPaymentsForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/CloseForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/CloseForInvoiceResponse.java deleted file mode 100644 index 2e3e0e96..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/CloseForInvoiceResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CloseForInvoice operation. Contains the response data from the API. - */ -public final class CloseForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private CloseForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into CloseForInvoiceResponse object. */ - public static CloseForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into CloseForInvoiceResponse object with HTTP response. */ - public static CloseForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse CloseForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for CloseForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CloseForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CloseForInvoiceResponse build() { - return new CloseForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/CollectPaymentForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/CollectPaymentForInvoiceResponse.java deleted file mode 100644 index dda7e864..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/CollectPaymentForInvoiceResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CollectPaymentForInvoice operation. Contains the response data from - * the API. - */ -public final class CollectPaymentForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private final Transaction transaction; - - private CollectPaymentForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - - this.transaction = builder.transaction; - } - - /** Parse JSON response into CollectPaymentForInvoiceResponse object. */ - public static CollectPaymentForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into CollectPaymentForInvoiceResponse object with HTTP response. */ - public static CollectPaymentForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse CollectPaymentForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for CollectPaymentForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CollectPaymentForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CollectPaymentForInvoiceResponse build() { - return new CollectPaymentForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/DeleteImportedForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/DeleteImportedForInvoiceResponse.java deleted file mode 100644 index 971eb703..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/DeleteImportedForInvoiceResponse.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteImportedForInvoice operation. Contains the response data from - * the API. - */ -public final class DeleteImportedForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private final List creditNotes; - - private DeleteImportedForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - - this.creditNotes = builder.creditNotes; - } - - /** Parse JSON response into DeleteImportedForInvoiceResponse object. */ - public static DeleteImportedForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteImportedForInvoiceResponse object with HTTP response. */ - public static DeleteImportedForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.creditNotes( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() - .map(CreditNote::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteImportedForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for DeleteImportedForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteImportedForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private List creditNotes; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder creditNotes(List creditNotes) { - this.creditNotes = creditNotes; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteImportedForInvoiceResponse build() { - return new DeleteImportedForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the creditNotes from the response. */ - public List getCreditNotes() { - return creditNotes; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/DeleteInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/DeleteInvoiceResponse.java deleted file mode 100644 index 2e3e950e..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/DeleteInvoiceResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteInvoice operation. Contains the response data from the API. - */ -public final class DeleteInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private DeleteInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into DeleteInvoiceResponse object. */ - public static DeleteInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteInvoiceResponse object with HTTP response. */ - public static DeleteInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for DeleteInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteInvoiceResponse build() { - return new DeleteInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/DeleteLineItemsForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/DeleteLineItemsForInvoiceResponse.java deleted file mode 100644 index a3ced096..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/DeleteLineItemsForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteLineItemsForInvoice operation. Contains the response data - * from the API. - */ -public final class DeleteLineItemsForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private DeleteLineItemsForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into DeleteLineItemsForInvoiceResponse object. */ - public static DeleteLineItemsForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteLineItemsForInvoiceResponse object with HTTP response. */ - public static DeleteLineItemsForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteLineItemsForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for DeleteLineItemsForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteLineItemsForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteLineItemsForInvoiceResponse build() { - return new DeleteLineItemsForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/DownloadEinvoiceForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/DownloadEinvoiceForInvoiceResponse.java deleted file mode 100644 index 35b30196..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/DownloadEinvoiceForInvoiceResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.download.Download; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import java.util.List; - -/** - * Immutable response object for DownloadEinvoiceForInvoice operation. Contains the response data - * from a single resource get operation. - */ -public final class DownloadEinvoiceForInvoiceResponse extends BaseResponse { - private final List downloads; - - private DownloadEinvoiceForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.downloads = builder.downloads; - } - - /** Parse JSON response into DownloadEinvoiceForInvoiceResponse object. */ - public static DownloadEinvoiceForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DownloadEinvoiceForInvoiceResponse object with HTTP response. */ - public static DownloadEinvoiceForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __downloadsJson = JsonUtil.getArray(json, "downloads"); - if (__downloadsJson != null) { - builder.downloads( - JsonUtil.parseObjectArray(__downloadsJson).stream() - .map(Download::fromJson) - .collect(java.util.stream.Collectors.toList())); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DownloadEinvoiceForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for DownloadEinvoiceForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DownloadEinvoiceForInvoiceResponse. */ - public static class Builder { - - private List downloads; - - private Response httpResponse; - - private Builder() {} - - public Builder downloads(List downloads) { - this.downloads = downloads; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DownloadEinvoiceForInvoiceResponse build() { - return new DownloadEinvoiceForInvoiceResponse(this); - } - } - - /** Get the downloads from the response. */ - public List getDownloads() { - return downloads; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/DownloadEinvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/DownloadEinvoiceResponse.java new file mode 100644 index 00000000..acc145c8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/DownloadEinvoiceResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.download.Download; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import java.util.List; + +/** + * Immutable response object for DownloadEinvoice operation. Contains the response data from a + * single resource get operation. + */ +public final class DownloadEinvoiceResponse extends BaseResponse { + private final List downloads; + + private DownloadEinvoiceResponse(Builder builder) { + super(builder.httpResponse); + + this.downloads = builder.downloads; + } + + /** Parse JSON response into DownloadEinvoiceResponse object. */ + public static DownloadEinvoiceResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into DownloadEinvoiceResponse object with HTTP response. */ + public static DownloadEinvoiceResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __downloadsJson = JsonUtil.getArray(json, "downloads"); + if (__downloadsJson != null) { + builder.downloads( + JsonUtil.parseObjectArray(__downloadsJson).stream() + .map(Download::fromJson) + .collect(java.util.stream.Collectors.toList())); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse DownloadEinvoiceResponse from JSON", e); + } + } + + /** Create a new builder for DownloadEinvoiceResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for DownloadEinvoiceResponse. */ + public static class Builder { + + private List downloads; + + private Response httpResponse; + + private Builder() {} + + public Builder downloads(List downloads) { + this.downloads = downloads; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public DownloadEinvoiceResponse build() { + return new DownloadEinvoiceResponse(this); + } + } + + /** Get the downloads from the response. */ + public List getDownloads() { + return downloads; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceAddAddonChargeResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceAddAddonChargeResponse.java new file mode 100644 index 00000000..e512c968 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceAddAddonChargeResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceAddAddonCharge operation. Contains the response data from + * the API. + */ +public final class InvoiceAddAddonChargeResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceAddAddonChargeResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceAddAddonChargeResponse object. */ + public static InvoiceAddAddonChargeResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceAddAddonChargeResponse object with HTTP response. */ + public static InvoiceAddAddonChargeResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceAddAddonChargeResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceAddAddonChargeResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceAddAddonChargeResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceAddAddonChargeResponse build() { + return new InvoiceAddAddonChargeResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceAddChargeItemResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceAddChargeItemResponse.java new file mode 100644 index 00000000..cdee9f9b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceAddChargeItemResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceAddChargeItem operation. Contains the response data from the + * API. + */ +public final class InvoiceAddChargeItemResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceAddChargeItemResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceAddChargeItemResponse object. */ + public static InvoiceAddChargeItemResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceAddChargeItemResponse object with HTTP response. */ + public static InvoiceAddChargeItemResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceAddChargeItemResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceAddChargeItemResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceAddChargeItemResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceAddChargeItemResponse build() { + return new InvoiceAddChargeItemResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceAddChargeResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceAddChargeResponse.java new file mode 100644 index 00000000..ef11a95a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceAddChargeResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceAddCharge operation. Contains the response data from the + * API. + */ +public final class InvoiceAddChargeResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceAddChargeResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceAddChargeResponse object. */ + public static InvoiceAddChargeResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceAddChargeResponse object with HTTP response. */ + public static InvoiceAddChargeResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceAddChargeResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceAddChargeResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceAddChargeResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceAddChargeResponse build() { + return new InvoiceAddChargeResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceApplyCreditsResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceApplyCreditsResponse.java new file mode 100644 index 00000000..5eab90c5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceApplyCreditsResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceApplyCredits operation. Contains the response data from the + * API. + */ +public final class InvoiceApplyCreditsResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceApplyCreditsResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceApplyCreditsResponse object. */ + public static InvoiceApplyCreditsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceApplyCreditsResponse object with HTTP response. */ + public static InvoiceApplyCreditsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceApplyCreditsResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceApplyCreditsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceApplyCreditsResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceApplyCreditsResponse build() { + return new InvoiceApplyCreditsResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceApplyPaymentScheduleSchemeResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceApplyPaymentScheduleSchemeResponse.java new file mode 100644 index 00000000..b1dcfcd3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceApplyPaymentScheduleSchemeResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceApplyPaymentScheduleScheme operation. Contains the response + * data from the API. + */ +public final class InvoiceApplyPaymentScheduleSchemeResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceApplyPaymentScheduleSchemeResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceApplyPaymentScheduleSchemeResponse object. */ + public static InvoiceApplyPaymentScheduleSchemeResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into InvoiceApplyPaymentScheduleSchemeResponse object with HTTP response. + */ + public static InvoiceApplyPaymentScheduleSchemeResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse InvoiceApplyPaymentScheduleSchemeResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceApplyPaymentScheduleSchemeResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceApplyPaymentScheduleSchemeResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceApplyPaymentScheduleSchemeResponse build() { + return new InvoiceApplyPaymentScheduleSchemeResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceApplyPaymentsResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceApplyPaymentsResponse.java new file mode 100644 index 00000000..010d8125 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceApplyPaymentsResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceApplyPayments operation. Contains the response data from the + * API. + */ +public final class InvoiceApplyPaymentsResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceApplyPaymentsResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceApplyPaymentsResponse object. */ + public static InvoiceApplyPaymentsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceApplyPaymentsResponse object with HTTP response. */ + public static InvoiceApplyPaymentsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceApplyPaymentsResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceApplyPaymentsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceApplyPaymentsResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceApplyPaymentsResponse build() { + return new InvoiceApplyPaymentsResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceCloseResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceCloseResponse.java new file mode 100644 index 00000000..f6ccbbda --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceCloseResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceClose operation. Contains the response data from the API. + */ +public final class InvoiceCloseResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceCloseResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceCloseResponse object. */ + public static InvoiceCloseResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceCloseResponse object with HTTP response. */ + public static InvoiceCloseResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceCloseResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceCloseResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceCloseResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceCloseResponse build() { + return new InvoiceCloseResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceCollectPaymentResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceCollectPaymentResponse.java new file mode 100644 index 00000000..114d6c9a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceCollectPaymentResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceCollectPayment operation. Contains the response data from + * the API. + */ +public final class InvoiceCollectPaymentResponse extends BaseResponse { + private final Invoice invoice; + + private final Transaction transaction; + + private InvoiceCollectPaymentResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + + this.transaction = builder.transaction; + } + + /** Parse JSON response into InvoiceCollectPaymentResponse object. */ + public static InvoiceCollectPaymentResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceCollectPaymentResponse object with HTTP response. */ + public static InvoiceCollectPaymentResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceCollectPaymentResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceCollectPaymentResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceCollectPaymentResponse. */ + public static class Builder { + + private Invoice invoice; + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceCollectPaymentResponse build() { + return new InvoiceCollectPaymentResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceDeleteImportedResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceDeleteImportedResponse.java new file mode 100644 index 00000000..aafd8ad2 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceDeleteImportedResponse.java @@ -0,0 +1,102 @@ +package com.chargebee.v4.models.invoice.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceDeleteImported operation. Contains the response data from + * the API. + */ +public final class InvoiceDeleteImportedResponse extends BaseResponse { + private final Invoice invoice; + + private final List creditNotes; + + private InvoiceDeleteImportedResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + + this.creditNotes = builder.creditNotes; + } + + /** Parse JSON response into InvoiceDeleteImportedResponse object. */ + public static InvoiceDeleteImportedResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceDeleteImportedResponse object with HTTP response. */ + public static InvoiceDeleteImportedResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.creditNotes( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() + .map(CreditNote::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceDeleteImportedResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceDeleteImportedResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceDeleteImportedResponse. */ + public static class Builder { + + private Invoice invoice; + + private List creditNotes; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder creditNotes(List creditNotes) { + this.creditNotes = creditNotes; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceDeleteImportedResponse build() { + return new InvoiceDeleteImportedResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the creditNotes from the response. */ + public List getCreditNotes() { + return creditNotes; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceDeleteLineItemsResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceDeleteLineItemsResponse.java new file mode 100644 index 00000000..2e5baeb0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceDeleteLineItemsResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceDeleteLineItems operation. Contains the response data from + * the API. + */ +public final class InvoiceDeleteLineItemsResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceDeleteLineItemsResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceDeleteLineItemsResponse object. */ + public static InvoiceDeleteLineItemsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceDeleteLineItemsResponse object with HTTP response. */ + public static InvoiceDeleteLineItemsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceDeleteLineItemsResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceDeleteLineItemsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceDeleteLineItemsResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceDeleteLineItemsResponse build() { + return new InvoiceDeleteLineItemsResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceDeleteResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceDeleteResponse.java new file mode 100644 index 00000000..2c519836 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceDeleteResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceDelete operation. Contains the response data from the API. + */ +public final class InvoiceDeleteResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceDeleteResponse object. */ + public static InvoiceDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceDeleteResponse object with HTTP response. */ + public static InvoiceDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceDeleteResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceDeleteResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceDeleteResponse build() { + return new InvoiceDeleteResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceListPaymentReferenceNumbersResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceListPaymentReferenceNumbersResponse.java index aeefa2d1..13ca552e 100644 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceListPaymentReferenceNumbersResponse.java +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceListPaymentReferenceNumbersResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.paymentReferenceNumber.PaymentReferenceNumber; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.InvoiceService; @@ -104,9 +105,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public InvoiceListPaymentReferenceNumbersResponse nextPage() throws Exception { + public InvoiceListPaymentReferenceNumbersResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceListResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceListResponse.java index 4e78728d..c120ae37 100644 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceListResponse.java +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.invoice.Invoice; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.InvoiceService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public InvoiceListResponse nextPage() throws Exception { + public InvoiceListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicePauseDunningResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicePauseDunningResponse.java new file mode 100644 index 00000000..5b25d7cc --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicePauseDunningResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoicePauseDunning operation. Contains the response data from the + * API. + */ +public final class InvoicePauseDunningResponse extends BaseResponse { + private final Invoice invoice; + + private InvoicePauseDunningResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoicePauseDunningResponse object. */ + public static InvoicePauseDunningResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoicePauseDunningResponse object with HTTP response. */ + public static InvoicePauseDunningResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoicePauseDunningResponse from JSON", e); + } + } + + /** Create a new builder for InvoicePauseDunningResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoicePauseDunningResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoicePauseDunningResponse build() { + return new InvoicePauseDunningResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicePaymentSchedulesResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicePaymentSchedulesResponse.java new file mode 100644 index 00000000..c71a76da --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicePaymentSchedulesResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.paymentSchedule.PaymentSchedule; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import java.util.List; + +/** + * Immutable response object for InvoicePaymentSchedules operation. Contains the response data from + * a single resource get operation. + */ +public final class InvoicePaymentSchedulesResponse extends BaseResponse { + private final List paymentSchedules; + + private InvoicePaymentSchedulesResponse(Builder builder) { + super(builder.httpResponse); + + this.paymentSchedules = builder.paymentSchedules; + } + + /** Parse JSON response into InvoicePaymentSchedulesResponse object. */ + public static InvoicePaymentSchedulesResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoicePaymentSchedulesResponse object with HTTP response. */ + public static InvoicePaymentSchedulesResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __paymentSchedulesJson = JsonUtil.getArray(json, "payment_schedules"); + if (__paymentSchedulesJson != null) { + builder.paymentSchedules( + JsonUtil.parseObjectArray(__paymentSchedulesJson).stream() + .map(PaymentSchedule::fromJson) + .collect(java.util.stream.Collectors.toList())); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoicePaymentSchedulesResponse from JSON", e); + } + } + + /** Create a new builder for InvoicePaymentSchedulesResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoicePaymentSchedulesResponse. */ + public static class Builder { + + private List paymentSchedules; + + private Response httpResponse; + + private Builder() {} + + public Builder paymentSchedules(List paymentSchedules) { + this.paymentSchedules = paymentSchedules; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoicePaymentSchedulesResponse build() { + return new InvoicePaymentSchedulesResponse(this); + } + } + + /** Get the paymentSchedules from the response. */ + public List getPaymentSchedules() { + return paymentSchedules; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicePdfResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicePdfResponse.java new file mode 100644 index 00000000..5deded68 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicePdfResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.download.Download; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for InvoicePdf operation. Contains the response data from the API. */ +public final class InvoicePdfResponse extends BaseResponse { + private final Download download; + + private InvoicePdfResponse(Builder builder) { + super(builder.httpResponse); + + this.download = builder.download; + } + + /** Parse JSON response into InvoicePdfResponse object. */ + public static InvoicePdfResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoicePdfResponse object with HTTP response. */ + public static InvoicePdfResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __downloadJson = JsonUtil.getObject(json, "download"); + if (__downloadJson != null) { + builder.download(Download.fromJson(__downloadJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoicePdfResponse from JSON", e); + } + } + + /** Create a new builder for InvoicePdfResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoicePdfResponse. */ + public static class Builder { + + private Download download; + + private Response httpResponse; + + private Builder() {} + + public Builder download(Download download) { + this.download = download; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoicePdfResponse build() { + return new InvoicePdfResponse(this); + } + } + + /** Get the download from the response. */ + public Download getDownload() { + return download; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRecordPaymentResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRecordPaymentResponse.java new file mode 100644 index 00000000..a6560612 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRecordPaymentResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceRecordPayment operation. Contains the response data from the + * API. + */ +public final class InvoiceRecordPaymentResponse extends BaseResponse { + private final Invoice invoice; + + private final Transaction transaction; + + private InvoiceRecordPaymentResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + + this.transaction = builder.transaction; + } + + /** Parse JSON response into InvoiceRecordPaymentResponse object. */ + public static InvoiceRecordPaymentResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceRecordPaymentResponse object with HTTP response. */ + public static InvoiceRecordPaymentResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceRecordPaymentResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceRecordPaymentResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceRecordPaymentResponse. */ + public static class Builder { + + private Invoice invoice; + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceRecordPaymentResponse build() { + return new InvoiceRecordPaymentResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRecordRefundResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRecordRefundResponse.java new file mode 100644 index 00000000..6d399e10 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRecordRefundResponse.java @@ -0,0 +1,123 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceRecordRefund operation. Contains the response data from the + * API. + */ +public final class InvoiceRecordRefundResponse extends BaseResponse { + private final Invoice invoice; + + private final Transaction transaction; + + private final CreditNote creditNote; + + private InvoiceRecordRefundResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + + this.transaction = builder.transaction; + + this.creditNote = builder.creditNote; + } + + /** Parse JSON response into InvoiceRecordRefundResponse object. */ + public static InvoiceRecordRefundResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceRecordRefundResponse object with HTTP response. */ + public static InvoiceRecordRefundResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); + if (__creditNoteJson != null) { + builder.creditNote(CreditNote.fromJson(__creditNoteJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceRecordRefundResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceRecordRefundResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceRecordRefundResponse. */ + public static class Builder { + + private Invoice invoice; + + private Transaction transaction; + + private CreditNote creditNote; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder creditNote(CreditNote creditNote) { + this.creditNote = creditNote; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceRecordRefundResponse build() { + return new InvoiceRecordRefundResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } + + /** Get the creditNote from the response. */ + public CreditNote getCreditNote() { + return creditNote; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRecordTaxWithheldResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRecordTaxWithheldResponse.java new file mode 100644 index 00000000..361434d0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRecordTaxWithheldResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceRecordTaxWithheld operation. Contains the response data from + * the API. + */ +public final class InvoiceRecordTaxWithheldResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceRecordTaxWithheldResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceRecordTaxWithheldResponse object. */ + public static InvoiceRecordTaxWithheldResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceRecordTaxWithheldResponse object with HTTP response. */ + public static InvoiceRecordTaxWithheldResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceRecordTaxWithheldResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceRecordTaxWithheldResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceRecordTaxWithheldResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceRecordTaxWithheldResponse build() { + return new InvoiceRecordTaxWithheldResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRefundResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRefundResponse.java new file mode 100644 index 00000000..900c4327 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRefundResponse.java @@ -0,0 +1,122 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceRefund operation. Contains the response data from the API. + */ +public final class InvoiceRefundResponse extends BaseResponse { + private final Invoice invoice; + + private final Transaction transaction; + + private final CreditNote creditNote; + + private InvoiceRefundResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + + this.transaction = builder.transaction; + + this.creditNote = builder.creditNote; + } + + /** Parse JSON response into InvoiceRefundResponse object. */ + public static InvoiceRefundResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceRefundResponse object with HTTP response. */ + public static InvoiceRefundResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); + if (__creditNoteJson != null) { + builder.creditNote(CreditNote.fromJson(__creditNoteJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceRefundResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceRefundResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceRefundResponse. */ + public static class Builder { + + private Invoice invoice; + + private Transaction transaction; + + private CreditNote creditNote; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder creditNote(CreditNote creditNote) { + this.creditNote = creditNote; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceRefundResponse build() { + return new InvoiceRefundResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } + + /** Get the creditNote from the response. */ + public CreditNote getCreditNote() { + return creditNote; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRemoveCreditNoteResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRemoveCreditNoteResponse.java new file mode 100644 index 00000000..fd5e6072 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRemoveCreditNoteResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceRemoveCreditNote operation. Contains the response data from + * the API. + */ +public final class InvoiceRemoveCreditNoteResponse extends BaseResponse { + private final Invoice invoice; + + private final CreditNote creditNote; + + private InvoiceRemoveCreditNoteResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + + this.creditNote = builder.creditNote; + } + + /** Parse JSON response into InvoiceRemoveCreditNoteResponse object. */ + public static InvoiceRemoveCreditNoteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceRemoveCreditNoteResponse object with HTTP response. */ + public static InvoiceRemoveCreditNoteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); + if (__creditNoteJson != null) { + builder.creditNote(CreditNote.fromJson(__creditNoteJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceRemoveCreditNoteResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceRemoveCreditNoteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceRemoveCreditNoteResponse. */ + public static class Builder { + + private Invoice invoice; + + private CreditNote creditNote; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder creditNote(CreditNote creditNote) { + this.creditNote = creditNote; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceRemoveCreditNoteResponse build() { + return new InvoiceRemoveCreditNoteResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the creditNote from the response. */ + public CreditNote getCreditNote() { + return creditNote; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRemovePaymentResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRemovePaymentResponse.java new file mode 100644 index 00000000..8a6c796f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRemovePaymentResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceRemovePayment operation. Contains the response data from the + * API. + */ +public final class InvoiceRemovePaymentResponse extends BaseResponse { + private final Invoice invoice; + + private final Transaction transaction; + + private InvoiceRemovePaymentResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + + this.transaction = builder.transaction; + } + + /** Parse JSON response into InvoiceRemovePaymentResponse object. */ + public static InvoiceRemovePaymentResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceRemovePaymentResponse object with HTTP response. */ + public static InvoiceRemovePaymentResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceRemovePaymentResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceRemovePaymentResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceRemovePaymentResponse. */ + public static class Builder { + + private Invoice invoice; + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceRemovePaymentResponse build() { + return new InvoiceRemovePaymentResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRemoveTaxWithheldResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRemoveTaxWithheldResponse.java new file mode 100644 index 00000000..f8a79a9c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceRemoveTaxWithheldResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceRemoveTaxWithheld operation. Contains the response data from + * the API. + */ +public final class InvoiceRemoveTaxWithheldResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceRemoveTaxWithheldResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceRemoveTaxWithheldResponse object. */ + public static InvoiceRemoveTaxWithheldResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceRemoveTaxWithheldResponse object with HTTP response. */ + public static InvoiceRemoveTaxWithheldResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceRemoveTaxWithheldResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceRemoveTaxWithheldResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceRemoveTaxWithheldResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceRemoveTaxWithheldResponse build() { + return new InvoiceRemoveTaxWithheldResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceResumeDunningResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceResumeDunningResponse.java new file mode 100644 index 00000000..47038645 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceResumeDunningResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceResumeDunning operation. Contains the response data from the + * API. + */ +public final class InvoiceResumeDunningResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceResumeDunningResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceResumeDunningResponse object. */ + public static InvoiceResumeDunningResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceResumeDunningResponse object with HTTP response. */ + public static InvoiceResumeDunningResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceResumeDunningResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceResumeDunningResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceResumeDunningResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceResumeDunningResponse build() { + return new InvoiceResumeDunningResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceStopDunningResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceStopDunningResponse.java new file mode 100644 index 00000000..6d601424 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceStopDunningResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceStopDunning operation. Contains the response data from the + * API. + */ +public final class InvoiceStopDunningResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceStopDunningResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceStopDunningResponse object. */ + public static InvoiceStopDunningResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceStopDunningResponse object with HTTP response. */ + public static InvoiceStopDunningResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceStopDunningResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceStopDunningResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceStopDunningResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceStopDunningResponse build() { + return new InvoiceStopDunningResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceSyncUsagesResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceSyncUsagesResponse.java new file mode 100644 index 00000000..8b6e02f3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceSyncUsagesResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceSyncUsages operation. Contains the response data from the + * API. + */ +public final class InvoiceSyncUsagesResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceSyncUsagesResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceSyncUsagesResponse object. */ + public static InvoiceSyncUsagesResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceSyncUsagesResponse object with HTTP response. */ + public static InvoiceSyncUsagesResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceSyncUsagesResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceSyncUsagesResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceSyncUsagesResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceSyncUsagesResponse build() { + return new InvoiceSyncUsagesResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceUpdateDetailsResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceUpdateDetailsResponse.java new file mode 100644 index 00000000..2ff71b0a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceUpdateDetailsResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceUpdateDetails operation. Contains the response data from the + * API. + */ +public final class InvoiceUpdateDetailsResponse extends BaseResponse { + private final Invoice invoice; + + private InvoiceUpdateDetailsResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into InvoiceUpdateDetailsResponse object. */ + public static InvoiceUpdateDetailsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceUpdateDetailsResponse object with HTTP response. */ + public static InvoiceUpdateDetailsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceUpdateDetailsResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceUpdateDetailsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceUpdateDetailsResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceUpdateDetailsResponse build() { + return new InvoiceUpdateDetailsResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceWriteOffResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceWriteOffResponse.java new file mode 100644 index 00000000..e5fa9cd6 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoiceWriteOffResponse.java @@ -0,0 +1,99 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for InvoiceWriteOff operation. Contains the response data from the API. + */ +public final class InvoiceWriteOffResponse extends BaseResponse { + private final Invoice invoice; + + private final CreditNote creditNote; + + private InvoiceWriteOffResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + + this.creditNote = builder.creditNote; + } + + /** Parse JSON response into InvoiceWriteOffResponse object. */ + public static InvoiceWriteOffResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into InvoiceWriteOffResponse object with HTTP response. */ + public static InvoiceWriteOffResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); + if (__creditNoteJson != null) { + builder.creditNote(CreditNote.fromJson(__creditNoteJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse InvoiceWriteOffResponse from JSON", e); + } + } + + /** Create a new builder for InvoiceWriteOffResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for InvoiceWriteOffResponse. */ + public static class Builder { + + private Invoice invoice; + + private CreditNote creditNote; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder creditNote(CreditNote creditNote) { + this.creditNote = creditNote; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public InvoiceWriteOffResponse build() { + return new InvoiceWriteOffResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the creditNote from the response. */ + public CreditNote getCreditNote() { + return creditNote; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicesForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicesForCustomerResponse.java index 28dd56c3..27e7aaef 100644 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicesForCustomerResponse.java +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicesForCustomerResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.invoice.Invoice; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.InvoiceService; @@ -105,9 +106,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public InvoicesForCustomerResponse nextPage() throws Exception { + public InvoicesForCustomerResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicesForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicesForSubscriptionResponse.java index ee23da24..65a04cd3 100644 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicesForSubscriptionResponse.java +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/InvoicesForSubscriptionResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.invoice.Invoice; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.InvoiceService; @@ -107,9 +108,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public InvoicesForSubscriptionResponse nextPage() throws Exception { + public InvoicesForSubscriptionResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/PauseDunningForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/PauseDunningForInvoiceResponse.java deleted file mode 100644 index f86d2e83..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/PauseDunningForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for PauseDunningForInvoice operation. Contains the response data from - * the API. - */ -public final class PauseDunningForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private PauseDunningForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into PauseDunningForInvoiceResponse object. */ - public static PauseDunningForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into PauseDunningForInvoiceResponse object with HTTP response. */ - public static PauseDunningForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse PauseDunningForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for PauseDunningForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for PauseDunningForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public PauseDunningForInvoiceResponse build() { - return new PauseDunningForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/PaymentSchedulesForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/PaymentSchedulesForInvoiceResponse.java deleted file mode 100644 index 8c38311c..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/PaymentSchedulesForInvoiceResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.paymentSchedule.PaymentSchedule; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import java.util.List; - -/** - * Immutable response object for PaymentSchedulesForInvoice operation. Contains the response data - * from a single resource get operation. - */ -public final class PaymentSchedulesForInvoiceResponse extends BaseResponse { - private final List paymentSchedules; - - private PaymentSchedulesForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.paymentSchedules = builder.paymentSchedules; - } - - /** Parse JSON response into PaymentSchedulesForInvoiceResponse object. */ - public static PaymentSchedulesForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into PaymentSchedulesForInvoiceResponse object with HTTP response. */ - public static PaymentSchedulesForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __paymentSchedulesJson = JsonUtil.getArray(json, "payment_schedules"); - if (__paymentSchedulesJson != null) { - builder.paymentSchedules( - JsonUtil.parseObjectArray(__paymentSchedulesJson).stream() - .map(PaymentSchedule::fromJson) - .collect(java.util.stream.Collectors.toList())); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse PaymentSchedulesForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for PaymentSchedulesForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for PaymentSchedulesForInvoiceResponse. */ - public static class Builder { - - private List paymentSchedules; - - private Response httpResponse; - - private Builder() {} - - public Builder paymentSchedules(List paymentSchedules) { - this.paymentSchedules = paymentSchedules; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public PaymentSchedulesForInvoiceResponse build() { - return new PaymentSchedulesForInvoiceResponse(this); - } - } - - /** Get the paymentSchedules from the response. */ - public List getPaymentSchedules() { - return paymentSchedules; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/PdfForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/PdfForInvoiceResponse.java deleted file mode 100644 index b7330270..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/PdfForInvoiceResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.download.Download; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for PdfForInvoice operation. Contains the response data from the API. - */ -public final class PdfForInvoiceResponse extends BaseResponse { - private final Download download; - - private PdfForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.download = builder.download; - } - - /** Parse JSON response into PdfForInvoiceResponse object. */ - public static PdfForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into PdfForInvoiceResponse object with HTTP response. */ - public static PdfForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __downloadJson = JsonUtil.getObject(json, "download"); - if (__downloadJson != null) { - builder.download(Download.fromJson(__downloadJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse PdfForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for PdfForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for PdfForInvoiceResponse. */ - public static class Builder { - - private Download download; - - private Response httpResponse; - - private Builder() {} - - public Builder download(Download download) { - this.download = download; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public PdfForInvoiceResponse build() { - return new PdfForInvoiceResponse(this); - } - } - - /** Get the download from the response. */ - public Download getDownload() { - return download; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/RecordPaymentForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/RecordPaymentForInvoiceResponse.java deleted file mode 100644 index 31a13117..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/RecordPaymentForInvoiceResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RecordPaymentForInvoice operation. Contains the response data from - * the API. - */ -public final class RecordPaymentForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private final Transaction transaction; - - private RecordPaymentForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - - this.transaction = builder.transaction; - } - - /** Parse JSON response into RecordPaymentForInvoiceResponse object. */ - public static RecordPaymentForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RecordPaymentForInvoiceResponse object with HTTP response. */ - public static RecordPaymentForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RecordPaymentForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for RecordPaymentForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RecordPaymentForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RecordPaymentForInvoiceResponse build() { - return new RecordPaymentForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/RecordRefundForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/RecordRefundForInvoiceResponse.java deleted file mode 100644 index f7886236..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/RecordRefundForInvoiceResponse.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RecordRefundForInvoice operation. Contains the response data from - * the API. - */ -public final class RecordRefundForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private final Transaction transaction; - - private final CreditNote creditNote; - - private RecordRefundForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - - this.transaction = builder.transaction; - - this.creditNote = builder.creditNote; - } - - /** Parse JSON response into RecordRefundForInvoiceResponse object. */ - public static RecordRefundForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RecordRefundForInvoiceResponse object with HTTP response. */ - public static RecordRefundForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); - if (__creditNoteJson != null) { - builder.creditNote(CreditNote.fromJson(__creditNoteJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RecordRefundForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for RecordRefundForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RecordRefundForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Transaction transaction; - - private CreditNote creditNote; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder creditNote(CreditNote creditNote) { - this.creditNote = creditNote; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RecordRefundForInvoiceResponse build() { - return new RecordRefundForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } - - /** Get the creditNote from the response. */ - public CreditNote getCreditNote() { - return creditNote; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/RecordTaxWithheldForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/RecordTaxWithheldForInvoiceResponse.java deleted file mode 100644 index e366027c..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/RecordTaxWithheldForInvoiceResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RecordTaxWithheldForInvoice operation. Contains the response data - * from the API. - */ -public final class RecordTaxWithheldForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private RecordTaxWithheldForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into RecordTaxWithheldForInvoiceResponse object. */ - public static RecordTaxWithheldForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RecordTaxWithheldForInvoiceResponse object with HTTP response. */ - public static RecordTaxWithheldForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RecordTaxWithheldForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for RecordTaxWithheldForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RecordTaxWithheldForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RecordTaxWithheldForInvoiceResponse build() { - return new RecordTaxWithheldForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/RefundForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/RefundForInvoiceResponse.java deleted file mode 100644 index 70d8f755..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/RefundForInvoiceResponse.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RefundForInvoice operation. Contains the response data from the - * API. - */ -public final class RefundForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private final Transaction transaction; - - private final CreditNote creditNote; - - private RefundForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - - this.transaction = builder.transaction; - - this.creditNote = builder.creditNote; - } - - /** Parse JSON response into RefundForInvoiceResponse object. */ - public static RefundForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RefundForInvoiceResponse object with HTTP response. */ - public static RefundForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); - if (__creditNoteJson != null) { - builder.creditNote(CreditNote.fromJson(__creditNoteJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RefundForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for RefundForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RefundForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Transaction transaction; - - private CreditNote creditNote; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder creditNote(CreditNote creditNote) { - this.creditNote = creditNote; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RefundForInvoiceResponse build() { - return new RefundForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } - - /** Get the creditNote from the response. */ - public CreditNote getCreditNote() { - return creditNote; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/RemoveCreditNoteForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/RemoveCreditNoteForInvoiceResponse.java deleted file mode 100644 index 0f20cddd..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/RemoveCreditNoteForInvoiceResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RemoveCreditNoteForInvoice operation. Contains the response data - * from the API. - */ -public final class RemoveCreditNoteForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private final CreditNote creditNote; - - private RemoveCreditNoteForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - - this.creditNote = builder.creditNote; - } - - /** Parse JSON response into RemoveCreditNoteForInvoiceResponse object. */ - public static RemoveCreditNoteForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RemoveCreditNoteForInvoiceResponse object with HTTP response. */ - public static RemoveCreditNoteForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); - if (__creditNoteJson != null) { - builder.creditNote(CreditNote.fromJson(__creditNoteJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RemoveCreditNoteForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for RemoveCreditNoteForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RemoveCreditNoteForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private CreditNote creditNote; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder creditNote(CreditNote creditNote) { - this.creditNote = creditNote; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RemoveCreditNoteForInvoiceResponse build() { - return new RemoveCreditNoteForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the creditNote from the response. */ - public CreditNote getCreditNote() { - return creditNote; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/RemovePaymentForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/RemovePaymentForInvoiceResponse.java deleted file mode 100644 index c7ed942a..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/RemovePaymentForInvoiceResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RemovePaymentForInvoice operation. Contains the response data from - * the API. - */ -public final class RemovePaymentForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private final Transaction transaction; - - private RemovePaymentForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - - this.transaction = builder.transaction; - } - - /** Parse JSON response into RemovePaymentForInvoiceResponse object. */ - public static RemovePaymentForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RemovePaymentForInvoiceResponse object with HTTP response. */ - public static RemovePaymentForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RemovePaymentForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for RemovePaymentForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RemovePaymentForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RemovePaymentForInvoiceResponse build() { - return new RemovePaymentForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/RemoveTaxWithheldForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/RemoveTaxWithheldForInvoiceResponse.java deleted file mode 100644 index 36451d09..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/RemoveTaxWithheldForInvoiceResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RemoveTaxWithheldForInvoice operation. Contains the response data - * from the API. - */ -public final class RemoveTaxWithheldForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private RemoveTaxWithheldForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into RemoveTaxWithheldForInvoiceResponse object. */ - public static RemoveTaxWithheldForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RemoveTaxWithheldForInvoiceResponse object with HTTP response. */ - public static RemoveTaxWithheldForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RemoveTaxWithheldForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for RemoveTaxWithheldForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RemoveTaxWithheldForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RemoveTaxWithheldForInvoiceResponse build() { - return new RemoveTaxWithheldForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/ResendEinvoiceForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/ResendEinvoiceForInvoiceResponse.java deleted file mode 100644 index 17d16353..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/ResendEinvoiceForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ResendEinvoiceForInvoice operation. Contains the response data from - * the API. - */ -public final class ResendEinvoiceForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private ResendEinvoiceForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into ResendEinvoiceForInvoiceResponse object. */ - public static ResendEinvoiceForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ResendEinvoiceForInvoiceResponse object with HTTP response. */ - public static ResendEinvoiceForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ResendEinvoiceForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for ResendEinvoiceForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ResendEinvoiceForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ResendEinvoiceForInvoiceResponse build() { - return new ResendEinvoiceForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/ResendEinvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/ResendEinvoiceResponse.java new file mode 100644 index 00000000..289919e0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/ResendEinvoiceResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for ResendEinvoice operation. Contains the response data from the API. + */ +public final class ResendEinvoiceResponse extends BaseResponse { + private final Invoice invoice; + + private ResendEinvoiceResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into ResendEinvoiceResponse object. */ + public static ResendEinvoiceResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into ResendEinvoiceResponse object with HTTP response. */ + public static ResendEinvoiceResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse ResendEinvoiceResponse from JSON", e); + } + } + + /** Create a new builder for ResendEinvoiceResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ResendEinvoiceResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public ResendEinvoiceResponse build() { + return new ResendEinvoiceResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/ResumeDunningForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/ResumeDunningForInvoiceResponse.java deleted file mode 100644 index 8ebb4d38..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/ResumeDunningForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ResumeDunningForInvoice operation. Contains the response data from - * the API. - */ -public final class ResumeDunningForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private ResumeDunningForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into ResumeDunningForInvoiceResponse object. */ - public static ResumeDunningForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ResumeDunningForInvoiceResponse object with HTTP response. */ - public static ResumeDunningForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ResumeDunningForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for ResumeDunningForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ResumeDunningForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ResumeDunningForInvoiceResponse build() { - return new ResumeDunningForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/SendEinvoiceForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/SendEinvoiceForInvoiceResponse.java deleted file mode 100644 index 250f8076..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/SendEinvoiceForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for SendEinvoiceForInvoice operation. Contains the response data from - * the API. - */ -public final class SendEinvoiceForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private SendEinvoiceForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into SendEinvoiceForInvoiceResponse object. */ - public static SendEinvoiceForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into SendEinvoiceForInvoiceResponse object with HTTP response. */ - public static SendEinvoiceForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse SendEinvoiceForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for SendEinvoiceForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for SendEinvoiceForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public SendEinvoiceForInvoiceResponse build() { - return new SendEinvoiceForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/SendEinvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/SendEinvoiceResponse.java new file mode 100644 index 00000000..edc1af50 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/invoice/responses/SendEinvoiceResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.invoice.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SendEinvoice operation. Contains the response data from the API. + */ +public final class SendEinvoiceResponse extends BaseResponse { + private final Invoice invoice; + + private SendEinvoiceResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + } + + /** Parse JSON response into SendEinvoiceResponse object. */ + public static SendEinvoiceResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SendEinvoiceResponse object with HTTP response. */ + public static SendEinvoiceResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SendEinvoiceResponse from JSON", e); + } + } + + /** Create a new builder for SendEinvoiceResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SendEinvoiceResponse. */ + public static class Builder { + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SendEinvoiceResponse build() { + return new SendEinvoiceResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/StopDunningForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/StopDunningForInvoiceResponse.java deleted file mode 100644 index c3bdecb9..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/StopDunningForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for StopDunningForInvoice operation. Contains the response data from - * the API. - */ -public final class StopDunningForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private StopDunningForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into StopDunningForInvoiceResponse object. */ - public static StopDunningForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into StopDunningForInvoiceResponse object with HTTP response. */ - public static StopDunningForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse StopDunningForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for StopDunningForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for StopDunningForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public StopDunningForInvoiceResponse build() { - return new StopDunningForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/SyncUsagesForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/SyncUsagesForInvoiceResponse.java deleted file mode 100644 index 3e40f3eb..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/SyncUsagesForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for SyncUsagesForInvoice operation. Contains the response data from the - * API. - */ -public final class SyncUsagesForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private SyncUsagesForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into SyncUsagesForInvoiceResponse object. */ - public static SyncUsagesForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into SyncUsagesForInvoiceResponse object with HTTP response. */ - public static SyncUsagesForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse SyncUsagesForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for SyncUsagesForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for SyncUsagesForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public SyncUsagesForInvoiceResponse build() { - return new SyncUsagesForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/UpdateDetailsForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/UpdateDetailsForInvoiceResponse.java deleted file mode 100644 index 53f99d66..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/UpdateDetailsForInvoiceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateDetailsForInvoice operation. Contains the response data from - * the API. - */ -public final class UpdateDetailsForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private UpdateDetailsForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - } - - /** Parse JSON response into UpdateDetailsForInvoiceResponse object. */ - public static UpdateDetailsForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdateDetailsForInvoiceResponse object with HTTP response. */ - public static UpdateDetailsForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UpdateDetailsForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for UpdateDetailsForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateDetailsForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateDetailsForInvoiceResponse build() { - return new UpdateDetailsForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/invoice/responses/WriteOffForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/invoice/responses/WriteOffForInvoiceResponse.java deleted file mode 100644 index 2130c2e2..00000000 --- a/src/main/java/com/chargebee/v4/models/invoice/responses/WriteOffForInvoiceResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.invoice.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for WriteOffForInvoice operation. Contains the response data from the - * API. - */ -public final class WriteOffForInvoiceResponse extends BaseResponse { - private final Invoice invoice; - - private final CreditNote creditNote; - - private WriteOffForInvoiceResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - - this.creditNote = builder.creditNote; - } - - /** Parse JSON response into WriteOffForInvoiceResponse object. */ - public static WriteOffForInvoiceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into WriteOffForInvoiceResponse object with HTTP response. */ - public static WriteOffForInvoiceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); - if (__creditNoteJson != null) { - builder.creditNote(CreditNote.fromJson(__creditNoteJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse WriteOffForInvoiceResponse from JSON", e); - } - } - - /** Create a new builder for WriteOffForInvoiceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for WriteOffForInvoiceResponse. */ - public static class Builder { - - private Invoice invoice; - - private CreditNote creditNote; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder creditNote(CreditNote creditNote) { - this.creditNote = creditNote; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public WriteOffForInvoiceResponse build() { - return new WriteOffForInvoiceResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the creditNote from the response. */ - public CreditNote getCreditNote() { - return creditNote; - } -} diff --git a/src/main/java/com/chargebee/v4/models/item/params/DeleteItemParams.java b/src/main/java/com/chargebee/v4/models/item/params/DeleteItemParams.java deleted file mode 100644 index 3ee9dcb1..00000000 --- a/src/main/java/com/chargebee/v4/models/item/params/DeleteItemParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.item.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteItemParams { - - private DeleteItemParams(DeleteItemBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteItemParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteItemBuilder builder() { - return new DeleteItemBuilder(); - } - - public static final class DeleteItemBuilder { - - private DeleteItemBuilder() {} - - public DeleteItemParams build() { - return new DeleteItemParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/item/params/ItemDeleteParams.java b/src/main/java/com/chargebee/v4/models/item/params/ItemDeleteParams.java new file mode 100644 index 00000000..42b38f3c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/item/params/ItemDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.item.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ItemDeleteParams { + + private ItemDeleteParams(ItemDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for ItemDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemDeleteBuilder builder() { + return new ItemDeleteBuilder(); + } + + public static final class ItemDeleteBuilder { + + private ItemDeleteBuilder() {} + + public ItemDeleteParams build() { + return new ItemDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/item/params/ItemListParams.java b/src/main/java/com/chargebee/v4/models/item/params/ItemListParams.java index 63447ae6..daa2ac97 100644 --- a/src/main/java/com/chargebee/v4/models/item/params/ItemListParams.java +++ b/src/main/java/com/chargebee/v4/models/item/params/ItemListParams.java @@ -473,13 +473,13 @@ public static final class BusinessEntityIdFilter { this.builder = builder; } - public ItemListBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); + public ItemListBuilder isPresent(boolean value) { + builder.queryParams.put(fieldName + "[is_present]", String.valueOf(value)); return builder; } - public ItemListBuilder isPresent(boolean value) { - builder.queryParams.put(fieldName + "[is_present]", String.valueOf(value)); + public ItemListBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); return builder; } } diff --git a/src/main/java/com/chargebee/v4/models/item/responses/DeleteItemResponse.java b/src/main/java/com/chargebee/v4/models/item/responses/DeleteItemResponse.java deleted file mode 100644 index 59d4ca12..00000000 --- a/src/main/java/com/chargebee/v4/models/item/responses/DeleteItemResponse.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.chargebee.v4.models.item.responses; - -import com.chargebee.v4.models.item.Item; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** Immutable response object for DeleteItem operation. Contains the response data from the API. */ -public final class DeleteItemResponse extends BaseResponse { - private final Item item; - - private DeleteItemResponse(Builder builder) { - super(builder.httpResponse); - - this.item = builder.item; - } - - /** Parse JSON response into DeleteItemResponse object. */ - public static DeleteItemResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteItemResponse object with HTTP response. */ - public static DeleteItemResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __itemJson = JsonUtil.getObject(json, "item"); - if (__itemJson != null) { - builder.item(Item.fromJson(__itemJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteItemResponse from JSON", e); - } - } - - /** Create a new builder for DeleteItemResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteItemResponse. */ - public static class Builder { - - private Item item; - - private Response httpResponse; - - private Builder() {} - - public Builder item(Item item) { - this.item = item; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteItemResponse build() { - return new DeleteItemResponse(this); - } - } - - /** Get the item from the response. */ - public Item getItem() { - return item; - } -} diff --git a/src/main/java/com/chargebee/v4/models/item/responses/ItemDeleteResponse.java b/src/main/java/com/chargebee/v4/models/item/responses/ItemDeleteResponse.java new file mode 100644 index 00000000..6d447355 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/item/responses/ItemDeleteResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.item.responses; + +import com.chargebee.v4.models.item.Item; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for ItemDelete operation. Contains the response data from the API. */ +public final class ItemDeleteResponse extends BaseResponse { + private final Item item; + + private ItemDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.item = builder.item; + } + + /** Parse JSON response into ItemDeleteResponse object. */ + public static ItemDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into ItemDeleteResponse object with HTTP response. */ + public static ItemDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __itemJson = JsonUtil.getObject(json, "item"); + if (__itemJson != null) { + builder.item(Item.fromJson(__itemJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse ItemDeleteResponse from JSON", e); + } + } + + /** Create a new builder for ItemDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ItemDeleteResponse. */ + public static class Builder { + + private Item item; + + private Response httpResponse; + + private Builder() {} + + public Builder item(Item item) { + this.item = item; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public ItemDeleteResponse build() { + return new ItemDeleteResponse(this); + } + } + + /** Get the item from the response. */ + public Item getItem() { + return item; + } +} diff --git a/src/main/java/com/chargebee/v4/models/item/responses/ItemListResponse.java b/src/main/java/com/chargebee/v4/models/item/responses/ItemListResponse.java index b561b920..f1d87a53 100644 --- a/src/main/java/com/chargebee/v4/models/item/responses/ItemListResponse.java +++ b/src/main/java/com/chargebee/v4/models/item/responses/ItemListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.item.Item; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.ItemService; @@ -95,9 +96,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public ItemListResponse nextPage() throws Exception { + public ItemListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/itemEntitlement/params/AddItemEntitlementForFeatureParams.java b/src/main/java/com/chargebee/v4/models/itemEntitlement/params/AddItemEntitlementForFeatureParams.java deleted file mode 100644 index 66f8c999..00000000 --- a/src/main/java/com/chargebee/v4/models/itemEntitlement/params/AddItemEntitlementForFeatureParams.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.itemEntitlement.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class AddItemEntitlementForFeatureParams { - - private final Action action; - - private final List itemEntitlements; - - private AddItemEntitlementForFeatureParams(AddItemEntitlementForFeatureBuilder builder) { - - this.action = builder.action; - - this.itemEntitlements = builder.itemEntitlements; - } - - public Action getAction() { - return action; - } - - public List getItemEntitlements() { - return itemEntitlements; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.action != null) { - - formData.put("action", this.action); - } - - if (this.itemEntitlements != null) { - - // List of objects - for (int i = 0; i < this.itemEntitlements.size(); i++) { - ItemEntitlementsParams item = this.itemEntitlements.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_entitlements[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for AddItemEntitlementForFeatureParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddItemEntitlementForFeatureBuilder builder() { - return new AddItemEntitlementForFeatureBuilder(); - } - - public static final class AddItemEntitlementForFeatureBuilder { - - private Action action; - - private List itemEntitlements; - - private AddItemEntitlementForFeatureBuilder() {} - - public AddItemEntitlementForFeatureBuilder action(Action value) { - this.action = value; - return this; - } - - public AddItemEntitlementForFeatureBuilder itemEntitlements( - List value) { - this.itemEntitlements = value; - return this; - } - - public AddItemEntitlementForFeatureParams build() { - return new AddItemEntitlementForFeatureParams(this); - } - } - - public enum Action { - UPSERT("upsert"), - - REMOVE("remove"), - - /** An enum member indicating that Action was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Action(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Action fromString(String value) { - if (value == null) return _UNKNOWN; - for (Action enumValue : Action.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class ItemEntitlementsParams { - - private final String itemId; - - private final ItemType itemType; - - private final String value; - - private ItemEntitlementsParams(ItemEntitlementsBuilder builder) { - - this.itemId = builder.itemId; - - this.itemType = builder.itemType; - - this.value = builder.value; - } - - public String getItemId() { - return itemId; - } - - public ItemType getItemType() { - return itemType; - } - - public String getValue() { - return value; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemId != null) { - - formData.put("item_id", this.itemId); - } - - if (this.itemType != null) { - - formData.put("item_type", this.itemType); - } - - if (this.value != null) { - - formData.put("value", this.value); - } - - return formData; - } - - /** Create a new builder for ItemEntitlementsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemEntitlementsBuilder builder() { - return new ItemEntitlementsBuilder(); - } - - public static final class ItemEntitlementsBuilder { - - private String itemId; - - private ItemType itemType; - - private String value; - - private ItemEntitlementsBuilder() {} - - public ItemEntitlementsBuilder itemId(String value) { - this.itemId = value; - return this; - } - - public ItemEntitlementsBuilder itemType(ItemType value) { - this.itemType = value; - return this; - } - - public ItemEntitlementsBuilder value(String value) { - this.value = value; - return this; - } - - public ItemEntitlementsParams build() { - return new ItemEntitlementsParams(this); - } - } - - public enum ItemType { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - SUBSCRIPTION("subscription"), - - ITEM("item"), - - /** An enum member indicating that ItemType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemType enumValue : ItemType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemEntitlement/params/AddItemEntitlementForItemParams.java b/src/main/java/com/chargebee/v4/models/itemEntitlement/params/AddItemEntitlementForItemParams.java deleted file mode 100644 index d58a5ee9..00000000 --- a/src/main/java/com/chargebee/v4/models/itemEntitlement/params/AddItemEntitlementForItemParams.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.itemEntitlement.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class AddItemEntitlementForItemParams { - - private final Action action; - - private final List itemEntitlements; - - private AddItemEntitlementForItemParams(AddItemEntitlementForItemBuilder builder) { - - this.action = builder.action; - - this.itemEntitlements = builder.itemEntitlements; - } - - public Action getAction() { - return action; - } - - public List getItemEntitlements() { - return itemEntitlements; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.action != null) { - - formData.put("action", this.action); - } - - if (this.itemEntitlements != null) { - - // List of objects - for (int i = 0; i < this.itemEntitlements.size(); i++) { - ItemEntitlementsParams item = this.itemEntitlements.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_entitlements[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for AddItemEntitlementForItemParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddItemEntitlementForItemBuilder builder() { - return new AddItemEntitlementForItemBuilder(); - } - - public static final class AddItemEntitlementForItemBuilder { - - private Action action; - - private List itemEntitlements; - - private AddItemEntitlementForItemBuilder() {} - - public AddItemEntitlementForItemBuilder action(Action value) { - this.action = value; - return this; - } - - public AddItemEntitlementForItemBuilder itemEntitlements(List value) { - this.itemEntitlements = value; - return this; - } - - public AddItemEntitlementForItemParams build() { - return new AddItemEntitlementForItemParams(this); - } - } - - public enum Action { - UPSERT("upsert"), - - REMOVE("remove"), - - /** An enum member indicating that Action was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Action(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Action fromString(String value) { - if (value == null) return _UNKNOWN; - for (Action enumValue : Action.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class ItemEntitlementsParams { - - private final String featureId; - - private final String value; - - private ItemEntitlementsParams(ItemEntitlementsBuilder builder) { - - this.featureId = builder.featureId; - - this.value = builder.value; - } - - public String getFeatureId() { - return featureId; - } - - public String getValue() { - return value; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.featureId != null) { - - formData.put("feature_id", this.featureId); - } - - if (this.value != null) { - - formData.put("value", this.value); - } - - return formData; - } - - /** Create a new builder for ItemEntitlementsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemEntitlementsBuilder builder() { - return new ItemEntitlementsBuilder(); - } - - public static final class ItemEntitlementsBuilder { - - private String featureId; - - private String value; - - private ItemEntitlementsBuilder() {} - - public ItemEntitlementsBuilder featureId(String value) { - this.featureId = value; - return this; - } - - public ItemEntitlementsBuilder value(String value) { - this.value = value; - return this; - } - - public ItemEntitlementsParams build() { - return new ItemEntitlementsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemEntitlement/params/AddItemEntitlementsParams.java b/src/main/java/com/chargebee/v4/models/itemEntitlement/params/AddItemEntitlementsParams.java new file mode 100644 index 00000000..ff57f158 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemEntitlement/params/AddItemEntitlementsParams.java @@ -0,0 +1,241 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.itemEntitlement.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class AddItemEntitlementsParams { + + private final Action action; + + private final List itemEntitlements; + + private AddItemEntitlementsParams(AddItemEntitlementsBuilder builder) { + + this.action = builder.action; + + this.itemEntitlements = builder.itemEntitlements; + } + + public Action getAction() { + return action; + } + + public List getItemEntitlements() { + return itemEntitlements; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.action != null) { + + formData.put("action", this.action); + } + + if (this.itemEntitlements != null) { + + // List of objects + for (int i = 0; i < this.itemEntitlements.size(); i++) { + ItemEntitlementsParams item = this.itemEntitlements.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_entitlements[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for AddItemEntitlementsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddItemEntitlementsBuilder builder() { + return new AddItemEntitlementsBuilder(); + } + + public static final class AddItemEntitlementsBuilder { + + private Action action; + + private List itemEntitlements; + + private AddItemEntitlementsBuilder() {} + + public AddItemEntitlementsBuilder action(Action value) { + this.action = value; + return this; + } + + public AddItemEntitlementsBuilder itemEntitlements(List value) { + this.itemEntitlements = value; + return this; + } + + public AddItemEntitlementsParams build() { + return new AddItemEntitlementsParams(this); + } + } + + public enum Action { + UPSERT("upsert"), + + REMOVE("remove"), + + /** An enum member indicating that Action was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Action(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Action fromString(String value) { + if (value == null) return _UNKNOWN; + for (Action enumValue : Action.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class ItemEntitlementsParams { + + private final String itemId; + + private final ItemType itemType; + + private final String value; + + private ItemEntitlementsParams(ItemEntitlementsBuilder builder) { + + this.itemId = builder.itemId; + + this.itemType = builder.itemType; + + this.value = builder.value; + } + + public String getItemId() { + return itemId; + } + + public ItemType getItemType() { + return itemType; + } + + public String getValue() { + return value; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemId != null) { + + formData.put("item_id", this.itemId); + } + + if (this.itemType != null) { + + formData.put("item_type", this.itemType); + } + + if (this.value != null) { + + formData.put("value", this.value); + } + + return formData; + } + + /** Create a new builder for ItemEntitlementsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemEntitlementsBuilder builder() { + return new ItemEntitlementsBuilder(); + } + + public static final class ItemEntitlementsBuilder { + + private String itemId; + + private ItemType itemType; + + private String value; + + private ItemEntitlementsBuilder() {} + + public ItemEntitlementsBuilder itemId(String value) { + this.itemId = value; + return this; + } + + public ItemEntitlementsBuilder itemType(ItemType value) { + this.itemType = value; + return this; + } + + public ItemEntitlementsBuilder value(String value) { + this.value = value; + return this; + } + + public ItemEntitlementsParams build() { + return new ItemEntitlementsParams(this); + } + } + + public enum ItemType { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + SUBSCRIPTION("subscription"), + + ITEM("item"), + + /** An enum member indicating that ItemType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemType enumValue : ItemType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemEntitlement/params/UpsertOrRemoveItemEntitlementsForItemParams.java b/src/main/java/com/chargebee/v4/models/itemEntitlement/params/UpsertOrRemoveItemEntitlementsForItemParams.java new file mode 100644 index 00000000..d3f24ed9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemEntitlement/params/UpsertOrRemoveItemEntitlementsForItemParams.java @@ -0,0 +1,189 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.itemEntitlement.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class UpsertOrRemoveItemEntitlementsForItemParams { + + private final Action action; + + private final List itemEntitlements; + + private UpsertOrRemoveItemEntitlementsForItemParams( + UpsertOrRemoveItemEntitlementsForItemBuilder builder) { + + this.action = builder.action; + + this.itemEntitlements = builder.itemEntitlements; + } + + public Action getAction() { + return action; + } + + public List getItemEntitlements() { + return itemEntitlements; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.action != null) { + + formData.put("action", this.action); + } + + if (this.itemEntitlements != null) { + + // List of objects + for (int i = 0; i < this.itemEntitlements.size(); i++) { + ItemEntitlementsParams item = this.itemEntitlements.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_entitlements[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for UpsertOrRemoveItemEntitlementsForItemParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UpsertOrRemoveItemEntitlementsForItemBuilder builder() { + return new UpsertOrRemoveItemEntitlementsForItemBuilder(); + } + + public static final class UpsertOrRemoveItemEntitlementsForItemBuilder { + + private Action action; + + private List itemEntitlements; + + private UpsertOrRemoveItemEntitlementsForItemBuilder() {} + + public UpsertOrRemoveItemEntitlementsForItemBuilder action(Action value) { + this.action = value; + return this; + } + + public UpsertOrRemoveItemEntitlementsForItemBuilder itemEntitlements( + List value) { + this.itemEntitlements = value; + return this; + } + + public UpsertOrRemoveItemEntitlementsForItemParams build() { + return new UpsertOrRemoveItemEntitlementsForItemParams(this); + } + } + + public enum Action { + UPSERT("upsert"), + + REMOVE("remove"), + + /** An enum member indicating that Action was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Action(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Action fromString(String value) { + if (value == null) return _UNKNOWN; + for (Action enumValue : Action.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class ItemEntitlementsParams { + + private final String featureId; + + private final String value; + + private ItemEntitlementsParams(ItemEntitlementsBuilder builder) { + + this.featureId = builder.featureId; + + this.value = builder.value; + } + + public String getFeatureId() { + return featureId; + } + + public String getValue() { + return value; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.featureId != null) { + + formData.put("feature_id", this.featureId); + } + + if (this.value != null) { + + formData.put("value", this.value); + } + + return formData; + } + + /** Create a new builder for ItemEntitlementsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemEntitlementsBuilder builder() { + return new ItemEntitlementsBuilder(); + } + + public static final class ItemEntitlementsBuilder { + + private String featureId; + + private String value; + + private ItemEntitlementsBuilder() {} + + public ItemEntitlementsBuilder featureId(String value) { + this.featureId = value; + return this; + } + + public ItemEntitlementsBuilder value(String value) { + this.value = value; + return this; + } + + public ItemEntitlementsParams build() { + return new ItemEntitlementsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/AddItemEntitlementForFeatureResponse.java b/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/AddItemEntitlementForFeatureResponse.java deleted file mode 100644 index 0bc3e62c..00000000 --- a/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/AddItemEntitlementForFeatureResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.itemEntitlement.responses; - -import com.chargebee.v4.models.itemEntitlement.ItemEntitlement; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddItemEntitlementForFeature operation. Contains the response data - * from the API. - */ -public final class AddItemEntitlementForFeatureResponse extends BaseResponse { - private final ItemEntitlement itemEntitlement; - - private AddItemEntitlementForFeatureResponse(Builder builder) { - super(builder.httpResponse); - - this.itemEntitlement = builder.itemEntitlement; - } - - /** Parse JSON response into AddItemEntitlementForFeatureResponse object. */ - public static AddItemEntitlementForFeatureResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddItemEntitlementForFeatureResponse object with HTTP response. */ - public static AddItemEntitlementForFeatureResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __itemEntitlementJson = JsonUtil.getObject(json, "item_entitlement"); - if (__itemEntitlementJson != null) { - builder.itemEntitlement(ItemEntitlement.fromJson(__itemEntitlementJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse AddItemEntitlementForFeatureResponse from JSON", e); - } - } - - /** Create a new builder for AddItemEntitlementForFeatureResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddItemEntitlementForFeatureResponse. */ - public static class Builder { - - private ItemEntitlement itemEntitlement; - - private Response httpResponse; - - private Builder() {} - - public Builder itemEntitlement(ItemEntitlement itemEntitlement) { - this.itemEntitlement = itemEntitlement; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddItemEntitlementForFeatureResponse build() { - return new AddItemEntitlementForFeatureResponse(this); - } - } - - /** Get the itemEntitlement from the response. */ - public ItemEntitlement getItemEntitlement() { - return itemEntitlement; - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/AddItemEntitlementForItemResponse.java b/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/AddItemEntitlementForItemResponse.java deleted file mode 100644 index 35d6a9de..00000000 --- a/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/AddItemEntitlementForItemResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.itemEntitlement.responses; - -import com.chargebee.v4.models.itemEntitlement.ItemEntitlement; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddItemEntitlementForItem operation. Contains the response data - * from the API. - */ -public final class AddItemEntitlementForItemResponse extends BaseResponse { - private final ItemEntitlement itemEntitlement; - - private AddItemEntitlementForItemResponse(Builder builder) { - super(builder.httpResponse); - - this.itemEntitlement = builder.itemEntitlement; - } - - /** Parse JSON response into AddItemEntitlementForItemResponse object. */ - public static AddItemEntitlementForItemResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddItemEntitlementForItemResponse object with HTTP response. */ - public static AddItemEntitlementForItemResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __itemEntitlementJson = JsonUtil.getObject(json, "item_entitlement"); - if (__itemEntitlementJson != null) { - builder.itemEntitlement(ItemEntitlement.fromJson(__itemEntitlementJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddItemEntitlementForItemResponse from JSON", e); - } - } - - /** Create a new builder for AddItemEntitlementForItemResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddItemEntitlementForItemResponse. */ - public static class Builder { - - private ItemEntitlement itemEntitlement; - - private Response httpResponse; - - private Builder() {} - - public Builder itemEntitlement(ItemEntitlement itemEntitlement) { - this.itemEntitlement = itemEntitlement; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddItemEntitlementForItemResponse build() { - return new AddItemEntitlementForItemResponse(this); - } - } - - /** Get the itemEntitlement from the response. */ - public ItemEntitlement getItemEntitlement() { - return itemEntitlement; - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/AddItemEntitlementsResponse.java b/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/AddItemEntitlementsResponse.java new file mode 100644 index 00000000..a5a73f1a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/AddItemEntitlementsResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.itemEntitlement.responses; + +import com.chargebee.v4.models.itemEntitlement.ItemEntitlement; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for AddItemEntitlements operation. Contains the response data from the + * API. + */ +public final class AddItemEntitlementsResponse extends BaseResponse { + private final ItemEntitlement itemEntitlement; + + private AddItemEntitlementsResponse(Builder builder) { + super(builder.httpResponse); + + this.itemEntitlement = builder.itemEntitlement; + } + + /** Parse JSON response into AddItemEntitlementsResponse object. */ + public static AddItemEntitlementsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into AddItemEntitlementsResponse object with HTTP response. */ + public static AddItemEntitlementsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __itemEntitlementJson = JsonUtil.getObject(json, "item_entitlement"); + if (__itemEntitlementJson != null) { + builder.itemEntitlement(ItemEntitlement.fromJson(__itemEntitlementJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse AddItemEntitlementsResponse from JSON", e); + } + } + + /** Create a new builder for AddItemEntitlementsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for AddItemEntitlementsResponse. */ + public static class Builder { + + private ItemEntitlement itemEntitlement; + + private Response httpResponse; + + private Builder() {} + + public Builder itemEntitlement(ItemEntitlement itemEntitlement) { + this.itemEntitlement = itemEntitlement; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public AddItemEntitlementsResponse build() { + return new AddItemEntitlementsResponse(this); + } + } + + /** Get the itemEntitlement from the response. */ + public ItemEntitlement getItemEntitlement() { + return itemEntitlement; + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/ItemEntitlementsForFeatureResponse.java b/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/ItemEntitlementsForFeatureResponse.java index ce29e498..441e2921 100644 --- a/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/ItemEntitlementsForFeatureResponse.java +++ b/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/ItemEntitlementsForFeatureResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.itemEntitlement.ItemEntitlement; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.ItemEntitlementService; @@ -107,9 +108,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public ItemEntitlementsForFeatureResponse nextPage() throws Exception { + public ItemEntitlementsForFeatureResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/ItemEntitlementsForItemResponse.java b/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/ItemEntitlementsForItemResponse.java index cf232ce3..5809878d 100644 --- a/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/ItemEntitlementsForItemResponse.java +++ b/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/ItemEntitlementsForItemResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.itemEntitlement.ItemEntitlement; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.ItemEntitlementService; @@ -107,9 +108,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public ItemEntitlementsForItemResponse nextPage() throws Exception { + public ItemEntitlementsForItemResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/UpsertOrRemoveItemEntitlementsForItemResponse.java b/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/UpsertOrRemoveItemEntitlementsForItemResponse.java new file mode 100644 index 00000000..c5e1db68 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemEntitlement/responses/UpsertOrRemoveItemEntitlementsForItemResponse.java @@ -0,0 +1,82 @@ +package com.chargebee.v4.models.itemEntitlement.responses; + +import com.chargebee.v4.models.itemEntitlement.ItemEntitlement; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for UpsertOrRemoveItemEntitlementsForItem operation. Contains the + * response data from the API. + */ +public final class UpsertOrRemoveItemEntitlementsForItemResponse extends BaseResponse { + private final ItemEntitlement itemEntitlement; + + private UpsertOrRemoveItemEntitlementsForItemResponse(Builder builder) { + super(builder.httpResponse); + + this.itemEntitlement = builder.itemEntitlement; + } + + /** Parse JSON response into UpsertOrRemoveItemEntitlementsForItemResponse object. */ + public static UpsertOrRemoveItemEntitlementsForItemResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into UpsertOrRemoveItemEntitlementsForItemResponse object with HTTP + * response. + */ + public static UpsertOrRemoveItemEntitlementsForItemResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __itemEntitlementJson = JsonUtil.getObject(json, "item_entitlement"); + if (__itemEntitlementJson != null) { + builder.itemEntitlement(ItemEntitlement.fromJson(__itemEntitlementJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse UpsertOrRemoveItemEntitlementsForItemResponse from JSON", e); + } + } + + /** Create a new builder for UpsertOrRemoveItemEntitlementsForItemResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for UpsertOrRemoveItemEntitlementsForItemResponse. */ + public static class Builder { + + private ItemEntitlement itemEntitlement; + + private Response httpResponse; + + private Builder() {} + + public Builder itemEntitlement(ItemEntitlement itemEntitlement) { + this.itemEntitlement = itemEntitlement; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public UpsertOrRemoveItemEntitlementsForItemResponse build() { + return new UpsertOrRemoveItemEntitlementsForItemResponse(this); + } + } + + /** Get the itemEntitlement from the response. */ + public ItemEntitlement getItemEntitlement() { + return itemEntitlement; + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemFamily/params/DeleteItemFamilyParams.java b/src/main/java/com/chargebee/v4/models/itemFamily/params/DeleteItemFamilyParams.java deleted file mode 100644 index 307ca3b1..00000000 --- a/src/main/java/com/chargebee/v4/models/itemFamily/params/DeleteItemFamilyParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.itemFamily.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteItemFamilyParams { - - private DeleteItemFamilyParams(DeleteItemFamilyBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteItemFamilyParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteItemFamilyBuilder builder() { - return new DeleteItemFamilyBuilder(); - } - - public static final class DeleteItemFamilyBuilder { - - private DeleteItemFamilyBuilder() {} - - public DeleteItemFamilyParams build() { - return new DeleteItemFamilyParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemFamily/params/ItemFamilyDeleteParams.java b/src/main/java/com/chargebee/v4/models/itemFamily/params/ItemFamilyDeleteParams.java new file mode 100644 index 00000000..a2a6e2ca --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemFamily/params/ItemFamilyDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.itemFamily.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ItemFamilyDeleteParams { + + private ItemFamilyDeleteParams(ItemFamilyDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for ItemFamilyDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemFamilyDeleteBuilder builder() { + return new ItemFamilyDeleteBuilder(); + } + + public static final class ItemFamilyDeleteBuilder { + + private ItemFamilyDeleteBuilder() {} + + public ItemFamilyDeleteParams build() { + return new ItemFamilyDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemFamily/params/ItemFamilyListParams.java b/src/main/java/com/chargebee/v4/models/itemFamily/params/ItemFamilyListParams.java index ffba1360..f6f2b418 100644 --- a/src/main/java/com/chargebee/v4/models/itemFamily/params/ItemFamilyListParams.java +++ b/src/main/java/com/chargebee/v4/models/itemFamily/params/ItemFamilyListParams.java @@ -179,13 +179,13 @@ public static final class BusinessEntityIdFilter { this.builder = builder; } - public ItemFamilyListBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); + public ItemFamilyListBuilder isPresent(boolean value) { + builder.queryParams.put(fieldName + "[is_present]", String.valueOf(value)); return builder; } - public ItemFamilyListBuilder isPresent(boolean value) { - builder.queryParams.put(fieldName + "[is_present]", String.valueOf(value)); + public ItemFamilyListBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); return builder; } } diff --git a/src/main/java/com/chargebee/v4/models/itemFamily/responses/DeleteItemFamilyResponse.java b/src/main/java/com/chargebee/v4/models/itemFamily/responses/DeleteItemFamilyResponse.java deleted file mode 100644 index 8ab19ede..00000000 --- a/src/main/java/com/chargebee/v4/models/itemFamily/responses/DeleteItemFamilyResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.itemFamily.responses; - -import com.chargebee.v4.models.itemFamily.ItemFamily; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteItemFamily operation. Contains the response data from the - * API. - */ -public final class DeleteItemFamilyResponse extends BaseResponse { - private final ItemFamily itemFamily; - - private DeleteItemFamilyResponse(Builder builder) { - super(builder.httpResponse); - - this.itemFamily = builder.itemFamily; - } - - /** Parse JSON response into DeleteItemFamilyResponse object. */ - public static DeleteItemFamilyResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteItemFamilyResponse object with HTTP response. */ - public static DeleteItemFamilyResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __itemFamilyJson = JsonUtil.getObject(json, "item_family"); - if (__itemFamilyJson != null) { - builder.itemFamily(ItemFamily.fromJson(__itemFamilyJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteItemFamilyResponse from JSON", e); - } - } - - /** Create a new builder for DeleteItemFamilyResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteItemFamilyResponse. */ - public static class Builder { - - private ItemFamily itemFamily; - - private Response httpResponse; - - private Builder() {} - - public Builder itemFamily(ItemFamily itemFamily) { - this.itemFamily = itemFamily; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteItemFamilyResponse build() { - return new DeleteItemFamilyResponse(this); - } - } - - /** Get the itemFamily from the response. */ - public ItemFamily getItemFamily() { - return itemFamily; - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemFamily/responses/ItemFamilyDeleteResponse.java b/src/main/java/com/chargebee/v4/models/itemFamily/responses/ItemFamilyDeleteResponse.java new file mode 100644 index 00000000..11244794 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemFamily/responses/ItemFamilyDeleteResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.itemFamily.responses; + +import com.chargebee.v4.models.itemFamily.ItemFamily; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for ItemFamilyDelete operation. Contains the response data from the + * API. + */ +public final class ItemFamilyDeleteResponse extends BaseResponse { + private final ItemFamily itemFamily; + + private ItemFamilyDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.itemFamily = builder.itemFamily; + } + + /** Parse JSON response into ItemFamilyDeleteResponse object. */ + public static ItemFamilyDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into ItemFamilyDeleteResponse object with HTTP response. */ + public static ItemFamilyDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __itemFamilyJson = JsonUtil.getObject(json, "item_family"); + if (__itemFamilyJson != null) { + builder.itemFamily(ItemFamily.fromJson(__itemFamilyJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse ItemFamilyDeleteResponse from JSON", e); + } + } + + /** Create a new builder for ItemFamilyDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ItemFamilyDeleteResponse. */ + public static class Builder { + + private ItemFamily itemFamily; + + private Response httpResponse; + + private Builder() {} + + public Builder itemFamily(ItemFamily itemFamily) { + this.itemFamily = itemFamily; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public ItemFamilyDeleteResponse build() { + return new ItemFamilyDeleteResponse(this); + } + } + + /** Get the itemFamily from the response. */ + public ItemFamily getItemFamily() { + return itemFamily; + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemFamily/responses/ItemFamilyListResponse.java b/src/main/java/com/chargebee/v4/models/itemFamily/responses/ItemFamilyListResponse.java index 924a6263..4eb184e4 100644 --- a/src/main/java/com/chargebee/v4/models/itemFamily/responses/ItemFamilyListResponse.java +++ b/src/main/java/com/chargebee/v4/models/itemFamily/responses/ItemFamilyListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.itemFamily.ItemFamily; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.ItemFamilyService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public ItemFamilyListResponse nextPage() throws Exception { + public ItemFamilyListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/params/ApplicableItemPricesForItemPriceParams.java b/src/main/java/com/chargebee/v4/models/itemPrice/params/ApplicableItemPricesForItemPriceParams.java deleted file mode 100644 index 56e98ce6..00000000 --- a/src/main/java/com/chargebee/v4/models/itemPrice/params/ApplicableItemPricesForItemPriceParams.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.itemPrice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ApplicableItemPricesForItemPriceParams { - - private final Map queryParams; - - private ApplicableItemPricesForItemPriceParams(ApplicableItemPricesForItemPriceBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public ApplicableItemPricesForItemPriceBuilder toBuilder() { - ApplicableItemPricesForItemPriceBuilder builder = new ApplicableItemPricesForItemPriceBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for ApplicableItemPricesForItemPriceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ApplicableItemPricesForItemPriceBuilder builder() { - return new ApplicableItemPricesForItemPriceBuilder(); - } - - public static final class ApplicableItemPricesForItemPriceBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private ApplicableItemPricesForItemPriceBuilder() {} - - public ApplicableItemPricesForItemPriceBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public ApplicableItemPricesForItemPriceBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - public ApplicableItemPricesForItemPriceBuilder itemId(String value) { - queryParams.put("item_id", value); - return this; - } - - public SortBySortBuilder sortBy() { - return new SortBySortBuilder("sort_by", this); - } - - public ApplicableItemPricesForItemPriceParams build() { - return new ApplicableItemPricesForItemPriceParams(this); - } - - public static final class SortBySortBuilder { - private final String fieldName; - private final ApplicableItemPricesForItemPriceBuilder builder; - - SortBySortBuilder(String fieldName, ApplicableItemPricesForItemPriceBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public SortDirection name() { - return new SortDirection(fieldName, "name", builder); - } - - public SortDirection id() { - return new SortDirection(fieldName, "id", builder); - } - - public SortDirection updated_at() { - return new SortDirection(fieldName, "updated_at", builder); - } - } - - public static final class SortDirection { - private final String fieldName; - private final String selectedField; - private final ApplicableItemPricesForItemPriceBuilder builder; - - SortDirection( - String fieldName, String selectedField, ApplicableItemPricesForItemPriceBuilder builder) { - this.fieldName = fieldName; - this.selectedField = selectedField; - this.builder = builder; - } - - public ApplicableItemPricesForItemPriceBuilder asc() { - builder.queryParams.put(fieldName + "[asc]", selectedField); - return builder; - } - - public ApplicableItemPricesForItemPriceBuilder desc() { - builder.queryParams.put(fieldName + "[desc]", selectedField); - return builder; - } - } - } - - public enum SortByAsc { - NAME("name"), - - ID("id"), - - UPDATED_AT("updated_at"), - - /** An enum member indicating that SortByAsc was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - SortByAsc(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static SortByAsc fromString(String value) { - if (value == null) return _UNKNOWN; - for (SortByAsc enumValue : SortByAsc.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum SortByDesc { - NAME("name"), - - ID("id"), - - UPDATED_AT("updated_at"), - - /** An enum member indicating that SortByDesc was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - SortByDesc(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static SortByDesc fromString(String value) { - if (value == null) return _UNKNOWN; - for (SortByDesc enumValue : SortByDesc.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/params/ApplicableItemsForItemPriceParams.java b/src/main/java/com/chargebee/v4/models/itemPrice/params/ApplicableItemsForItemPriceParams.java deleted file mode 100644 index 5ebc7136..00000000 --- a/src/main/java/com/chargebee/v4/models/itemPrice/params/ApplicableItemsForItemPriceParams.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.itemPrice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ApplicableItemsForItemPriceParams { - - private final Map queryParams; - - private ApplicableItemsForItemPriceParams(ApplicableItemsForItemPriceBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public ApplicableItemsForItemPriceBuilder toBuilder() { - ApplicableItemsForItemPriceBuilder builder = new ApplicableItemsForItemPriceBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for ApplicableItemsForItemPriceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ApplicableItemsForItemPriceBuilder builder() { - return new ApplicableItemsForItemPriceBuilder(); - } - - public static final class ApplicableItemsForItemPriceBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private ApplicableItemsForItemPriceBuilder() {} - - public ApplicableItemsForItemPriceBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public ApplicableItemsForItemPriceBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - public SortBySortBuilder sortBy() { - return new SortBySortBuilder("sort_by", this); - } - - public ApplicableItemsForItemPriceParams build() { - return new ApplicableItemsForItemPriceParams(this); - } - - public static final class SortBySortBuilder { - private final String fieldName; - private final ApplicableItemsForItemPriceBuilder builder; - - SortBySortBuilder(String fieldName, ApplicableItemsForItemPriceBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public SortDirection name() { - return new SortDirection(fieldName, "name", builder); - } - - public SortDirection id() { - return new SortDirection(fieldName, "id", builder); - } - - public SortDirection updated_at() { - return new SortDirection(fieldName, "updated_at", builder); - } - } - - public static final class SortDirection { - private final String fieldName; - private final String selectedField; - private final ApplicableItemsForItemPriceBuilder builder; - - SortDirection( - String fieldName, String selectedField, ApplicableItemsForItemPriceBuilder builder) { - this.fieldName = fieldName; - this.selectedField = selectedField; - this.builder = builder; - } - - public ApplicableItemsForItemPriceBuilder asc() { - builder.queryParams.put(fieldName + "[asc]", selectedField); - return builder; - } - - public ApplicableItemsForItemPriceBuilder desc() { - builder.queryParams.put(fieldName + "[desc]", selectedField); - return builder; - } - } - } - - public enum SortByAsc { - NAME("name"), - - ID("id"), - - UPDATED_AT("updated_at"), - - /** An enum member indicating that SortByAsc was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - SortByAsc(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static SortByAsc fromString(String value) { - if (value == null) return _UNKNOWN; - for (SortByAsc enumValue : SortByAsc.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum SortByDesc { - NAME("name"), - - ID("id"), - - UPDATED_AT("updated_at"), - - /** An enum member indicating that SortByDesc was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - SortByDesc(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static SortByDesc fromString(String value) { - if (value == null) return _UNKNOWN; - for (SortByDesc enumValue : SortByDesc.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/params/DeleteItemPriceParams.java b/src/main/java/com/chargebee/v4/models/itemPrice/params/DeleteItemPriceParams.java deleted file mode 100644 index df5ee43e..00000000 --- a/src/main/java/com/chargebee/v4/models/itemPrice/params/DeleteItemPriceParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.itemPrice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteItemPriceParams { - - private DeleteItemPriceParams(DeleteItemPriceBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteItemPriceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteItemPriceBuilder builder() { - return new DeleteItemPriceBuilder(); - } - - public static final class DeleteItemPriceBuilder { - - private DeleteItemPriceBuilder() {} - - public DeleteItemPriceParams build() { - return new DeleteItemPriceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/params/FindApplicableItemPricesParams.java b/src/main/java/com/chargebee/v4/models/itemPrice/params/FindApplicableItemPricesParams.java new file mode 100644 index 00000000..16e72bd8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemPrice/params/FindApplicableItemPricesParams.java @@ -0,0 +1,174 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.itemPrice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class FindApplicableItemPricesParams { + + private final Map queryParams; + + private FindApplicableItemPricesParams(FindApplicableItemPricesBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public FindApplicableItemPricesBuilder toBuilder() { + FindApplicableItemPricesBuilder builder = new FindApplicableItemPricesBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for FindApplicableItemPricesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static FindApplicableItemPricesBuilder builder() { + return new FindApplicableItemPricesBuilder(); + } + + public static final class FindApplicableItemPricesBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private FindApplicableItemPricesBuilder() {} + + public FindApplicableItemPricesBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public FindApplicableItemPricesBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + public FindApplicableItemPricesBuilder itemId(String value) { + queryParams.put("item_id", value); + return this; + } + + public SortBySortBuilder sortBy() { + return new SortBySortBuilder("sort_by", this); + } + + public FindApplicableItemPricesParams build() { + return new FindApplicableItemPricesParams(this); + } + + public static final class SortBySortBuilder { + private final String fieldName; + private final FindApplicableItemPricesBuilder builder; + + SortBySortBuilder(String fieldName, FindApplicableItemPricesBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public SortDirection name() { + return new SortDirection(fieldName, "name", builder); + } + + public SortDirection id() { + return new SortDirection(fieldName, "id", builder); + } + + public SortDirection updated_at() { + return new SortDirection(fieldName, "updated_at", builder); + } + } + + public static final class SortDirection { + private final String fieldName; + private final String selectedField; + private final FindApplicableItemPricesBuilder builder; + + SortDirection( + String fieldName, String selectedField, FindApplicableItemPricesBuilder builder) { + this.fieldName = fieldName; + this.selectedField = selectedField; + this.builder = builder; + } + + public FindApplicableItemPricesBuilder asc() { + builder.queryParams.put(fieldName + "[asc]", selectedField); + return builder; + } + + public FindApplicableItemPricesBuilder desc() { + builder.queryParams.put(fieldName + "[desc]", selectedField); + return builder; + } + } + } + + public enum SortByAsc { + NAME("name"), + + ID("id"), + + UPDATED_AT("updated_at"), + + /** An enum member indicating that SortByAsc was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + SortByAsc(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SortByAsc fromString(String value) { + if (value == null) return _UNKNOWN; + for (SortByAsc enumValue : SortByAsc.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum SortByDesc { + NAME("name"), + + ID("id"), + + UPDATED_AT("updated_at"), + + /** An enum member indicating that SortByDesc was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + SortByDesc(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SortByDesc fromString(String value) { + if (value == null) return _UNKNOWN; + for (SortByDesc enumValue : SortByDesc.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/params/ItemPriceDeleteParams.java b/src/main/java/com/chargebee/v4/models/itemPrice/params/ItemPriceDeleteParams.java new file mode 100644 index 00000000..80523762 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemPrice/params/ItemPriceDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.itemPrice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ItemPriceDeleteParams { + + private ItemPriceDeleteParams(ItemPriceDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for ItemPriceDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemPriceDeleteBuilder builder() { + return new ItemPriceDeleteBuilder(); + } + + public static final class ItemPriceDeleteBuilder { + + private ItemPriceDeleteBuilder() {} + + public ItemPriceDeleteParams build() { + return new ItemPriceDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/params/ItemPriceFindApplicableItemsParams.java b/src/main/java/com/chargebee/v4/models/itemPrice/params/ItemPriceFindApplicableItemsParams.java new file mode 100644 index 00000000..a62f1ce0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemPrice/params/ItemPriceFindApplicableItemsParams.java @@ -0,0 +1,169 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.itemPrice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ItemPriceFindApplicableItemsParams { + + private final Map queryParams; + + private ItemPriceFindApplicableItemsParams(ItemPriceFindApplicableItemsBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public ItemPriceFindApplicableItemsBuilder toBuilder() { + ItemPriceFindApplicableItemsBuilder builder = new ItemPriceFindApplicableItemsBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for ItemPriceFindApplicableItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemPriceFindApplicableItemsBuilder builder() { + return new ItemPriceFindApplicableItemsBuilder(); + } + + public static final class ItemPriceFindApplicableItemsBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private ItemPriceFindApplicableItemsBuilder() {} + + public ItemPriceFindApplicableItemsBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public ItemPriceFindApplicableItemsBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + public SortBySortBuilder sortBy() { + return new SortBySortBuilder("sort_by", this); + } + + public ItemPriceFindApplicableItemsParams build() { + return new ItemPriceFindApplicableItemsParams(this); + } + + public static final class SortBySortBuilder { + private final String fieldName; + private final ItemPriceFindApplicableItemsBuilder builder; + + SortBySortBuilder(String fieldName, ItemPriceFindApplicableItemsBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public SortDirection name() { + return new SortDirection(fieldName, "name", builder); + } + + public SortDirection id() { + return new SortDirection(fieldName, "id", builder); + } + + public SortDirection updated_at() { + return new SortDirection(fieldName, "updated_at", builder); + } + } + + public static final class SortDirection { + private final String fieldName; + private final String selectedField; + private final ItemPriceFindApplicableItemsBuilder builder; + + SortDirection( + String fieldName, String selectedField, ItemPriceFindApplicableItemsBuilder builder) { + this.fieldName = fieldName; + this.selectedField = selectedField; + this.builder = builder; + } + + public ItemPriceFindApplicableItemsBuilder asc() { + builder.queryParams.put(fieldName + "[asc]", selectedField); + return builder; + } + + public ItemPriceFindApplicableItemsBuilder desc() { + builder.queryParams.put(fieldName + "[desc]", selectedField); + return builder; + } + } + } + + public enum SortByAsc { + NAME("name"), + + ID("id"), + + UPDATED_AT("updated_at"), + + /** An enum member indicating that SortByAsc was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + SortByAsc(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SortByAsc fromString(String value) { + if (value == null) return _UNKNOWN; + for (SortByAsc enumValue : SortByAsc.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum SortByDesc { + NAME("name"), + + ID("id"), + + UPDATED_AT("updated_at"), + + /** An enum member indicating that SortByDesc was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + SortByDesc(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SortByDesc fromString(String value) { + if (value == null) return _UNKNOWN; + for (SortByDesc enumValue : SortByDesc.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/params/ItemPriceListParams.java b/src/main/java/com/chargebee/v4/models/itemPrice/params/ItemPriceListParams.java index 8dae1f8d..00dc5a7c 100644 --- a/src/main/java/com/chargebee/v4/models/itemPrice/params/ItemPriceListParams.java +++ b/src/main/java/com/chargebee/v4/models/itemPrice/params/ItemPriceListParams.java @@ -528,13 +528,13 @@ public static final class BusinessEntityIdFilter { this.builder = builder; } - public ItemPriceListBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); + public ItemPriceListBuilder isPresent(boolean value) { + builder.queryParams.put(fieldName + "[is_present]", String.valueOf(value)); return builder; } - public ItemPriceListBuilder isPresent(boolean value) { - builder.queryParams.put(fieldName + "[is_present]", String.valueOf(value)); + public ItemPriceListBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); return builder; } } diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/params/MoveForItemPriceParams.java b/src/main/java/com/chargebee/v4/models/itemPrice/params/MoveForItemPriceParams.java deleted file mode 100644 index 72621a33..00000000 --- a/src/main/java/com/chargebee/v4/models/itemPrice/params/MoveForItemPriceParams.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.itemPrice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class MoveForItemPriceParams { - - private final String destinationItemId; - - private final String variantId; - - private MoveForItemPriceParams(MoveForItemPriceBuilder builder) { - - this.destinationItemId = builder.destinationItemId; - - this.variantId = builder.variantId; - } - - public String getDestinationItemId() { - return destinationItemId; - } - - public String getVariantId() { - return variantId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.destinationItemId != null) { - - formData.put("destination_item_id", this.destinationItemId); - } - - if (this.variantId != null) { - - formData.put("variant_id", this.variantId); - } - - return formData; - } - - /** Create a new builder for MoveForItemPriceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static MoveForItemPriceBuilder builder() { - return new MoveForItemPriceBuilder(); - } - - public static final class MoveForItemPriceBuilder { - - private String destinationItemId; - - private String variantId; - - private MoveForItemPriceBuilder() {} - - public MoveForItemPriceBuilder destinationItemId(String value) { - this.destinationItemId = value; - return this; - } - - public MoveForItemPriceBuilder variantId(String value) { - this.variantId = value; - return this; - } - - public MoveForItemPriceParams build() { - return new MoveForItemPriceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/params/MoveItemPriceParams.java b/src/main/java/com/chargebee/v4/models/itemPrice/params/MoveItemPriceParams.java new file mode 100644 index 00000000..d9db9dfe --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemPrice/params/MoveItemPriceParams.java @@ -0,0 +1,80 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.itemPrice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class MoveItemPriceParams { + + private final String destinationItemId; + + private final String variantId; + + private MoveItemPriceParams(MoveItemPriceBuilder builder) { + + this.destinationItemId = builder.destinationItemId; + + this.variantId = builder.variantId; + } + + public String getDestinationItemId() { + return destinationItemId; + } + + public String getVariantId() { + return variantId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.destinationItemId != null) { + + formData.put("destination_item_id", this.destinationItemId); + } + + if (this.variantId != null) { + + formData.put("variant_id", this.variantId); + } + + return formData; + } + + /** Create a new builder for MoveItemPriceParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static MoveItemPriceBuilder builder() { + return new MoveItemPriceBuilder(); + } + + public static final class MoveItemPriceBuilder { + + private String destinationItemId; + + private String variantId; + + private MoveItemPriceBuilder() {} + + public MoveItemPriceBuilder destinationItemId(String value) { + this.destinationItemId = value; + return this; + } + + public MoveItemPriceBuilder variantId(String value) { + this.variantId = value; + return this; + } + + public MoveItemPriceParams build() { + return new MoveItemPriceParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/responses/ApplicableItemPricesForItemPriceResponse.java b/src/main/java/com/chargebee/v4/models/itemPrice/responses/ApplicableItemPricesForItemPriceResponse.java deleted file mode 100644 index 0cb19608..00000000 --- a/src/main/java/com/chargebee/v4/models/itemPrice/responses/ApplicableItemPricesForItemPriceResponse.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.chargebee.v4.models.itemPrice.responses; - -import java.util.List; - -import com.chargebee.v4.models.itemPrice.ItemPrice; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.ItemPriceService; -import com.chargebee.v4.models.itemPrice.params.ApplicableItemPricesForItemPriceParams; - -/** - * Immutable response object for ApplicableItemPricesForItemPrice operation. Contains paginated list - * data. - */ -public final class ApplicableItemPricesForItemPriceResponse { - - private final List list; - - private final String nextOffset; - - private final String itemPriceId; - - private final ItemPriceService service; - private final ApplicableItemPricesForItemPriceParams originalParams; - private final Response httpResponse; - - private ApplicableItemPricesForItemPriceResponse( - List list, - String nextOffset, - String itemPriceId, - ItemPriceService service, - ApplicableItemPricesForItemPriceParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.itemPriceId = itemPriceId; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into ApplicableItemPricesForItemPriceResponse object (no service context). - * Use this when you only need to read a single page (no nextPage()). - */ - public static ApplicableItemPricesForItemPriceResponse fromJson(String json) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(ItemPriceApplicableItemPricesForItemPriceItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new ApplicableItemPricesForItemPriceResponse(list, nextOffset, null, null, null, null); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ApplicableItemPricesForItemPriceResponse from JSON", e); - } - } - - /** - * Parse JSON response into ApplicableItemPricesForItemPriceResponse object with service context - * for pagination (enables nextPage()). - */ - public static ApplicableItemPricesForItemPriceResponse fromJson( - String json, - ItemPriceService service, - ApplicableItemPricesForItemPriceParams originalParams, - String itemPriceId, - Response httpResponse) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(ItemPriceApplicableItemPricesForItemPriceItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new ApplicableItemPricesForItemPriceResponse( - list, nextOffset, itemPriceId, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ApplicableItemPricesForItemPriceResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public ApplicableItemPricesForItemPriceResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - ApplicableItemPricesForItemPriceParams nextParams = - (originalParams != null - ? originalParams.toBuilder() - : ApplicableItemPricesForItemPriceParams.builder()) - .offset(nextOffset) - .build(); - - return service.applicableItemPricesForItemPrice(itemPriceId, nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } - - public static class ItemPriceApplicableItemPricesForItemPriceItem { - - private ItemPrice itemPrice; - - public ItemPrice getItemPrice() { - return itemPrice; - } - - public static ItemPriceApplicableItemPricesForItemPriceItem fromJson(String json) { - ItemPriceApplicableItemPricesForItemPriceItem item = - new ItemPriceApplicableItemPricesForItemPriceItem(); - - String __itemPriceJson = JsonUtil.getObject(json, "item_price"); - if (__itemPriceJson != null) { - item.itemPrice = ItemPrice.fromJson(__itemPriceJson); - } - - return item; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/responses/ApplicableItemsForItemPriceResponse.java b/src/main/java/com/chargebee/v4/models/itemPrice/responses/ApplicableItemsForItemPriceResponse.java deleted file mode 100644 index 084152db..00000000 --- a/src/main/java/com/chargebee/v4/models/itemPrice/responses/ApplicableItemsForItemPriceResponse.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.chargebee.v4.models.itemPrice.responses; - -import java.util.List; - -import com.chargebee.v4.models.item.Item; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.ItemPriceService; -import com.chargebee.v4.models.itemPrice.params.ApplicableItemsForItemPriceParams; - -/** - * Immutable response object for ApplicableItemsForItemPrice operation. Contains paginated list - * data. - */ -public final class ApplicableItemsForItemPriceResponse { - - private final List list; - - private final String nextOffset; - - private final String itemPriceId; - - private final ItemPriceService service; - private final ApplicableItemsForItemPriceParams originalParams; - private final Response httpResponse; - - private ApplicableItemsForItemPriceResponse( - List list, - String nextOffset, - String itemPriceId, - ItemPriceService service, - ApplicableItemsForItemPriceParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.itemPriceId = itemPriceId; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into ApplicableItemsForItemPriceResponse object (no service context). Use - * this when you only need to read a single page (no nextPage()). - */ - public static ApplicableItemsForItemPriceResponse fromJson(String json) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(ItemPriceApplicableItemsForItemPriceItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new ApplicableItemsForItemPriceResponse(list, nextOffset, null, null, null, null); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ApplicableItemsForItemPriceResponse from JSON", e); - } - } - - /** - * Parse JSON response into ApplicableItemsForItemPriceResponse object with service context for - * pagination (enables nextPage()). - */ - public static ApplicableItemsForItemPriceResponse fromJson( - String json, - ItemPriceService service, - ApplicableItemsForItemPriceParams originalParams, - String itemPriceId, - Response httpResponse) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(ItemPriceApplicableItemsForItemPriceItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new ApplicableItemsForItemPriceResponse( - list, nextOffset, itemPriceId, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ApplicableItemsForItemPriceResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public ApplicableItemsForItemPriceResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - ApplicableItemsForItemPriceParams nextParams = - (originalParams != null - ? originalParams.toBuilder() - : ApplicableItemsForItemPriceParams.builder()) - .offset(nextOffset) - .build(); - - return service.applicableItemsForItemPrice(itemPriceId, nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } - - public static class ItemPriceApplicableItemsForItemPriceItem { - - private Item item; - - public Item getItem() { - return item; - } - - public static ItemPriceApplicableItemsForItemPriceItem fromJson(String json) { - ItemPriceApplicableItemsForItemPriceItem item = - new ItemPriceApplicableItemsForItemPriceItem(); - - String __itemJson = JsonUtil.getObject(json, "item"); - if (__itemJson != null) { - item.item = Item.fromJson(__itemJson); - } - - return item; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/responses/DeleteItemPriceResponse.java b/src/main/java/com/chargebee/v4/models/itemPrice/responses/DeleteItemPriceResponse.java deleted file mode 100644 index 0ab55c45..00000000 --- a/src/main/java/com/chargebee/v4/models/itemPrice/responses/DeleteItemPriceResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.itemPrice.responses; - -import com.chargebee.v4.models.itemPrice.ItemPrice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteItemPrice operation. Contains the response data from the API. - */ -public final class DeleteItemPriceResponse extends BaseResponse { - private final ItemPrice itemPrice; - - private DeleteItemPriceResponse(Builder builder) { - super(builder.httpResponse); - - this.itemPrice = builder.itemPrice; - } - - /** Parse JSON response into DeleteItemPriceResponse object. */ - public static DeleteItemPriceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteItemPriceResponse object with HTTP response. */ - public static DeleteItemPriceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __itemPriceJson = JsonUtil.getObject(json, "item_price"); - if (__itemPriceJson != null) { - builder.itemPrice(ItemPrice.fromJson(__itemPriceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteItemPriceResponse from JSON", e); - } - } - - /** Create a new builder for DeleteItemPriceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteItemPriceResponse. */ - public static class Builder { - - private ItemPrice itemPrice; - - private Response httpResponse; - - private Builder() {} - - public Builder itemPrice(ItemPrice itemPrice) { - this.itemPrice = itemPrice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteItemPriceResponse build() { - return new DeleteItemPriceResponse(this); - } - } - - /** Get the itemPrice from the response. */ - public ItemPrice getItemPrice() { - return itemPrice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/responses/FindApplicableItemPricesResponse.java b/src/main/java/com/chargebee/v4/models/itemPrice/responses/FindApplicableItemPricesResponse.java new file mode 100644 index 00000000..c9278069 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemPrice/responses/FindApplicableItemPricesResponse.java @@ -0,0 +1,176 @@ +package com.chargebee.v4.models.itemPrice.responses; + +import java.util.List; + +import com.chargebee.v4.models.itemPrice.ItemPrice; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.ItemPriceService; +import com.chargebee.v4.models.itemPrice.params.FindApplicableItemPricesParams; + +/** + * Immutable response object for FindApplicableItemPrices operation. Contains paginated list data. + */ +public final class FindApplicableItemPricesResponse { + + private final List list; + + private final String nextOffset; + + private final String itemPriceId; + + private final ItemPriceService service; + private final FindApplicableItemPricesParams originalParams; + private final Response httpResponse; + + private FindApplicableItemPricesResponse( + List list, + String nextOffset, + String itemPriceId, + ItemPriceService service, + FindApplicableItemPricesParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.itemPriceId = itemPriceId; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into FindApplicableItemPricesResponse object (no service context). Use this + * when you only need to read a single page (no nextPage()). + */ + public static FindApplicableItemPricesResponse fromJson(String json) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(ItemPriceFindApplicableItemPricesItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new FindApplicableItemPricesResponse(list, nextOffset, null, null, null, null); + } catch (Exception e) { + throw new RuntimeException("Failed to parse FindApplicableItemPricesResponse from JSON", e); + } + } + + /** + * Parse JSON response into FindApplicableItemPricesResponse object with service context for + * pagination (enables nextPage()). + */ + public static FindApplicableItemPricesResponse fromJson( + String json, + ItemPriceService service, + FindApplicableItemPricesParams originalParams, + String itemPriceId, + Response httpResponse) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(ItemPriceFindApplicableItemPricesItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new FindApplicableItemPricesResponse( + list, nextOffset, itemPriceId, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException("Failed to parse FindApplicableItemPricesResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public FindApplicableItemPricesResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + FindApplicableItemPricesParams nextParams = + (originalParams != null + ? originalParams.toBuilder() + : FindApplicableItemPricesParams.builder()) + .offset(nextOffset) + .build(); + + return service.findApplicableItemPrices(itemPriceId, nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + public static class ItemPriceFindApplicableItemPricesItem { + + private ItemPrice itemPrice; + + public ItemPrice getItemPrice() { + return itemPrice; + } + + public static ItemPriceFindApplicableItemPricesItem fromJson(String json) { + ItemPriceFindApplicableItemPricesItem item = new ItemPriceFindApplicableItemPricesItem(); + + String __itemPriceJson = JsonUtil.getObject(json, "item_price"); + if (__itemPriceJson != null) { + item.itemPrice = ItemPrice.fromJson(__itemPriceJson); + } + + return item; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/responses/ItemPriceDeleteResponse.java b/src/main/java/com/chargebee/v4/models/itemPrice/responses/ItemPriceDeleteResponse.java new file mode 100644 index 00000000..d024e354 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemPrice/responses/ItemPriceDeleteResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.itemPrice.responses; + +import com.chargebee.v4.models.itemPrice.ItemPrice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for ItemPriceDelete operation. Contains the response data from the API. + */ +public final class ItemPriceDeleteResponse extends BaseResponse { + private final ItemPrice itemPrice; + + private ItemPriceDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.itemPrice = builder.itemPrice; + } + + /** Parse JSON response into ItemPriceDeleteResponse object. */ + public static ItemPriceDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into ItemPriceDeleteResponse object with HTTP response. */ + public static ItemPriceDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __itemPriceJson = JsonUtil.getObject(json, "item_price"); + if (__itemPriceJson != null) { + builder.itemPrice(ItemPrice.fromJson(__itemPriceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse ItemPriceDeleteResponse from JSON", e); + } + } + + /** Create a new builder for ItemPriceDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ItemPriceDeleteResponse. */ + public static class Builder { + + private ItemPrice itemPrice; + + private Response httpResponse; + + private Builder() {} + + public Builder itemPrice(ItemPrice itemPrice) { + this.itemPrice = itemPrice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public ItemPriceDeleteResponse build() { + return new ItemPriceDeleteResponse(this); + } + } + + /** Get the itemPrice from the response. */ + public ItemPrice getItemPrice() { + return itemPrice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/responses/ItemPriceFindApplicableItemsResponse.java b/src/main/java/com/chargebee/v4/models/itemPrice/responses/ItemPriceFindApplicableItemsResponse.java new file mode 100644 index 00000000..ebc6fbd3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemPrice/responses/ItemPriceFindApplicableItemsResponse.java @@ -0,0 +1,179 @@ +package com.chargebee.v4.models.itemPrice.responses; + +import java.util.List; + +import com.chargebee.v4.models.item.Item; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.ItemPriceService; +import com.chargebee.v4.models.itemPrice.params.ItemPriceFindApplicableItemsParams; + +/** + * Immutable response object for ItemPriceFindApplicableItems operation. Contains paginated list + * data. + */ +public final class ItemPriceFindApplicableItemsResponse { + + private final List list; + + private final String nextOffset; + + private final String itemPriceId; + + private final ItemPriceService service; + private final ItemPriceFindApplicableItemsParams originalParams; + private final Response httpResponse; + + private ItemPriceFindApplicableItemsResponse( + List list, + String nextOffset, + String itemPriceId, + ItemPriceService service, + ItemPriceFindApplicableItemsParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.itemPriceId = itemPriceId; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into ItemPriceFindApplicableItemsResponse object (no service context). Use + * this when you only need to read a single page (no nextPage()). + */ + public static ItemPriceFindApplicableItemsResponse fromJson(String json) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(ItemPriceFindApplicableItemsItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new ItemPriceFindApplicableItemsResponse(list, nextOffset, null, null, null, null); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse ItemPriceFindApplicableItemsResponse from JSON", e); + } + } + + /** + * Parse JSON response into ItemPriceFindApplicableItemsResponse object with service context for + * pagination (enables nextPage()). + */ + public static ItemPriceFindApplicableItemsResponse fromJson( + String json, + ItemPriceService service, + ItemPriceFindApplicableItemsParams originalParams, + String itemPriceId, + Response httpResponse) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(ItemPriceFindApplicableItemsItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new ItemPriceFindApplicableItemsResponse( + list, nextOffset, itemPriceId, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse ItemPriceFindApplicableItemsResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public ItemPriceFindApplicableItemsResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + ItemPriceFindApplicableItemsParams nextParams = + (originalParams != null + ? originalParams.toBuilder() + : ItemPriceFindApplicableItemsParams.builder()) + .offset(nextOffset) + .build(); + + return service.findApplicableItems(itemPriceId, nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + public static class ItemPriceFindApplicableItemsItem { + + private Item item; + + public Item getItem() { + return item; + } + + public static ItemPriceFindApplicableItemsItem fromJson(String json) { + ItemPriceFindApplicableItemsItem item = new ItemPriceFindApplicableItemsItem(); + + String __itemJson = JsonUtil.getObject(json, "item"); + if (__itemJson != null) { + item.item = Item.fromJson(__itemJson); + } + + return item; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/responses/ItemPriceListResponse.java b/src/main/java/com/chargebee/v4/models/itemPrice/responses/ItemPriceListResponse.java index a3a793d3..4bc936ac 100644 --- a/src/main/java/com/chargebee/v4/models/itemPrice/responses/ItemPriceListResponse.java +++ b/src/main/java/com/chargebee/v4/models/itemPrice/responses/ItemPriceListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.itemPrice.ItemPrice; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.ItemPriceService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public ItemPriceListResponse nextPage() throws Exception { + public ItemPriceListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/responses/MoveForItemPriceResponse.java b/src/main/java/com/chargebee/v4/models/itemPrice/responses/MoveForItemPriceResponse.java deleted file mode 100644 index f64e3375..00000000 --- a/src/main/java/com/chargebee/v4/models/itemPrice/responses/MoveForItemPriceResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.itemPrice.responses; - -import com.chargebee.v4.models.itemPrice.ItemPrice; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for MoveForItemPrice operation. Contains the response data from the - * API. - */ -public final class MoveForItemPriceResponse extends BaseResponse { - private final ItemPrice itemPrice; - - private MoveForItemPriceResponse(Builder builder) { - super(builder.httpResponse); - - this.itemPrice = builder.itemPrice; - } - - /** Parse JSON response into MoveForItemPriceResponse object. */ - public static MoveForItemPriceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into MoveForItemPriceResponse object with HTTP response. */ - public static MoveForItemPriceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __itemPriceJson = JsonUtil.getObject(json, "item_price"); - if (__itemPriceJson != null) { - builder.itemPrice(ItemPrice.fromJson(__itemPriceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse MoveForItemPriceResponse from JSON", e); - } - } - - /** Create a new builder for MoveForItemPriceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for MoveForItemPriceResponse. */ - public static class Builder { - - private ItemPrice itemPrice; - - private Response httpResponse; - - private Builder() {} - - public Builder itemPrice(ItemPrice itemPrice) { - this.itemPrice = itemPrice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public MoveForItemPriceResponse build() { - return new MoveForItemPriceResponse(this); - } - } - - /** Get the itemPrice from the response. */ - public ItemPrice getItemPrice() { - return itemPrice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/itemPrice/responses/MoveItemPriceResponse.java b/src/main/java/com/chargebee/v4/models/itemPrice/responses/MoveItemPriceResponse.java new file mode 100644 index 00000000..0aa1b7cb --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/itemPrice/responses/MoveItemPriceResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.itemPrice.responses; + +import com.chargebee.v4.models.itemPrice.ItemPrice; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for MoveItemPrice operation. Contains the response data from the API. + */ +public final class MoveItemPriceResponse extends BaseResponse { + private final ItemPrice itemPrice; + + private MoveItemPriceResponse(Builder builder) { + super(builder.httpResponse); + + this.itemPrice = builder.itemPrice; + } + + /** Parse JSON response into MoveItemPriceResponse object. */ + public static MoveItemPriceResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into MoveItemPriceResponse object with HTTP response. */ + public static MoveItemPriceResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __itemPriceJson = JsonUtil.getObject(json, "item_price"); + if (__itemPriceJson != null) { + builder.itemPrice(ItemPrice.fromJson(__itemPriceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse MoveItemPriceResponse from JSON", e); + } + } + + /** Create a new builder for MoveItemPriceResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for MoveItemPriceResponse. */ + public static class Builder { + + private ItemPrice itemPrice; + + private Response httpResponse; + + private Builder() {} + + public Builder itemPrice(ItemPrice itemPrice) { + this.itemPrice = itemPrice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public MoveItemPriceResponse build() { + return new MoveItemPriceResponse(this); + } + } + + /** Get the itemPrice from the response. */ + public ItemPrice getItemPrice() { + return itemPrice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/media/params/AddMediaForItemParams.java b/src/main/java/com/chargebee/v4/models/media/params/AddMediaForItemParams.java deleted file mode 100644 index 02cee25d..00000000 --- a/src/main/java/com/chargebee/v4/models/media/params/AddMediaForItemParams.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.media.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AddMediaForItemParams { - - private final String url; - - private final String id; - - private final String altText; - - private AddMediaForItemParams(AddMediaForItemBuilder builder) { - - this.url = builder.url; - - this.id = builder.id; - - this.altText = builder.altText; - } - - public String getUrl() { - return url; - } - - public String getId() { - return id; - } - - public String getAltText() { - return altText; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.url != null) { - - formData.put("url", this.url); - } - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.altText != null) { - - formData.put("alt_text", this.altText); - } - - return formData; - } - - /** Create a new builder for AddMediaForItemParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddMediaForItemBuilder builder() { - return new AddMediaForItemBuilder(); - } - - public static final class AddMediaForItemBuilder { - - private String url; - - private String id; - - private String altText; - - private AddMediaForItemBuilder() {} - - public AddMediaForItemBuilder url(String value) { - this.url = value; - return this; - } - - public AddMediaForItemBuilder id(String value) { - this.id = value; - return this; - } - - public AddMediaForItemBuilder altText(String value) { - this.altText = value; - return this; - } - - public AddMediaForItemParams build() { - return new AddMediaForItemParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/media/params/CreateMediaAndAttachToItemParams.java b/src/main/java/com/chargebee/v4/models/media/params/CreateMediaAndAttachToItemParams.java new file mode 100644 index 00000000..92dba1a0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/media/params/CreateMediaAndAttachToItemParams.java @@ -0,0 +1,100 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.media.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreateMediaAndAttachToItemParams { + + private final String url; + + private final String id; + + private final String altText; + + private CreateMediaAndAttachToItemParams(CreateMediaAndAttachToItemBuilder builder) { + + this.url = builder.url; + + this.id = builder.id; + + this.altText = builder.altText; + } + + public String getUrl() { + return url; + } + + public String getId() { + return id; + } + + public String getAltText() { + return altText; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.url != null) { + + formData.put("url", this.url); + } + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.altText != null) { + + formData.put("alt_text", this.altText); + } + + return formData; + } + + /** Create a new builder for CreateMediaAndAttachToItemParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreateMediaAndAttachToItemBuilder builder() { + return new CreateMediaAndAttachToItemBuilder(); + } + + public static final class CreateMediaAndAttachToItemBuilder { + + private String url; + + private String id; + + private String altText; + + private CreateMediaAndAttachToItemBuilder() {} + + public CreateMediaAndAttachToItemBuilder url(String value) { + this.url = value; + return this; + } + + public CreateMediaAndAttachToItemBuilder id(String value) { + this.id = value; + return this; + } + + public CreateMediaAndAttachToItemBuilder altText(String value) { + this.altText = value; + return this; + } + + public CreateMediaAndAttachToItemParams build() { + return new CreateMediaAndAttachToItemParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/media/responses/AddMediaForItemResponse.java b/src/main/java/com/chargebee/v4/models/media/responses/AddMediaForItemResponse.java deleted file mode 100644 index f4f4bc26..00000000 --- a/src/main/java/com/chargebee/v4/models/media/responses/AddMediaForItemResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.media.responses; - -import com.chargebee.v4.models.media.Media; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddMediaForItem operation. Contains the response data from the API. - */ -public final class AddMediaForItemResponse extends BaseResponse { - private final Media media; - - private AddMediaForItemResponse(Builder builder) { - super(builder.httpResponse); - - this.media = builder.media; - } - - /** Parse JSON response into AddMediaForItemResponse object. */ - public static AddMediaForItemResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddMediaForItemResponse object with HTTP response. */ - public static AddMediaForItemResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __mediaJson = JsonUtil.getObject(json, "media"); - if (__mediaJson != null) { - builder.media(Media.fromJson(__mediaJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddMediaForItemResponse from JSON", e); - } - } - - /** Create a new builder for AddMediaForItemResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddMediaForItemResponse. */ - public static class Builder { - - private Media media; - - private Response httpResponse; - - private Builder() {} - - public Builder media(Media media) { - this.media = media; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddMediaForItemResponse build() { - return new AddMediaForItemResponse(this); - } - } - - /** Get the media from the response. */ - public Media getMedia() { - return media; - } -} diff --git a/src/main/java/com/chargebee/v4/models/media/responses/CreateMediaAndAttachToItemResponse.java b/src/main/java/com/chargebee/v4/models/media/responses/CreateMediaAndAttachToItemResponse.java new file mode 100644 index 00000000..61eaf760 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/media/responses/CreateMediaAndAttachToItemResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.media.responses; + +import com.chargebee.v4.models.media.Media; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreateMediaAndAttachToItem operation. Contains the response data + * from the API. + */ +public final class CreateMediaAndAttachToItemResponse extends BaseResponse { + private final Media media; + + private CreateMediaAndAttachToItemResponse(Builder builder) { + super(builder.httpResponse); + + this.media = builder.media; + } + + /** Parse JSON response into CreateMediaAndAttachToItemResponse object. */ + public static CreateMediaAndAttachToItemResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreateMediaAndAttachToItemResponse object with HTTP response. */ + public static CreateMediaAndAttachToItemResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __mediaJson = JsonUtil.getObject(json, "media"); + if (__mediaJson != null) { + builder.media(Media.fromJson(__mediaJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreateMediaAndAttachToItemResponse from JSON", e); + } + } + + /** Create a new builder for CreateMediaAndAttachToItemResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreateMediaAndAttachToItemResponse. */ + public static class Builder { + + private Media media; + + private Response httpResponse; + + private Builder() {} + + public Builder media(Media media) { + this.media = media; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreateMediaAndAttachToItemResponse build() { + return new CreateMediaAndAttachToItemResponse(this); + } + } + + /** Get the media from the response. */ + public Media getMedia() { + return media; + } +} diff --git a/src/main/java/com/chargebee/v4/models/nonSubscription/params/NonSubscriptionProcessReceiptParams.java b/src/main/java/com/chargebee/v4/models/nonSubscription/params/NonSubscriptionProcessReceiptParams.java new file mode 100644 index 00000000..aae053b3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/nonSubscription/params/NonSubscriptionProcessReceiptParams.java @@ -0,0 +1,396 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.nonSubscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class NonSubscriptionProcessReceiptParams { + + private final String receipt; + + private final ProductParams product; + + private final CustomerParams customer; + + private NonSubscriptionProcessReceiptParams(NonSubscriptionProcessReceiptBuilder builder) { + + this.receipt = builder.receipt; + + this.product = builder.product; + + this.customer = builder.customer; + } + + public String getReceipt() { + return receipt; + } + + public ProductParams getProduct() { + return product; + } + + public CustomerParams getCustomer() { + return customer; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.receipt != null) { + + formData.put("receipt", this.receipt); + } + + if (this.product != null) { + + // Single object + Map nestedData = this.product.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "product[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.customer != null) { + + // Single object + Map nestedData = this.customer.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "customer[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for NonSubscriptionProcessReceiptParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static NonSubscriptionProcessReceiptBuilder builder() { + return new NonSubscriptionProcessReceiptBuilder(); + } + + public static final class NonSubscriptionProcessReceiptBuilder { + + private String receipt; + + private ProductParams product; + + private CustomerParams customer; + + private NonSubscriptionProcessReceiptBuilder() {} + + public NonSubscriptionProcessReceiptBuilder receipt(String value) { + this.receipt = value; + return this; + } + + public NonSubscriptionProcessReceiptBuilder product(ProductParams value) { + this.product = value; + return this; + } + + public NonSubscriptionProcessReceiptBuilder customer(CustomerParams value) { + this.customer = value; + return this; + } + + public NonSubscriptionProcessReceiptParams build() { + return new NonSubscriptionProcessReceiptParams(this); + } + } + + public static final class ProductParams { + + private final String id; + + private final String currencyCode; + + private final Integer price; + + private final Type type; + + private final String name; + + private final String priceInDecimal; + + private ProductParams(ProductBuilder builder) { + + this.id = builder.id; + + this.currencyCode = builder.currencyCode; + + this.price = builder.price; + + this.type = builder.type; + + this.name = builder.name; + + this.priceInDecimal = builder.priceInDecimal; + } + + public String getId() { + return id; + } + + public String getCurrencyCode() { + return currencyCode; + } + + public Integer getPrice() { + return price; + } + + public Type getType() { + return type; + } + + public String getName() { + return name; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.currencyCode != null) { + + formData.put("currency_code", this.currencyCode); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.type != null) { + + formData.put("type", this.type); + } + + if (this.name != null) { + + formData.put("name", this.name); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + return formData; + } + + /** Create a new builder for ProductParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ProductBuilder builder() { + return new ProductBuilder(); + } + + public static final class ProductBuilder { + + private String id; + + private String currencyCode; + + private Integer price; + + private Type type; + + private String name; + + private String priceInDecimal; + + private ProductBuilder() {} + + public ProductBuilder id(String value) { + this.id = value; + return this; + } + + public ProductBuilder currencyCode(String value) { + this.currencyCode = value; + return this; + } + + public ProductBuilder price(Integer value) { + this.price = value; + return this; + } + + public ProductBuilder type(Type value) { + this.type = value; + return this; + } + + public ProductBuilder name(String value) { + this.name = value; + return this; + } + + public ProductBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ProductParams build() { + return new ProductParams(this); + } + } + + public enum Type { + CONSUMABLE("consumable"), + + NON_CONSUMABLE("non_consumable"), + + NON_RENEWING_SUBSCRIPTION("non_renewing_subscription"), + + /** An enum member indicating that Type was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Type(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Type fromString(String value) { + if (value == null) return _UNKNOWN; + for (Type enumValue : Type.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CustomerParams { + + private final String id; + + private final String email; + + private final String firstName; + + private final String lastName; + + private CustomerParams(CustomerBuilder builder) { + + this.id = builder.id; + + this.email = builder.email; + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + } + + public String getId() { + return id; + } + + public String getEmail() { + return email; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + return formData; + } + + /** Create a new builder for CustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerBuilder builder() { + return new CustomerBuilder(); + } + + public static final class CustomerBuilder { + + private String id; + + private String email; + + private String firstName; + + private String lastName; + + private CustomerBuilder() {} + + public CustomerBuilder id(String value) { + this.id = value; + return this; + } + + public CustomerBuilder email(String value) { + this.email = value; + return this; + } + + public CustomerBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public CustomerBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public CustomerParams build() { + return new CustomerParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/nonSubscription/params/OneTimePurchaseForNonSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/nonSubscription/params/OneTimePurchaseForNonSubscriptionParams.java deleted file mode 100644 index e32be8db..00000000 --- a/src/main/java/com/chargebee/v4/models/nonSubscription/params/OneTimePurchaseForNonSubscriptionParams.java +++ /dev/null @@ -1,397 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.nonSubscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class OneTimePurchaseForNonSubscriptionParams { - - private final String receipt; - - private final ProductParams product; - - private final CustomerParams customer; - - private OneTimePurchaseForNonSubscriptionParams( - OneTimePurchaseForNonSubscriptionBuilder builder) { - - this.receipt = builder.receipt; - - this.product = builder.product; - - this.customer = builder.customer; - } - - public String getReceipt() { - return receipt; - } - - public ProductParams getProduct() { - return product; - } - - public CustomerParams getCustomer() { - return customer; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.receipt != null) { - - formData.put("receipt", this.receipt); - } - - if (this.product != null) { - - // Single object - Map nestedData = this.product.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "product[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.customer != null) { - - // Single object - Map nestedData = this.customer.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "customer[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for OneTimePurchaseForNonSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static OneTimePurchaseForNonSubscriptionBuilder builder() { - return new OneTimePurchaseForNonSubscriptionBuilder(); - } - - public static final class OneTimePurchaseForNonSubscriptionBuilder { - - private String receipt; - - private ProductParams product; - - private CustomerParams customer; - - private OneTimePurchaseForNonSubscriptionBuilder() {} - - public OneTimePurchaseForNonSubscriptionBuilder receipt(String value) { - this.receipt = value; - return this; - } - - public OneTimePurchaseForNonSubscriptionBuilder product(ProductParams value) { - this.product = value; - return this; - } - - public OneTimePurchaseForNonSubscriptionBuilder customer(CustomerParams value) { - this.customer = value; - return this; - } - - public OneTimePurchaseForNonSubscriptionParams build() { - return new OneTimePurchaseForNonSubscriptionParams(this); - } - } - - public static final class ProductParams { - - private final String id; - - private final String currencyCode; - - private final Integer price; - - private final Type type; - - private final String name; - - private final String priceInDecimal; - - private ProductParams(ProductBuilder builder) { - - this.id = builder.id; - - this.currencyCode = builder.currencyCode; - - this.price = builder.price; - - this.type = builder.type; - - this.name = builder.name; - - this.priceInDecimal = builder.priceInDecimal; - } - - public String getId() { - return id; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public Integer getPrice() { - return price; - } - - public Type getType() { - return type; - } - - public String getName() { - return name; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.currencyCode != null) { - - formData.put("currency_code", this.currencyCode); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.type != null) { - - formData.put("type", this.type); - } - - if (this.name != null) { - - formData.put("name", this.name); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - return formData; - } - - /** Create a new builder for ProductParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ProductBuilder builder() { - return new ProductBuilder(); - } - - public static final class ProductBuilder { - - private String id; - - private String currencyCode; - - private Integer price; - - private Type type; - - private String name; - - private String priceInDecimal; - - private ProductBuilder() {} - - public ProductBuilder id(String value) { - this.id = value; - return this; - } - - public ProductBuilder currencyCode(String value) { - this.currencyCode = value; - return this; - } - - public ProductBuilder price(Integer value) { - this.price = value; - return this; - } - - public ProductBuilder type(Type value) { - this.type = value; - return this; - } - - public ProductBuilder name(String value) { - this.name = value; - return this; - } - - public ProductBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ProductParams build() { - return new ProductParams(this); - } - } - - public enum Type { - CONSUMABLE("consumable"), - - NON_CONSUMABLE("non_consumable"), - - NON_RENEWING_SUBSCRIPTION("non_renewing_subscription"), - - /** An enum member indicating that Type was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Type(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Type fromString(String value) { - if (value == null) return _UNKNOWN; - for (Type enumValue : Type.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CustomerParams { - - private final String id; - - private final String email; - - private final String firstName; - - private final String lastName; - - private CustomerParams(CustomerBuilder builder) { - - this.id = builder.id; - - this.email = builder.email; - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - } - - public String getId() { - return id; - } - - public String getEmail() { - return email; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - return formData; - } - - /** Create a new builder for CustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CustomerBuilder builder() { - return new CustomerBuilder(); - } - - public static final class CustomerBuilder { - - private String id; - - private String email; - - private String firstName; - - private String lastName; - - private CustomerBuilder() {} - - public CustomerBuilder id(String value) { - this.id = value; - return this; - } - - public CustomerBuilder email(String value) { - this.email = value; - return this; - } - - public CustomerBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public CustomerBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public CustomerParams build() { - return new CustomerParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/nonSubscription/responses/NonSubscriptionProcessReceiptResponse.java b/src/main/java/com/chargebee/v4/models/nonSubscription/responses/NonSubscriptionProcessReceiptResponse.java new file mode 100644 index 00000000..19e6b131 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/nonSubscription/responses/NonSubscriptionProcessReceiptResponse.java @@ -0,0 +1,78 @@ +package com.chargebee.v4.models.nonSubscription.responses; + +import com.chargebee.v4.models.nonSubscription.NonSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for NonSubscriptionProcessReceipt operation. Contains the response data + * from the API. + */ +public final class NonSubscriptionProcessReceiptResponse extends BaseResponse { + private final NonSubscription nonSubscription; + + private NonSubscriptionProcessReceiptResponse(Builder builder) { + super(builder.httpResponse); + + this.nonSubscription = builder.nonSubscription; + } + + /** Parse JSON response into NonSubscriptionProcessReceiptResponse object. */ + public static NonSubscriptionProcessReceiptResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into NonSubscriptionProcessReceiptResponse object with HTTP response. */ + public static NonSubscriptionProcessReceiptResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __nonSubscriptionJson = JsonUtil.getObject(json, "non_subscription"); + if (__nonSubscriptionJson != null) { + builder.nonSubscription(NonSubscription.fromJson(__nonSubscriptionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse NonSubscriptionProcessReceiptResponse from JSON", e); + } + } + + /** Create a new builder for NonSubscriptionProcessReceiptResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for NonSubscriptionProcessReceiptResponse. */ + public static class Builder { + + private NonSubscription nonSubscription; + + private Response httpResponse; + + private Builder() {} + + public Builder nonSubscription(NonSubscription nonSubscription) { + this.nonSubscription = nonSubscription; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public NonSubscriptionProcessReceiptResponse build() { + return new NonSubscriptionProcessReceiptResponse(this); + } + } + + /** Get the nonSubscription from the response. */ + public NonSubscription getNonSubscription() { + return nonSubscription; + } +} diff --git a/src/main/java/com/chargebee/v4/models/nonSubscription/responses/OneTimePurchaseForNonSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/nonSubscription/responses/OneTimePurchaseForNonSubscriptionResponse.java deleted file mode 100644 index db48639d..00000000 --- a/src/main/java/com/chargebee/v4/models/nonSubscription/responses/OneTimePurchaseForNonSubscriptionResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.nonSubscription.responses; - -import com.chargebee.v4.models.nonSubscription.NonSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for OneTimePurchaseForNonSubscription operation. Contains the response - * data from the API. - */ -public final class OneTimePurchaseForNonSubscriptionResponse extends BaseResponse { - private final NonSubscription nonSubscription; - - private OneTimePurchaseForNonSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.nonSubscription = builder.nonSubscription; - } - - /** Parse JSON response into OneTimePurchaseForNonSubscriptionResponse object. */ - public static OneTimePurchaseForNonSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into OneTimePurchaseForNonSubscriptionResponse object with HTTP response. - */ - public static OneTimePurchaseForNonSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __nonSubscriptionJson = JsonUtil.getObject(json, "non_subscription"); - if (__nonSubscriptionJson != null) { - builder.nonSubscription(NonSubscription.fromJson(__nonSubscriptionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse OneTimePurchaseForNonSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for OneTimePurchaseForNonSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for OneTimePurchaseForNonSubscriptionResponse. */ - public static class Builder { - - private NonSubscription nonSubscription; - - private Response httpResponse; - - private Builder() {} - - public Builder nonSubscription(NonSubscription nonSubscription) { - this.nonSubscription = nonSubscription; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public OneTimePurchaseForNonSubscriptionResponse build() { - return new OneTimePurchaseForNonSubscriptionResponse(this); - } - } - - /** Get the nonSubscription from the response. */ - public NonSubscription getNonSubscription() { - return nonSubscription; - } -} diff --git a/src/main/java/com/chargebee/v4/models/offerEvent/params/OfferEventCreateParams.java b/src/main/java/com/chargebee/v4/models/offerEvent/params/OfferEventCreateParams.java deleted file mode 100644 index 789efbf0..00000000 --- a/src/main/java/com/chargebee/v4/models/offerEvent/params/OfferEventCreateParams.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.offerEvent.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class OfferEventCreateParams { - - private final String personalizedOfferId; - - private final Type type; - - private OfferEventCreateParams(OfferEventCreateBuilder builder) { - - this.personalizedOfferId = builder.personalizedOfferId; - - this.type = builder.type; - } - - public String getPersonalizedOfferId() { - return personalizedOfferId; - } - - public Type getType() { - return type; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.personalizedOfferId != null) { - - formData.put("personalized_offer_id", this.personalizedOfferId); - } - - if (this.type != null) { - - formData.put("type", this.type); - } - - return formData; - } - - /** Create a new builder for OfferEventCreateParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static OfferEventCreateBuilder builder() { - return new OfferEventCreateBuilder(); - } - - public static final class OfferEventCreateBuilder { - - private String personalizedOfferId; - - private Type type; - - private OfferEventCreateBuilder() {} - - public OfferEventCreateBuilder personalizedOfferId(String value) { - this.personalizedOfferId = value; - return this; - } - - public OfferEventCreateBuilder type(Type value) { - this.type = value; - return this; - } - - public OfferEventCreateParams build() { - return new OfferEventCreateParams(this); - } - } - - public enum Type { - VIEWED("viewed"), - - DISMISSED("dismissed"), - - /** An enum member indicating that Type was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Type(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Type fromString(String value) { - if (value == null) return _UNKNOWN; - for (Type enumValue : Type.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/offerEvent/params/OfferEventsParams.java b/src/main/java/com/chargebee/v4/models/offerEvent/params/OfferEventsParams.java new file mode 100644 index 00000000..c50bfb05 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/offerEvent/params/OfferEventsParams.java @@ -0,0 +1,108 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.offerEvent.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class OfferEventsParams { + + private final String personalizedOfferId; + + private final Type type; + + private OfferEventsParams(OfferEventsBuilder builder) { + + this.personalizedOfferId = builder.personalizedOfferId; + + this.type = builder.type; + } + + public String getPersonalizedOfferId() { + return personalizedOfferId; + } + + public Type getType() { + return type; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.personalizedOfferId != null) { + + formData.put("personalized_offer_id", this.personalizedOfferId); + } + + if (this.type != null) { + + formData.put("type", this.type); + } + + return formData; + } + + /** Create a new builder for OfferEventsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OfferEventsBuilder builder() { + return new OfferEventsBuilder(); + } + + public static final class OfferEventsBuilder { + + private String personalizedOfferId; + + private Type type; + + private OfferEventsBuilder() {} + + public OfferEventsBuilder personalizedOfferId(String value) { + this.personalizedOfferId = value; + return this; + } + + public OfferEventsBuilder type(Type value) { + this.type = value; + return this; + } + + public OfferEventsParams build() { + return new OfferEventsParams(this); + } + } + + public enum Type { + VIEWED("viewed"), + + DISMISSED("dismissed"), + + /** An enum member indicating that Type was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Type(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Type fromString(String value) { + if (value == null) return _UNKNOWN; + for (Type enumValue : Type.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/offerEvent/responses/OfferEventCreateResponse.java b/src/main/java/com/chargebee/v4/models/offerEvent/responses/OfferEventCreateResponse.java deleted file mode 100644 index aaac3881..00000000 --- a/src/main/java/com/chargebee/v4/models/offerEvent/responses/OfferEventCreateResponse.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.chargebee.v4.models.offerEvent.responses; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for OfferEventCreate operation. Contains the response data from the - * API. - */ -public final class OfferEventCreateResponse extends BaseResponse { - - private OfferEventCreateResponse(Builder builder) { - super(builder.httpResponse); - } - - /** Parse JSON response into OfferEventCreateResponse object. */ - public static OfferEventCreateResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into OfferEventCreateResponse object with HTTP response. */ - public static OfferEventCreateResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse OfferEventCreateResponse from JSON", e); - } - } - - /** Create a new builder for OfferEventCreateResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for OfferEventCreateResponse. */ - public static class Builder { - - private Response httpResponse; - - private Builder() {} - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public OfferEventCreateResponse build() { - return new OfferEventCreateResponse(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/offerEvent/responses/OfferEventsResponse.java b/src/main/java/com/chargebee/v4/models/offerEvent/responses/OfferEventsResponse.java new file mode 100644 index 00000000..d4af3944 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/offerEvent/responses/OfferEventsResponse.java @@ -0,0 +1,51 @@ +package com.chargebee.v4.models.offerEvent.responses; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for OfferEvents operation. Contains the response data from the API. */ +public final class OfferEventsResponse extends BaseResponse { + + private OfferEventsResponse(Builder builder) { + super(builder.httpResponse); + } + + /** Parse JSON response into OfferEventsResponse object. */ + public static OfferEventsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into OfferEventsResponse object with HTTP response. */ + public static OfferEventsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse OfferEventsResponse from JSON", e); + } + } + + /** Create a new builder for OfferEventsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for OfferEventsResponse. */ + public static class Builder { + + private Response httpResponse; + + private Builder() {} + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public OfferEventsResponse build() { + return new OfferEventsResponse(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentCreateParams.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentCreateParams.java deleted file mode 100644 index 48212b82..00000000 --- a/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentCreateParams.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.offerFulfillment.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class OfferFulfillmentCreateParams { - - private final String personalizedOfferId; - - private final String optionId; - - private OfferFulfillmentCreateParams(OfferFulfillmentCreateBuilder builder) { - - this.personalizedOfferId = builder.personalizedOfferId; - - this.optionId = builder.optionId; - } - - public String getPersonalizedOfferId() { - return personalizedOfferId; - } - - public String getOptionId() { - return optionId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.personalizedOfferId != null) { - - formData.put("personalized_offer_id", this.personalizedOfferId); - } - - if (this.optionId != null) { - - formData.put("option_id", this.optionId); - } - - return formData; - } - - /** Create a new builder for OfferFulfillmentCreateParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static OfferFulfillmentCreateBuilder builder() { - return new OfferFulfillmentCreateBuilder(); - } - - public static final class OfferFulfillmentCreateBuilder { - - private String personalizedOfferId; - - private String optionId; - - private OfferFulfillmentCreateBuilder() {} - - public OfferFulfillmentCreateBuilder personalizedOfferId(String value) { - this.personalizedOfferId = value; - return this; - } - - public OfferFulfillmentCreateBuilder optionId(String value) { - this.optionId = value; - return this; - } - - public OfferFulfillmentCreateParams build() { - return new OfferFulfillmentCreateParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentRetrieveParams.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentRetrieveParams.java deleted file mode 100644 index 4f880149..00000000 --- a/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentRetrieveParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.offerFulfillment.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class OfferFulfillmentRetrieveParams { - - private final Map queryParams; - - private OfferFulfillmentRetrieveParams(OfferFulfillmentRetrieveBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public OfferFulfillmentRetrieveBuilder toBuilder() { - OfferFulfillmentRetrieveBuilder builder = new OfferFulfillmentRetrieveBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for OfferFulfillmentRetrieveParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static OfferFulfillmentRetrieveBuilder builder() { - return new OfferFulfillmentRetrieveBuilder(); - } - - public static final class OfferFulfillmentRetrieveBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private OfferFulfillmentRetrieveBuilder() {} - - public OfferFulfillmentRetrieveParams build() { - return new OfferFulfillmentRetrieveParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentUpdateParams.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentUpdateParams.java deleted file mode 100644 index 6f37af1e..00000000 --- a/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentUpdateParams.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.offerFulfillment.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class OfferFulfillmentUpdateParams { - - private final String id; - - private final Status status; - - private final String failureReason; - - private OfferFulfillmentUpdateParams(OfferFulfillmentUpdateBuilder builder) { - - this.id = builder.id; - - this.status = builder.status; - - this.failureReason = builder.failureReason; - } - - public String getId() { - return id; - } - - public Status getStatus() { - return status; - } - - public String getFailureReason() { - return failureReason; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.status != null) { - - formData.put("status", this.status); - } - - if (this.failureReason != null) { - - formData.put("failure_reason", this.failureReason); - } - - return formData; - } - - /** Create a new builder for OfferFulfillmentUpdateParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static OfferFulfillmentUpdateBuilder builder() { - return new OfferFulfillmentUpdateBuilder(); - } - - public static final class OfferFulfillmentUpdateBuilder { - - private String id; - - private Status status; - - private String failureReason; - - private OfferFulfillmentUpdateBuilder() {} - - public OfferFulfillmentUpdateBuilder id(String value) { - this.id = value; - return this; - } - - public OfferFulfillmentUpdateBuilder status(Status value) { - this.status = value; - return this; - } - - public OfferFulfillmentUpdateBuilder failureReason(String value) { - this.failureReason = value; - return this; - } - - public OfferFulfillmentUpdateParams build() { - return new OfferFulfillmentUpdateParams(this); - } - } - - public enum Status { - COMPLETED("completed"), - - FAILED("failed"), - - /** An enum member indicating that Status was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Status(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Status fromString(String value) { - if (value == null) return _UNKNOWN; - for (Status enumValue : Status.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentsGetParams.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentsGetParams.java new file mode 100644 index 00000000..5f307842 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentsGetParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.offerFulfillment.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class OfferFulfillmentsGetParams { + + private final Map queryParams; + + private OfferFulfillmentsGetParams(OfferFulfillmentsGetBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public OfferFulfillmentsGetBuilder toBuilder() { + OfferFulfillmentsGetBuilder builder = new OfferFulfillmentsGetBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for OfferFulfillmentsGetParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OfferFulfillmentsGetBuilder builder() { + return new OfferFulfillmentsGetBuilder(); + } + + public static final class OfferFulfillmentsGetBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private OfferFulfillmentsGetBuilder() {} + + public OfferFulfillmentsGetParams build() { + return new OfferFulfillmentsGetParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentsParams.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentsParams.java new file mode 100644 index 00000000..aac85227 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentsParams.java @@ -0,0 +1,80 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.offerFulfillment.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class OfferFulfillmentsParams { + + private final String personalizedOfferId; + + private final String optionId; + + private OfferFulfillmentsParams(OfferFulfillmentsBuilder builder) { + + this.personalizedOfferId = builder.personalizedOfferId; + + this.optionId = builder.optionId; + } + + public String getPersonalizedOfferId() { + return personalizedOfferId; + } + + public String getOptionId() { + return optionId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.personalizedOfferId != null) { + + formData.put("personalized_offer_id", this.personalizedOfferId); + } + + if (this.optionId != null) { + + formData.put("option_id", this.optionId); + } + + return formData; + } + + /** Create a new builder for OfferFulfillmentsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OfferFulfillmentsBuilder builder() { + return new OfferFulfillmentsBuilder(); + } + + public static final class OfferFulfillmentsBuilder { + + private String personalizedOfferId; + + private String optionId; + + private OfferFulfillmentsBuilder() {} + + public OfferFulfillmentsBuilder personalizedOfferId(String value) { + this.personalizedOfferId = value; + return this; + } + + public OfferFulfillmentsBuilder optionId(String value) { + this.optionId = value; + return this; + } + + public OfferFulfillmentsParams build() { + return new OfferFulfillmentsParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentsUpdateParams.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentsUpdateParams.java new file mode 100644 index 00000000..18ee2825 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/offerFulfillment/params/OfferFulfillmentsUpdateParams.java @@ -0,0 +1,128 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.offerFulfillment.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class OfferFulfillmentsUpdateParams { + + private final String id; + + private final Status status; + + private final String failureReason; + + private OfferFulfillmentsUpdateParams(OfferFulfillmentsUpdateBuilder builder) { + + this.id = builder.id; + + this.status = builder.status; + + this.failureReason = builder.failureReason; + } + + public String getId() { + return id; + } + + public Status getStatus() { + return status; + } + + public String getFailureReason() { + return failureReason; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.status != null) { + + formData.put("status", this.status); + } + + if (this.failureReason != null) { + + formData.put("failure_reason", this.failureReason); + } + + return formData; + } + + /** Create a new builder for OfferFulfillmentsUpdateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OfferFulfillmentsUpdateBuilder builder() { + return new OfferFulfillmentsUpdateBuilder(); + } + + public static final class OfferFulfillmentsUpdateBuilder { + + private String id; + + private Status status; + + private String failureReason; + + private OfferFulfillmentsUpdateBuilder() {} + + public OfferFulfillmentsUpdateBuilder id(String value) { + this.id = value; + return this; + } + + public OfferFulfillmentsUpdateBuilder status(Status value) { + this.status = value; + return this; + } + + public OfferFulfillmentsUpdateBuilder failureReason(String value) { + this.failureReason = value; + return this; + } + + public OfferFulfillmentsUpdateParams build() { + return new OfferFulfillmentsUpdateParams(this); + } + } + + public enum Status { + COMPLETED("completed"), + + FAILED("failed"), + + /** An enum member indicating that Status was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Status(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Status fromString(String value) { + if (value == null) return _UNKNOWN; + for (Status enumValue : Status.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentCreateResponse.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentCreateResponse.java deleted file mode 100644 index c5d48431..00000000 --- a/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentCreateResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.offerFulfillment.responses; - -import com.chargebee.v4.models.offerFulfillment.OfferFulfillment; - -import com.chargebee.v4.models.hostedPage.HostedPage; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for OfferFulfillmentCreate operation. Contains the response data from - * the API. - */ -public final class OfferFulfillmentCreateResponse extends BaseResponse { - private final OfferFulfillment offerFulfillment; - - private final HostedPage hostedPage; - - private OfferFulfillmentCreateResponse(Builder builder) { - super(builder.httpResponse); - - this.offerFulfillment = builder.offerFulfillment; - - this.hostedPage = builder.hostedPage; - } - - /** Parse JSON response into OfferFulfillmentCreateResponse object. */ - public static OfferFulfillmentCreateResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into OfferFulfillmentCreateResponse object with HTTP response. */ - public static OfferFulfillmentCreateResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __offerFulfillmentJson = JsonUtil.getObject(json, "offer_fulfillment"); - if (__offerFulfillmentJson != null) { - builder.offerFulfillment(OfferFulfillment.fromJson(__offerFulfillmentJson)); - } - - String __hostedPageJson = JsonUtil.getObject(json, "hosted_page"); - if (__hostedPageJson != null) { - builder.hostedPage(HostedPage.fromJson(__hostedPageJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse OfferFulfillmentCreateResponse from JSON", e); - } - } - - /** Create a new builder for OfferFulfillmentCreateResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for OfferFulfillmentCreateResponse. */ - public static class Builder { - - private OfferFulfillment offerFulfillment; - - private HostedPage hostedPage; - - private Response httpResponse; - - private Builder() {} - - public Builder offerFulfillment(OfferFulfillment offerFulfillment) { - this.offerFulfillment = offerFulfillment; - return this; - } - - public Builder hostedPage(HostedPage hostedPage) { - this.hostedPage = hostedPage; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public OfferFulfillmentCreateResponse build() { - return new OfferFulfillmentCreateResponse(this); - } - } - - /** Get the offerFulfillment from the response. */ - public OfferFulfillment getOfferFulfillment() { - return offerFulfillment; - } - - /** Get the hostedPage from the response. */ - public HostedPage getHostedPage() { - return hostedPage; - } -} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentRetrieveResponse.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentRetrieveResponse.java deleted file mode 100644 index a921c734..00000000 --- a/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentRetrieveResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.offerFulfillment.responses; - -import com.chargebee.v4.models.offerFulfillment.OfferFulfillment; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for OfferFulfillmentRetrieve operation. Contains the response data from - * a single resource get operation. - */ -public final class OfferFulfillmentRetrieveResponse extends BaseResponse { - private final OfferFulfillment offerFulfillment; - - private OfferFulfillmentRetrieveResponse(Builder builder) { - super(builder.httpResponse); - - this.offerFulfillment = builder.offerFulfillment; - } - - /** Parse JSON response into OfferFulfillmentRetrieveResponse object. */ - public static OfferFulfillmentRetrieveResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into OfferFulfillmentRetrieveResponse object with HTTP response. */ - public static OfferFulfillmentRetrieveResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __offerFulfillmentJson = JsonUtil.getObject(json, "offer_fulfillment"); - if (__offerFulfillmentJson != null) { - builder.offerFulfillment(OfferFulfillment.fromJson(__offerFulfillmentJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse OfferFulfillmentRetrieveResponse from JSON", e); - } - } - - /** Create a new builder for OfferFulfillmentRetrieveResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for OfferFulfillmentRetrieveResponse. */ - public static class Builder { - - private OfferFulfillment offerFulfillment; - - private Response httpResponse; - - private Builder() {} - - public Builder offerFulfillment(OfferFulfillment offerFulfillment) { - this.offerFulfillment = offerFulfillment; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public OfferFulfillmentRetrieveResponse build() { - return new OfferFulfillmentRetrieveResponse(this); - } - } - - /** Get the offerFulfillment from the response. */ - public OfferFulfillment getOfferFulfillment() { - return offerFulfillment; - } -} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentUpdateResponse.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentUpdateResponse.java deleted file mode 100644 index 9f9b7d6d..00000000 --- a/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentUpdateResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.offerFulfillment.responses; - -import com.chargebee.v4.models.offerFulfillment.OfferFulfillment; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for OfferFulfillmentUpdate operation. Contains the response data from - * the API. - */ -public final class OfferFulfillmentUpdateResponse extends BaseResponse { - private final OfferFulfillment offerFulfillment; - - private OfferFulfillmentUpdateResponse(Builder builder) { - super(builder.httpResponse); - - this.offerFulfillment = builder.offerFulfillment; - } - - /** Parse JSON response into OfferFulfillmentUpdateResponse object. */ - public static OfferFulfillmentUpdateResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into OfferFulfillmentUpdateResponse object with HTTP response. */ - public static OfferFulfillmentUpdateResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __offerFulfillmentJson = JsonUtil.getObject(json, "offer_fulfillment"); - if (__offerFulfillmentJson != null) { - builder.offerFulfillment(OfferFulfillment.fromJson(__offerFulfillmentJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse OfferFulfillmentUpdateResponse from JSON", e); - } - } - - /** Create a new builder for OfferFulfillmentUpdateResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for OfferFulfillmentUpdateResponse. */ - public static class Builder { - - private OfferFulfillment offerFulfillment; - - private Response httpResponse; - - private Builder() {} - - public Builder offerFulfillment(OfferFulfillment offerFulfillment) { - this.offerFulfillment = offerFulfillment; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public OfferFulfillmentUpdateResponse build() { - return new OfferFulfillmentUpdateResponse(this); - } - } - - /** Get the offerFulfillment from the response. */ - public OfferFulfillment getOfferFulfillment() { - return offerFulfillment; - } -} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentsGetResponse.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentsGetResponse.java new file mode 100644 index 00000000..e29a71a4 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentsGetResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.offerFulfillment.responses; + +import com.chargebee.v4.models.offerFulfillment.OfferFulfillment; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for OfferFulfillmentsGet operation. Contains the response data from a + * single resource get operation. + */ +public final class OfferFulfillmentsGetResponse extends BaseResponse { + private final OfferFulfillment offerFulfillment; + + private OfferFulfillmentsGetResponse(Builder builder) { + super(builder.httpResponse); + + this.offerFulfillment = builder.offerFulfillment; + } + + /** Parse JSON response into OfferFulfillmentsGetResponse object. */ + public static OfferFulfillmentsGetResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into OfferFulfillmentsGetResponse object with HTTP response. */ + public static OfferFulfillmentsGetResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __offerFulfillmentJson = JsonUtil.getObject(json, "offer_fulfillment"); + if (__offerFulfillmentJson != null) { + builder.offerFulfillment(OfferFulfillment.fromJson(__offerFulfillmentJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse OfferFulfillmentsGetResponse from JSON", e); + } + } + + /** Create a new builder for OfferFulfillmentsGetResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for OfferFulfillmentsGetResponse. */ + public static class Builder { + + private OfferFulfillment offerFulfillment; + + private Response httpResponse; + + private Builder() {} + + public Builder offerFulfillment(OfferFulfillment offerFulfillment) { + this.offerFulfillment = offerFulfillment; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public OfferFulfillmentsGetResponse build() { + return new OfferFulfillmentsGetResponse(this); + } + } + + /** Get the offerFulfillment from the response. */ + public OfferFulfillment getOfferFulfillment() { + return offerFulfillment; + } +} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentsResponse.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentsResponse.java new file mode 100644 index 00000000..b5f7d111 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentsResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.offerFulfillment.responses; + +import com.chargebee.v4.models.offerFulfillment.OfferFulfillment; + +import com.chargebee.v4.models.hostedPage.HostedPage; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for OfferFulfillments operation. Contains the response data from the + * API. + */ +public final class OfferFulfillmentsResponse extends BaseResponse { + private final OfferFulfillment offerFulfillment; + + private final HostedPage hostedPage; + + private OfferFulfillmentsResponse(Builder builder) { + super(builder.httpResponse); + + this.offerFulfillment = builder.offerFulfillment; + + this.hostedPage = builder.hostedPage; + } + + /** Parse JSON response into OfferFulfillmentsResponse object. */ + public static OfferFulfillmentsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into OfferFulfillmentsResponse object with HTTP response. */ + public static OfferFulfillmentsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __offerFulfillmentJson = JsonUtil.getObject(json, "offer_fulfillment"); + if (__offerFulfillmentJson != null) { + builder.offerFulfillment(OfferFulfillment.fromJson(__offerFulfillmentJson)); + } + + String __hostedPageJson = JsonUtil.getObject(json, "hosted_page"); + if (__hostedPageJson != null) { + builder.hostedPage(HostedPage.fromJson(__hostedPageJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse OfferFulfillmentsResponse from JSON", e); + } + } + + /** Create a new builder for OfferFulfillmentsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for OfferFulfillmentsResponse. */ + public static class Builder { + + private OfferFulfillment offerFulfillment; + + private HostedPage hostedPage; + + private Response httpResponse; + + private Builder() {} + + public Builder offerFulfillment(OfferFulfillment offerFulfillment) { + this.offerFulfillment = offerFulfillment; + return this; + } + + public Builder hostedPage(HostedPage hostedPage) { + this.hostedPage = hostedPage; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public OfferFulfillmentsResponse build() { + return new OfferFulfillmentsResponse(this); + } + } + + /** Get the offerFulfillment from the response. */ + public OfferFulfillment getOfferFulfillment() { + return offerFulfillment; + } + + /** Get the hostedPage from the response. */ + public HostedPage getHostedPage() { + return hostedPage; + } +} diff --git a/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentsUpdateResponse.java b/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentsUpdateResponse.java new file mode 100644 index 00000000..bea12526 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/offerFulfillment/responses/OfferFulfillmentsUpdateResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.offerFulfillment.responses; + +import com.chargebee.v4.models.offerFulfillment.OfferFulfillment; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for OfferFulfillmentsUpdate operation. Contains the response data from + * the API. + */ +public final class OfferFulfillmentsUpdateResponse extends BaseResponse { + private final OfferFulfillment offerFulfillment; + + private OfferFulfillmentsUpdateResponse(Builder builder) { + super(builder.httpResponse); + + this.offerFulfillment = builder.offerFulfillment; + } + + /** Parse JSON response into OfferFulfillmentsUpdateResponse object. */ + public static OfferFulfillmentsUpdateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into OfferFulfillmentsUpdateResponse object with HTTP response. */ + public static OfferFulfillmentsUpdateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __offerFulfillmentJson = JsonUtil.getObject(json, "offer_fulfillment"); + if (__offerFulfillmentJson != null) { + builder.offerFulfillment(OfferFulfillment.fromJson(__offerFulfillmentJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse OfferFulfillmentsUpdateResponse from JSON", e); + } + } + + /** Create a new builder for OfferFulfillmentsUpdateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for OfferFulfillmentsUpdateResponse. */ + public static class Builder { + + private OfferFulfillment offerFulfillment; + + private Response httpResponse; + + private Builder() {} + + public Builder offerFulfillment(OfferFulfillment offerFulfillment) { + this.offerFulfillment = offerFulfillment; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public OfferFulfillmentsUpdateResponse build() { + return new OfferFulfillmentsUpdateResponse(this); + } + } + + /** Get the offerFulfillment from the response. */ + public OfferFulfillment getOfferFulfillment() { + return offerFulfillment; + } +} diff --git a/src/main/java/com/chargebee/v4/models/omnichannelOneTimeOrder/responses/OmnichannelOneTimeOrderListResponse.java b/src/main/java/com/chargebee/v4/models/omnichannelOneTimeOrder/responses/OmnichannelOneTimeOrderListResponse.java index 107ff0eb..a2c065b1 100644 --- a/src/main/java/com/chargebee/v4/models/omnichannelOneTimeOrder/responses/OmnichannelOneTimeOrderListResponse.java +++ b/src/main/java/com/chargebee/v4/models/omnichannelOneTimeOrder/responses/OmnichannelOneTimeOrderListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.omnichannelOneTimeOrder.OmnichannelOneTimeOrder; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.OmnichannelOneTimeOrderService; @@ -104,9 +105,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public OmnichannelOneTimeOrderListResponse nextPage() throws Exception { + public OmnichannelOneTimeOrderListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/omnichannelSubscription/params/MoveForOmnichannelSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/omnichannelSubscription/params/MoveForOmnichannelSubscriptionParams.java deleted file mode 100644 index 0393299d..00000000 --- a/src/main/java/com/chargebee/v4/models/omnichannelSubscription/params/MoveForOmnichannelSubscriptionParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.omnichannelSubscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class MoveForOmnichannelSubscriptionParams { - - private final String toCustomerId; - - private MoveForOmnichannelSubscriptionParams(MoveForOmnichannelSubscriptionBuilder builder) { - - this.toCustomerId = builder.toCustomerId; - } - - public String getToCustomerId() { - return toCustomerId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.toCustomerId != null) { - - formData.put("to_customer_id", this.toCustomerId); - } - - return formData; - } - - /** Create a new builder for MoveForOmnichannelSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static MoveForOmnichannelSubscriptionBuilder builder() { - return new MoveForOmnichannelSubscriptionBuilder(); - } - - public static final class MoveForOmnichannelSubscriptionBuilder { - - private String toCustomerId; - - private MoveForOmnichannelSubscriptionBuilder() {} - - public MoveForOmnichannelSubscriptionBuilder toCustomerId(String value) { - this.toCustomerId = value; - return this; - } - - public MoveForOmnichannelSubscriptionParams build() { - return new MoveForOmnichannelSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/omnichannelSubscription/params/OmnichannelSubscriptionMoveParams.java b/src/main/java/com/chargebee/v4/models/omnichannelSubscription/params/OmnichannelSubscriptionMoveParams.java new file mode 100644 index 00000000..eaf0bdbc --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/omnichannelSubscription/params/OmnichannelSubscriptionMoveParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.omnichannelSubscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class OmnichannelSubscriptionMoveParams { + + private final String toCustomerId; + + private OmnichannelSubscriptionMoveParams(OmnichannelSubscriptionMoveBuilder builder) { + + this.toCustomerId = builder.toCustomerId; + } + + public String getToCustomerId() { + return toCustomerId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.toCustomerId != null) { + + formData.put("to_customer_id", this.toCustomerId); + } + + return formData; + } + + /** Create a new builder for OmnichannelSubscriptionMoveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OmnichannelSubscriptionMoveBuilder builder() { + return new OmnichannelSubscriptionMoveBuilder(); + } + + public static final class OmnichannelSubscriptionMoveBuilder { + + private String toCustomerId; + + private OmnichannelSubscriptionMoveBuilder() {} + + public OmnichannelSubscriptionMoveBuilder toCustomerId(String value) { + this.toCustomerId = value; + return this; + } + + public OmnichannelSubscriptionMoveParams build() { + return new OmnichannelSubscriptionMoveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/MoveForOmnichannelSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/MoveForOmnichannelSubscriptionResponse.java deleted file mode 100644 index 83e62e9a..00000000 --- a/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/MoveForOmnichannelSubscriptionResponse.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.chargebee.v4.models.omnichannelSubscription.responses; - -import com.chargebee.v4.models.omnichannelSubscription.OmnichannelSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for MoveForOmnichannelSubscription operation. Contains the response - * data from the API. - */ -public final class MoveForOmnichannelSubscriptionResponse extends BaseResponse { - private final OmnichannelSubscription omnichannelSubscription; - - private MoveForOmnichannelSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.omnichannelSubscription = builder.omnichannelSubscription; - } - - /** Parse JSON response into MoveForOmnichannelSubscriptionResponse object. */ - public static MoveForOmnichannelSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into MoveForOmnichannelSubscriptionResponse object with HTTP response. */ - public static MoveForOmnichannelSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __omnichannelSubscriptionJson = JsonUtil.getObject(json, "omnichannel_subscription"); - if (__omnichannelSubscriptionJson != null) { - builder.omnichannelSubscription( - OmnichannelSubscription.fromJson(__omnichannelSubscriptionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse MoveForOmnichannelSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for MoveForOmnichannelSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for MoveForOmnichannelSubscriptionResponse. */ - public static class Builder { - - private OmnichannelSubscription omnichannelSubscription; - - private Response httpResponse; - - private Builder() {} - - public Builder omnichannelSubscription(OmnichannelSubscription omnichannelSubscription) { - this.omnichannelSubscription = omnichannelSubscription; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public MoveForOmnichannelSubscriptionResponse build() { - return new MoveForOmnichannelSubscriptionResponse(this); - } - } - - /** Get the omnichannelSubscription from the response. */ - public OmnichannelSubscription getOmnichannelSubscription() { - return omnichannelSubscription; - } -} diff --git a/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/OmnichannelSubscriptionListResponse.java b/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/OmnichannelSubscriptionListResponse.java index 1fc7b798..2197a4ce 100644 --- a/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/OmnichannelSubscriptionListResponse.java +++ b/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/OmnichannelSubscriptionListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.omnichannelSubscription.OmnichannelSubscription; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.OmnichannelSubscriptionService; @@ -104,9 +105,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public OmnichannelSubscriptionListResponse nextPage() throws Exception { + public OmnichannelSubscriptionListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/OmnichannelSubscriptionMoveResponse.java b/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/OmnichannelSubscriptionMoveResponse.java new file mode 100644 index 00000000..0a67506a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/OmnichannelSubscriptionMoveResponse.java @@ -0,0 +1,79 @@ +package com.chargebee.v4.models.omnichannelSubscription.responses; + +import com.chargebee.v4.models.omnichannelSubscription.OmnichannelSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for OmnichannelSubscriptionMove operation. Contains the response data + * from the API. + */ +public final class OmnichannelSubscriptionMoveResponse extends BaseResponse { + private final OmnichannelSubscription omnichannelSubscription; + + private OmnichannelSubscriptionMoveResponse(Builder builder) { + super(builder.httpResponse); + + this.omnichannelSubscription = builder.omnichannelSubscription; + } + + /** Parse JSON response into OmnichannelSubscriptionMoveResponse object. */ + public static OmnichannelSubscriptionMoveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into OmnichannelSubscriptionMoveResponse object with HTTP response. */ + public static OmnichannelSubscriptionMoveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __omnichannelSubscriptionJson = JsonUtil.getObject(json, "omnichannel_subscription"); + if (__omnichannelSubscriptionJson != null) { + builder.omnichannelSubscription( + OmnichannelSubscription.fromJson(__omnichannelSubscriptionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse OmnichannelSubscriptionMoveResponse from JSON", e); + } + } + + /** Create a new builder for OmnichannelSubscriptionMoveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for OmnichannelSubscriptionMoveResponse. */ + public static class Builder { + + private OmnichannelSubscription omnichannelSubscription; + + private Response httpResponse; + + private Builder() {} + + public Builder omnichannelSubscription(OmnichannelSubscription omnichannelSubscription) { + this.omnichannelSubscription = omnichannelSubscription; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public OmnichannelSubscriptionMoveResponse build() { + return new OmnichannelSubscriptionMoveResponse(this); + } + } + + /** Get the omnichannelSubscription from the response. */ + public OmnichannelSubscription getOmnichannelSubscription() { + return omnichannelSubscription; + } +} diff --git a/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/OmnichannelTransactionsForOmnichannelSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/OmnichannelTransactionsForOmnichannelSubscriptionResponse.java index 29ab5dd5..de5bd3bd 100644 --- a/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/OmnichannelTransactionsForOmnichannelSubscriptionResponse.java +++ b/src/main/java/com/chargebee/v4/models/omnichannelSubscription/responses/OmnichannelTransactionsForOmnichannelSubscriptionResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.omnichannelTransaction.OmnichannelTransaction; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.OmnichannelSubscriptionService; @@ -117,9 +118,10 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public OmnichannelTransactionsForOmnichannelSubscriptionResponse nextPage() throws Exception { + public OmnichannelTransactionsForOmnichannelSubscriptionResponse nextPage() + throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/params/OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams.java b/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/params/OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams.java new file mode 100644 index 00000000..609d1cfd --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/params/OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams.java @@ -0,0 +1,69 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.omnichannelSubscriptionItem.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams { + + private final Map queryParams; + + private OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams( + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesBuilder toBuilder() { + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesBuilder builder = + new OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** + * Create a new builder for + * OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams. + */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesBuilder + builder() { + return new OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesBuilder(); + } + + public static final + class OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesBuilder() {} + + public OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesBuilder limit( + Integer value) { + queryParams.put("limit", value); + return this; + } + + public OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesBuilder offset( + String value) { + queryParams.put("offset", value); + return this; + } + + public OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams build() { + return new OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/params/ScheduledChangesForOmnichannelSubscriptionItemParams.java b/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/params/ScheduledChangesForOmnichannelSubscriptionItemParams.java deleted file mode 100644 index 417514d0..00000000 --- a/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/params/ScheduledChangesForOmnichannelSubscriptionItemParams.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.omnichannelSubscriptionItem.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ScheduledChangesForOmnichannelSubscriptionItemParams { - - private final Map queryParams; - - private ScheduledChangesForOmnichannelSubscriptionItemParams( - ScheduledChangesForOmnichannelSubscriptionItemBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public ScheduledChangesForOmnichannelSubscriptionItemBuilder toBuilder() { - ScheduledChangesForOmnichannelSubscriptionItemBuilder builder = - new ScheduledChangesForOmnichannelSubscriptionItemBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for ScheduledChangesForOmnichannelSubscriptionItemParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ScheduledChangesForOmnichannelSubscriptionItemBuilder builder() { - return new ScheduledChangesForOmnichannelSubscriptionItemBuilder(); - } - - public static final class ScheduledChangesForOmnichannelSubscriptionItemBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private ScheduledChangesForOmnichannelSubscriptionItemBuilder() {} - - public ScheduledChangesForOmnichannelSubscriptionItemBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public ScheduledChangesForOmnichannelSubscriptionItemBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - public ScheduledChangesForOmnichannelSubscriptionItemParams build() { - return new ScheduledChangesForOmnichannelSubscriptionItemParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/responses/OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse.java b/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/responses/OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse.java new file mode 100644 index 00000000..be0c8d21 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/responses/OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse.java @@ -0,0 +1,195 @@ +package com.chargebee.v4.models.omnichannelSubscriptionItem.responses; + +import java.util.List; + +import com.chargebee.v4.models.omnichannelSubscriptionItemScheduledChange.OmnichannelSubscriptionItemScheduledChange; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.OmnichannelSubscriptionItemService; +import com.chargebee.v4.models.omnichannelSubscriptionItem.params.OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams; + +/** + * Immutable response object for OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChanges + * operation. Contains paginated list data. + */ +public final class OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse { + + private final List list; + + private final String nextOffset; + + private final String omnichannelSubscriptionItemId; + + private final OmnichannelSubscriptionItemService service; + private final OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams + originalParams; + private final Response httpResponse; + + private OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse( + List list, + String nextOffset, + String omnichannelSubscriptionItemId, + OmnichannelSubscriptionItemService service, + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.omnichannelSubscriptionItemId = omnichannelSubscriptionItemId; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into + * OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse object (no service + * context). Use this when you only need to read a single page (no nextPage()). + */ + public static OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse fromJson( + String json) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse( + list, nextOffset, null, null, null, null); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse from JSON", + e); + } + } + + /** + * Parse JSON response into + * OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse object with service + * context for pagination (enables nextPage()). + */ + public static OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse fromJson( + String json, + OmnichannelSubscriptionItemService service, + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams originalParams, + String omnichannelSubscriptionItemId, + Response httpResponse) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse( + list, nextOffset, omnichannelSubscriptionItemId, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse from JSON", + e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse nextPage() + throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams nextParams = + (originalParams != null + ? originalParams.toBuilder() + : OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams + .builder()) + .offset(nextOffset) + .build(); + + return service.listOmniSubscriptionItemScheduleChanges( + omnichannelSubscriptionItemId, nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + public static class OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesItem { + + private OmnichannelSubscriptionItemScheduledChange omnichannelSubscriptionItemScheduledChange; + + public OmnichannelSubscriptionItemScheduledChange + getOmnichannelSubscriptionItemScheduledChange() { + return omnichannelSubscriptionItemScheduledChange; + } + + public static OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesItem fromJson( + String json) { + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesItem item = + new OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesItem(); + + String __omnichannelSubscriptionItemScheduledChangeJson = + JsonUtil.getObject(json, "omnichannel_subscription_item_scheduled_change"); + if (__omnichannelSubscriptionItemScheduledChangeJson != null) { + item.omnichannelSubscriptionItemScheduledChange = + OmnichannelSubscriptionItemScheduledChange.fromJson( + __omnichannelSubscriptionItemScheduledChangeJson); + } + + return item; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/responses/ScheduledChangesForOmnichannelSubscriptionItemResponse.java b/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/responses/ScheduledChangesForOmnichannelSubscriptionItemResponse.java deleted file mode 100644 index aadd495a..00000000 --- a/src/main/java/com/chargebee/v4/models/omnichannelSubscriptionItem/responses/ScheduledChangesForOmnichannelSubscriptionItemResponse.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.chargebee.v4.models.omnichannelSubscriptionItem.responses; - -import java.util.List; - -import com.chargebee.v4.models.omnichannelSubscriptionItemScheduledChange.OmnichannelSubscriptionItemScheduledChange; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.OmnichannelSubscriptionItemService; -import com.chargebee.v4.models.omnichannelSubscriptionItem.params.ScheduledChangesForOmnichannelSubscriptionItemParams; - -/** - * Immutable response object for ScheduledChangesForOmnichannelSubscriptionItem operation. Contains - * paginated list data. - */ -public final class ScheduledChangesForOmnichannelSubscriptionItemResponse { - - private final List - list; - - private final String nextOffset; - - private final String omnichannelSubscriptionItemId; - - private final OmnichannelSubscriptionItemService service; - private final ScheduledChangesForOmnichannelSubscriptionItemParams originalParams; - private final Response httpResponse; - - private ScheduledChangesForOmnichannelSubscriptionItemResponse( - List list, - String nextOffset, - String omnichannelSubscriptionItemId, - OmnichannelSubscriptionItemService service, - ScheduledChangesForOmnichannelSubscriptionItemParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.omnichannelSubscriptionItemId = omnichannelSubscriptionItemId; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into ScheduledChangesForOmnichannelSubscriptionItemResponse object (no - * service context). Use this when you only need to read a single page (no nextPage()). - */ - public static ScheduledChangesForOmnichannelSubscriptionItemResponse fromJson(String json) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map( - OmnichannelSubscriptionItemScheduledChangesForOmnichannelSubscriptionItemItem - ::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new ScheduledChangesForOmnichannelSubscriptionItemResponse( - list, nextOffset, null, null, null, null); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ScheduledChangesForOmnichannelSubscriptionItemResponse from JSON", e); - } - } - - /** - * Parse JSON response into ScheduledChangesForOmnichannelSubscriptionItemResponse object with - * service context for pagination (enables nextPage()). - */ - public static ScheduledChangesForOmnichannelSubscriptionItemResponse fromJson( - String json, - OmnichannelSubscriptionItemService service, - ScheduledChangesForOmnichannelSubscriptionItemParams originalParams, - String omnichannelSubscriptionItemId, - Response httpResponse) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map( - OmnichannelSubscriptionItemScheduledChangesForOmnichannelSubscriptionItemItem - ::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new ScheduledChangesForOmnichannelSubscriptionItemResponse( - list, nextOffset, omnichannelSubscriptionItemId, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ScheduledChangesForOmnichannelSubscriptionItemResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List - getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public ScheduledChangesForOmnichannelSubscriptionItemResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - ScheduledChangesForOmnichannelSubscriptionItemParams nextParams = - (originalParams != null - ? originalParams.toBuilder() - : ScheduledChangesForOmnichannelSubscriptionItemParams.builder()) - .offset(nextOffset) - .build(); - - return service.scheduledChangesForOmnichannelSubscriptionItem( - omnichannelSubscriptionItemId, nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } - - public static - class OmnichannelSubscriptionItemScheduledChangesForOmnichannelSubscriptionItemItem { - - private OmnichannelSubscriptionItemScheduledChange omnichannelSubscriptionItemScheduledChange; - - public OmnichannelSubscriptionItemScheduledChange - getOmnichannelSubscriptionItemScheduledChange() { - return omnichannelSubscriptionItemScheduledChange; - } - - public static OmnichannelSubscriptionItemScheduledChangesForOmnichannelSubscriptionItemItem - fromJson(String json) { - OmnichannelSubscriptionItemScheduledChangesForOmnichannelSubscriptionItemItem item = - new OmnichannelSubscriptionItemScheduledChangesForOmnichannelSubscriptionItemItem(); - - String __omnichannelSubscriptionItemScheduledChangeJson = - JsonUtil.getObject(json, "omnichannel_subscription_item_scheduled_change"); - if (__omnichannelSubscriptionItemScheduledChangeJson != null) { - item.omnichannelSubscriptionItemScheduledChange = - OmnichannelSubscriptionItemScheduledChange.fromJson( - __omnichannelSubscriptionItemScheduledChangeJson); - } - - return item; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/params/AssignOrderNumberForOrderParams.java b/src/main/java/com/chargebee/v4/models/order/params/AssignOrderNumberForOrderParams.java deleted file mode 100644 index d62e73b6..00000000 --- a/src/main/java/com/chargebee/v4/models/order/params/AssignOrderNumberForOrderParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.order.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AssignOrderNumberForOrderParams { - - private AssignOrderNumberForOrderParams(AssignOrderNumberForOrderBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for AssignOrderNumberForOrderParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AssignOrderNumberForOrderBuilder builder() { - return new AssignOrderNumberForOrderBuilder(); - } - - public static final class AssignOrderNumberForOrderBuilder { - - private AssignOrderNumberForOrderBuilder() {} - - public AssignOrderNumberForOrderParams build() { - return new AssignOrderNumberForOrderParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/params/AssignOrderNumberParams.java b/src/main/java/com/chargebee/v4/models/order/params/AssignOrderNumberParams.java new file mode 100644 index 00000000..597e2f35 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/params/AssignOrderNumberParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.order.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class AssignOrderNumberParams { + + private AssignOrderNumberParams(AssignOrderNumberBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for AssignOrderNumberParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AssignOrderNumberBuilder builder() { + return new AssignOrderNumberBuilder(); + } + + public static final class AssignOrderNumberBuilder { + + private AssignOrderNumberBuilder() {} + + public AssignOrderNumberParams build() { + return new AssignOrderNumberParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/params/CancelForOrderParams.java b/src/main/java/com/chargebee/v4/models/order/params/CancelForOrderParams.java deleted file mode 100644 index 3e7aea78..00000000 --- a/src/main/java/com/chargebee/v4/models/order/params/CancelForOrderParams.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.order.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class CancelForOrderParams { - - private final CancellationReason cancellationReason; - - private final String customerNotes; - - private final String comment; - - private final Timestamp cancelledAt; - - private final CreditNoteParams creditNote; - - private CancelForOrderParams(CancelForOrderBuilder builder) { - - this.cancellationReason = builder.cancellationReason; - - this.customerNotes = builder.customerNotes; - - this.comment = builder.comment; - - this.cancelledAt = builder.cancelledAt; - - this.creditNote = builder.creditNote; - } - - public CancellationReason getCancellationReason() { - return cancellationReason; - } - - public String getCustomerNotes() { - return customerNotes; - } - - public String getComment() { - return comment; - } - - public Timestamp getCancelledAt() { - return cancelledAt; - } - - public CreditNoteParams getCreditNote() { - return creditNote; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.cancellationReason != null) { - - formData.put("cancellation_reason", this.cancellationReason); - } - - if (this.customerNotes != null) { - - formData.put("customer_notes", this.customerNotes); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.cancelledAt != null) { - - formData.put("cancelled_at", this.cancelledAt); - } - - if (this.creditNote != null) { - - // Single object - Map nestedData = this.creditNote.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "credit_note[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for CancelForOrderParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CancelForOrderBuilder builder() { - return new CancelForOrderBuilder(); - } - - public static final class CancelForOrderBuilder { - - private CancellationReason cancellationReason; - - private String customerNotes; - - private String comment; - - private Timestamp cancelledAt; - - private CreditNoteParams creditNote; - - private CancelForOrderBuilder() {} - - public CancelForOrderBuilder cancellationReason(CancellationReason value) { - this.cancellationReason = value; - return this; - } - - public CancelForOrderBuilder customerNotes(String value) { - this.customerNotes = value; - return this; - } - - public CancelForOrderBuilder comment(String value) { - this.comment = value; - return this; - } - - public CancelForOrderBuilder cancelledAt(Timestamp value) { - this.cancelledAt = value; - return this; - } - - public CancelForOrderBuilder creditNote(CreditNoteParams value) { - this.creditNote = value; - return this; - } - - public CancelForOrderParams build() { - return new CancelForOrderParams(this); - } - } - - public enum CancellationReason { - SHIPPING_CUT_OFF_PASSED("shipping_cut_off_passed"), - - PRODUCT_UNSATISFACTORY("product_unsatisfactory"), - - THIRD_PARTY_CANCELLATION("third_party_cancellation"), - - PRODUCT_NOT_REQUIRED("product_not_required"), - - DELIVERY_DATE_MISSED("delivery_date_missed"), - - ALTERNATIVE_FOUND("alternative_found"), - - INVOICE_WRITTEN_OFF("invoice_written_off"), - - INVOICE_VOIDED("invoice_voided"), - - FRAUDULENT_TRANSACTION("fraudulent_transaction"), - - PAYMENT_DECLINED("payment_declined"), - - SUBSCRIPTION_CANCELLED("subscription_cancelled"), - - PRODUCT_NOT_AVAILABLE("product_not_available"), - - OTHERS("others"), - - ORDER_RESENT("order_resent"), - - /** An enum member indicating that CancellationReason was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - CancellationReason(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CancellationReason fromString(String value) { - if (value == null) return _UNKNOWN; - for (CancellationReason enumValue : CancellationReason.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class CreditNoteParams { - - private final Long total; - - private CreditNoteParams(CreditNoteBuilder builder) { - - this.total = builder.total; - } - - public Long getTotal() { - return total; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.total != null) { - - formData.put("total", this.total); - } - - return formData; - } - - /** Create a new builder for CreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreditNoteBuilder builder() { - return new CreditNoteBuilder(); - } - - public static final class CreditNoteBuilder { - - private Long total; - - private CreditNoteBuilder() {} - - public CreditNoteBuilder total(Long value) { - this.total = value; - return this; - } - - public CreditNoteParams build() { - return new CreditNoteParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/params/CreateRefundableCreditNoteForOrderParams.java b/src/main/java/com/chargebee/v4/models/order/params/CreateRefundableCreditNoteForOrderParams.java deleted file mode 100644 index 755577cf..00000000 --- a/src/main/java/com/chargebee/v4/models/order/params/CreateRefundableCreditNoteForOrderParams.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.order.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class CreateRefundableCreditNoteForOrderParams { - - private final String customerNotes; - - private final String comment; - - private final CreditNoteParams creditNote; - - private CreateRefundableCreditNoteForOrderParams( - CreateRefundableCreditNoteForOrderBuilder builder) { - - this.customerNotes = builder.customerNotes; - - this.comment = builder.comment; - - this.creditNote = builder.creditNote; - } - - public String getCustomerNotes() { - return customerNotes; - } - - public String getComment() { - return comment; - } - - public CreditNoteParams getCreditNote() { - return creditNote; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.customerNotes != null) { - - formData.put("customer_notes", this.customerNotes); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - if (this.creditNote != null) { - - // Single object - Map nestedData = this.creditNote.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "credit_note[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for CreateRefundableCreditNoteForOrderParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreateRefundableCreditNoteForOrderBuilder builder() { - return new CreateRefundableCreditNoteForOrderBuilder(); - } - - public static final class CreateRefundableCreditNoteForOrderBuilder { - - private String customerNotes; - - private String comment; - - private CreditNoteParams creditNote; - - private CreateRefundableCreditNoteForOrderBuilder() {} - - public CreateRefundableCreditNoteForOrderBuilder customerNotes(String value) { - this.customerNotes = value; - return this; - } - - public CreateRefundableCreditNoteForOrderBuilder comment(String value) { - this.comment = value; - return this; - } - - public CreateRefundableCreditNoteForOrderBuilder creditNote(CreditNoteParams value) { - this.creditNote = value; - return this; - } - - public CreateRefundableCreditNoteForOrderParams build() { - return new CreateRefundableCreditNoteForOrderParams(this); - } - } - - public static final class CreditNoteParams { - - private final ReasonCode reasonCode; - - private final Long total; - - private CreditNoteParams(CreditNoteBuilder builder) { - - this.reasonCode = builder.reasonCode; - - this.total = builder.total; - } - - public ReasonCode getReasonCode() { - return reasonCode; - } - - public Long getTotal() { - return total; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.reasonCode != null) { - - formData.put("reason_code", this.reasonCode); - } - - if (this.total != null) { - - formData.put("total", this.total); - } - - return formData; - } - - /** Create a new builder for CreditNoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreditNoteBuilder builder() { - return new CreditNoteBuilder(); - } - - public static final class CreditNoteBuilder { - - private ReasonCode reasonCode; - - private Long total; - - private CreditNoteBuilder() {} - - public CreditNoteBuilder reasonCode(ReasonCode value) { - this.reasonCode = value; - return this; - } - - public CreditNoteBuilder total(Long value) { - this.total = value; - return this; - } - - public CreditNoteParams build() { - return new CreditNoteParams(this); - } - } - - public enum ReasonCode { - WRITE_OFF("write_off"), - - SUBSCRIPTION_CHANGE("subscription_change"), - - SUBSCRIPTION_CANCELLATION("subscription_cancellation"), - - SUBSCRIPTION_PAUSE("subscription_pause"), - - CHARGEBACK("chargeback"), - - PRODUCT_UNSATISFACTORY("product_unsatisfactory"), - - SERVICE_UNSATISFACTORY("service_unsatisfactory"), - - ORDER_CHANGE("order_change"), - - ORDER_CANCELLATION("order_cancellation"), - - WAIVER("waiver"), - - OTHER("other"), - - FRAUDULENT("fraudulent"), - - /** An enum member indicating that ReasonCode was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ReasonCode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ReasonCode fromString(String value) { - if (value == null) return _UNKNOWN; - for (ReasonCode enumValue : ReasonCode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/params/DeleteOrderParams.java b/src/main/java/com/chargebee/v4/models/order/params/DeleteOrderParams.java deleted file mode 100644 index 17403f6e..00000000 --- a/src/main/java/com/chargebee/v4/models/order/params/DeleteOrderParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.order.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteOrderParams { - - private DeleteOrderParams(DeleteOrderBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteOrderParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteOrderBuilder builder() { - return new DeleteOrderBuilder(); - } - - public static final class DeleteOrderBuilder { - - private DeleteOrderBuilder() {} - - public DeleteOrderParams build() { - return new DeleteOrderParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/params/OrderCancelParams.java b/src/main/java/com/chargebee/v4/models/order/params/OrderCancelParams.java new file mode 100644 index 00000000..e614104e --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/params/OrderCancelParams.java @@ -0,0 +1,246 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.order.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class OrderCancelParams { + + private final CancellationReason cancellationReason; + + private final String customerNotes; + + private final String comment; + + private final Timestamp cancelledAt; + + private final CreditNoteParams creditNote; + + private OrderCancelParams(OrderCancelBuilder builder) { + + this.cancellationReason = builder.cancellationReason; + + this.customerNotes = builder.customerNotes; + + this.comment = builder.comment; + + this.cancelledAt = builder.cancelledAt; + + this.creditNote = builder.creditNote; + } + + public CancellationReason getCancellationReason() { + return cancellationReason; + } + + public String getCustomerNotes() { + return customerNotes; + } + + public String getComment() { + return comment; + } + + public Timestamp getCancelledAt() { + return cancelledAt; + } + + public CreditNoteParams getCreditNote() { + return creditNote; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.cancellationReason != null) { + + formData.put("cancellation_reason", this.cancellationReason); + } + + if (this.customerNotes != null) { + + formData.put("customer_notes", this.customerNotes); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.cancelledAt != null) { + + formData.put("cancelled_at", this.cancelledAt); + } + + if (this.creditNote != null) { + + // Single object + Map nestedData = this.creditNote.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "credit_note[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for OrderCancelParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OrderCancelBuilder builder() { + return new OrderCancelBuilder(); + } + + public static final class OrderCancelBuilder { + + private CancellationReason cancellationReason; + + private String customerNotes; + + private String comment; + + private Timestamp cancelledAt; + + private CreditNoteParams creditNote; + + private OrderCancelBuilder() {} + + public OrderCancelBuilder cancellationReason(CancellationReason value) { + this.cancellationReason = value; + return this; + } + + public OrderCancelBuilder customerNotes(String value) { + this.customerNotes = value; + return this; + } + + public OrderCancelBuilder comment(String value) { + this.comment = value; + return this; + } + + public OrderCancelBuilder cancelledAt(Timestamp value) { + this.cancelledAt = value; + return this; + } + + public OrderCancelBuilder creditNote(CreditNoteParams value) { + this.creditNote = value; + return this; + } + + public OrderCancelParams build() { + return new OrderCancelParams(this); + } + } + + public enum CancellationReason { + SHIPPING_CUT_OFF_PASSED("shipping_cut_off_passed"), + + PRODUCT_UNSATISFACTORY("product_unsatisfactory"), + + THIRD_PARTY_CANCELLATION("third_party_cancellation"), + + PRODUCT_NOT_REQUIRED("product_not_required"), + + DELIVERY_DATE_MISSED("delivery_date_missed"), + + ALTERNATIVE_FOUND("alternative_found"), + + INVOICE_WRITTEN_OFF("invoice_written_off"), + + INVOICE_VOIDED("invoice_voided"), + + FRAUDULENT_TRANSACTION("fraudulent_transaction"), + + PAYMENT_DECLINED("payment_declined"), + + SUBSCRIPTION_CANCELLED("subscription_cancelled"), + + PRODUCT_NOT_AVAILABLE("product_not_available"), + + OTHERS("others"), + + ORDER_RESENT("order_resent"), + + /** An enum member indicating that CancellationReason was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + CancellationReason(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CancellationReason fromString(String value) { + if (value == null) return _UNKNOWN; + for (CancellationReason enumValue : CancellationReason.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class CreditNoteParams { + + private final Long total; + + private CreditNoteParams(CreditNoteBuilder builder) { + + this.total = builder.total; + } + + public Long getTotal() { + return total; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.total != null) { + + formData.put("total", this.total); + } + + return formData; + } + + /** Create a new builder for CreditNoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteBuilder builder() { + return new CreditNoteBuilder(); + } + + public static final class CreditNoteBuilder { + + private Long total; + + private CreditNoteBuilder() {} + + public CreditNoteBuilder total(Long value) { + this.total = value; + return this; + } + + public CreditNoteParams build() { + return new CreditNoteParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/params/OrderCreateRefundableCreditNoteParams.java b/src/main/java/com/chargebee/v4/models/order/params/OrderCreateRefundableCreditNoteParams.java new file mode 100644 index 00000000..e4f2d7a6 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/params/OrderCreateRefundableCreditNoteParams.java @@ -0,0 +1,221 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.order.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class OrderCreateRefundableCreditNoteParams { + + private final String customerNotes; + + private final String comment; + + private final CreditNoteParams creditNote; + + private OrderCreateRefundableCreditNoteParams(OrderCreateRefundableCreditNoteBuilder builder) { + + this.customerNotes = builder.customerNotes; + + this.comment = builder.comment; + + this.creditNote = builder.creditNote; + } + + public String getCustomerNotes() { + return customerNotes; + } + + public String getComment() { + return comment; + } + + public CreditNoteParams getCreditNote() { + return creditNote; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.customerNotes != null) { + + formData.put("customer_notes", this.customerNotes); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + if (this.creditNote != null) { + + // Single object + Map nestedData = this.creditNote.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "credit_note[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for OrderCreateRefundableCreditNoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OrderCreateRefundableCreditNoteBuilder builder() { + return new OrderCreateRefundableCreditNoteBuilder(); + } + + public static final class OrderCreateRefundableCreditNoteBuilder { + + private String customerNotes; + + private String comment; + + private CreditNoteParams creditNote; + + private OrderCreateRefundableCreditNoteBuilder() {} + + public OrderCreateRefundableCreditNoteBuilder customerNotes(String value) { + this.customerNotes = value; + return this; + } + + public OrderCreateRefundableCreditNoteBuilder comment(String value) { + this.comment = value; + return this; + } + + public OrderCreateRefundableCreditNoteBuilder creditNote(CreditNoteParams value) { + this.creditNote = value; + return this; + } + + public OrderCreateRefundableCreditNoteParams build() { + return new OrderCreateRefundableCreditNoteParams(this); + } + } + + public static final class CreditNoteParams { + + private final ReasonCode reasonCode; + + private final Long total; + + private CreditNoteParams(CreditNoteBuilder builder) { + + this.reasonCode = builder.reasonCode; + + this.total = builder.total; + } + + public ReasonCode getReasonCode() { + return reasonCode; + } + + public Long getTotal() { + return total; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.reasonCode != null) { + + formData.put("reason_code", this.reasonCode); + } + + if (this.total != null) { + + formData.put("total", this.total); + } + + return formData; + } + + /** Create a new builder for CreditNoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditNoteBuilder builder() { + return new CreditNoteBuilder(); + } + + public static final class CreditNoteBuilder { + + private ReasonCode reasonCode; + + private Long total; + + private CreditNoteBuilder() {} + + public CreditNoteBuilder reasonCode(ReasonCode value) { + this.reasonCode = value; + return this; + } + + public CreditNoteBuilder total(Long value) { + this.total = value; + return this; + } + + public CreditNoteParams build() { + return new CreditNoteParams(this); + } + } + + public enum ReasonCode { + WRITE_OFF("write_off"), + + SUBSCRIPTION_CHANGE("subscription_change"), + + SUBSCRIPTION_CANCELLATION("subscription_cancellation"), + + SUBSCRIPTION_PAUSE("subscription_pause"), + + CHARGEBACK("chargeback"), + + PRODUCT_UNSATISFACTORY("product_unsatisfactory"), + + SERVICE_UNSATISFACTORY("service_unsatisfactory"), + + ORDER_CHANGE("order_change"), + + ORDER_CANCELLATION("order_cancellation"), + + WAIVER("waiver"), + + OTHER("other"), + + FRAUDULENT("fraudulent"), + + /** An enum member indicating that ReasonCode was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ReasonCode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ReasonCode fromString(String value) { + if (value == null) return _UNKNOWN; + for (ReasonCode enumValue : ReasonCode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/params/OrderDeleteParams.java b/src/main/java/com/chargebee/v4/models/order/params/OrderDeleteParams.java new file mode 100644 index 00000000..62d6b39d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/params/OrderDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.order.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class OrderDeleteParams { + + private OrderDeleteParams(OrderDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for OrderDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OrderDeleteBuilder builder() { + return new OrderDeleteBuilder(); + } + + public static final class OrderDeleteBuilder { + + private OrderDeleteBuilder() {} + + public OrderDeleteParams build() { + return new OrderDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/params/OrderReopenParams.java b/src/main/java/com/chargebee/v4/models/order/params/OrderReopenParams.java new file mode 100644 index 00000000..a1e67225 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/params/OrderReopenParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.order.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class OrderReopenParams { + + private final Boolean voidCancellationCreditNotes; + + private OrderReopenParams(OrderReopenBuilder builder) { + + this.voidCancellationCreditNotes = builder.voidCancellationCreditNotes; + } + + public Boolean getVoidCancellationCreditNotes() { + return voidCancellationCreditNotes; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.voidCancellationCreditNotes != null) { + + formData.put("void_cancellation_credit_notes", this.voidCancellationCreditNotes); + } + + return formData; + } + + /** Create a new builder for OrderReopenParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OrderReopenBuilder builder() { + return new OrderReopenBuilder(); + } + + public static final class OrderReopenBuilder { + + private Boolean voidCancellationCreditNotes; + + private OrderReopenBuilder() {} + + public OrderReopenBuilder voidCancellationCreditNotes(Boolean value) { + this.voidCancellationCreditNotes = value; + return this; + } + + public OrderReopenParams build() { + return new OrderReopenParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/params/OrderResendParams.java b/src/main/java/com/chargebee/v4/models/order/params/OrderResendParams.java new file mode 100644 index 00000000..e06a9bb8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/params/OrderResendParams.java @@ -0,0 +1,180 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.order.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class OrderResendParams { + + private final Timestamp shippingDate; + + private final String resendReason; + + private final List orderLineItems; + + private OrderResendParams(OrderResendBuilder builder) { + + this.shippingDate = builder.shippingDate; + + this.resendReason = builder.resendReason; + + this.orderLineItems = builder.orderLineItems; + } + + public Timestamp getShippingDate() { + return shippingDate; + } + + public String getResendReason() { + return resendReason; + } + + public List getOrderLineItems() { + return orderLineItems; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.shippingDate != null) { + + formData.put("shipping_date", this.shippingDate); + } + + if (this.resendReason != null) { + + formData.put("resend_reason", this.resendReason); + } + + if (this.orderLineItems != null) { + + // List of objects + for (int i = 0; i < this.orderLineItems.size(); i++) { + OrderLineItemsParams item = this.orderLineItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "order_line_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for OrderResendParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OrderResendBuilder builder() { + return new OrderResendBuilder(); + } + + public static final class OrderResendBuilder { + + private Timestamp shippingDate; + + private String resendReason; + + private List orderLineItems; + + private OrderResendBuilder() {} + + public OrderResendBuilder shippingDate(Timestamp value) { + this.shippingDate = value; + return this; + } + + public OrderResendBuilder resendReason(String value) { + this.resendReason = value; + return this; + } + + public OrderResendBuilder orderLineItems(List value) { + this.orderLineItems = value; + return this; + } + + public OrderResendParams build() { + return new OrderResendParams(this); + } + } + + public static final class OrderLineItemsParams { + + private final String id; + + private final Integer fulfillmentQuantity; + + private OrderLineItemsParams(OrderLineItemsBuilder builder) { + + this.id = builder.id; + + this.fulfillmentQuantity = builder.fulfillmentQuantity; + } + + public String getId() { + return id; + } + + public Integer getFulfillmentQuantity() { + return fulfillmentQuantity; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.fulfillmentQuantity != null) { + + formData.put("fulfillment_quantity", this.fulfillmentQuantity); + } + + return formData; + } + + /** Create a new builder for OrderLineItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OrderLineItemsBuilder builder() { + return new OrderLineItemsBuilder(); + } + + public static final class OrderLineItemsBuilder { + + private String id; + + private Integer fulfillmentQuantity; + + private OrderLineItemsBuilder() {} + + public OrderLineItemsBuilder id(String value) { + this.id = value; + return this; + } + + public OrderLineItemsBuilder fulfillmentQuantity(Integer value) { + this.fulfillmentQuantity = value; + return this; + } + + public OrderLineItemsParams build() { + return new OrderLineItemsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/params/ReopenForOrderParams.java b/src/main/java/com/chargebee/v4/models/order/params/ReopenForOrderParams.java deleted file mode 100644 index bc72e533..00000000 --- a/src/main/java/com/chargebee/v4/models/order/params/ReopenForOrderParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.order.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ReopenForOrderParams { - - private final Boolean voidCancellationCreditNotes; - - private ReopenForOrderParams(ReopenForOrderBuilder builder) { - - this.voidCancellationCreditNotes = builder.voidCancellationCreditNotes; - } - - public Boolean getVoidCancellationCreditNotes() { - return voidCancellationCreditNotes; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.voidCancellationCreditNotes != null) { - - formData.put("void_cancellation_credit_notes", this.voidCancellationCreditNotes); - } - - return formData; - } - - /** Create a new builder for ReopenForOrderParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ReopenForOrderBuilder builder() { - return new ReopenForOrderBuilder(); - } - - public static final class ReopenForOrderBuilder { - - private Boolean voidCancellationCreditNotes; - - private ReopenForOrderBuilder() {} - - public ReopenForOrderBuilder voidCancellationCreditNotes(Boolean value) { - this.voidCancellationCreditNotes = value; - return this; - } - - public ReopenForOrderParams build() { - return new ReopenForOrderParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/params/ResendForOrderParams.java b/src/main/java/com/chargebee/v4/models/order/params/ResendForOrderParams.java deleted file mode 100644 index 17332123..00000000 --- a/src/main/java/com/chargebee/v4/models/order/params/ResendForOrderParams.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.order.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class ResendForOrderParams { - - private final Timestamp shippingDate; - - private final String resendReason; - - private final List orderLineItems; - - private ResendForOrderParams(ResendForOrderBuilder builder) { - - this.shippingDate = builder.shippingDate; - - this.resendReason = builder.resendReason; - - this.orderLineItems = builder.orderLineItems; - } - - public Timestamp getShippingDate() { - return shippingDate; - } - - public String getResendReason() { - return resendReason; - } - - public List getOrderLineItems() { - return orderLineItems; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.shippingDate != null) { - - formData.put("shipping_date", this.shippingDate); - } - - if (this.resendReason != null) { - - formData.put("resend_reason", this.resendReason); - } - - if (this.orderLineItems != null) { - - // List of objects - for (int i = 0; i < this.orderLineItems.size(); i++) { - OrderLineItemsParams item = this.orderLineItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "order_line_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for ResendForOrderParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ResendForOrderBuilder builder() { - return new ResendForOrderBuilder(); - } - - public static final class ResendForOrderBuilder { - - private Timestamp shippingDate; - - private String resendReason; - - private List orderLineItems; - - private ResendForOrderBuilder() {} - - public ResendForOrderBuilder shippingDate(Timestamp value) { - this.shippingDate = value; - return this; - } - - public ResendForOrderBuilder resendReason(String value) { - this.resendReason = value; - return this; - } - - public ResendForOrderBuilder orderLineItems(List value) { - this.orderLineItems = value; - return this; - } - - public ResendForOrderParams build() { - return new ResendForOrderParams(this); - } - } - - public static final class OrderLineItemsParams { - - private final String id; - - private final Integer fulfillmentQuantity; - - private OrderLineItemsParams(OrderLineItemsBuilder builder) { - - this.id = builder.id; - - this.fulfillmentQuantity = builder.fulfillmentQuantity; - } - - public String getId() { - return id; - } - - public Integer getFulfillmentQuantity() { - return fulfillmentQuantity; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.fulfillmentQuantity != null) { - - formData.put("fulfillment_quantity", this.fulfillmentQuantity); - } - - return formData; - } - - /** Create a new builder for OrderLineItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static OrderLineItemsBuilder builder() { - return new OrderLineItemsBuilder(); - } - - public static final class OrderLineItemsBuilder { - - private String id; - - private Integer fulfillmentQuantity; - - private OrderLineItemsBuilder() {} - - public OrderLineItemsBuilder id(String value) { - this.id = value; - return this; - } - - public OrderLineItemsBuilder fulfillmentQuantity(Integer value) { - this.fulfillmentQuantity = value; - return this; - } - - public OrderLineItemsParams build() { - return new OrderLineItemsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/AssignOrderNumberForOrderResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/AssignOrderNumberForOrderResponse.java deleted file mode 100644 index fed02c3e..00000000 --- a/src/main/java/com/chargebee/v4/models/order/responses/AssignOrderNumberForOrderResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.order.responses; - -import com.chargebee.v4.models.order.Order; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AssignOrderNumberForOrder operation. Contains the response data - * from the API. - */ -public final class AssignOrderNumberForOrderResponse extends BaseResponse { - private final Order order; - - private AssignOrderNumberForOrderResponse(Builder builder) { - super(builder.httpResponse); - - this.order = builder.order; - } - - /** Parse JSON response into AssignOrderNumberForOrderResponse object. */ - public static AssignOrderNumberForOrderResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AssignOrderNumberForOrderResponse object with HTTP response. */ - public static AssignOrderNumberForOrderResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __orderJson = JsonUtil.getObject(json, "order"); - if (__orderJson != null) { - builder.order(Order.fromJson(__orderJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AssignOrderNumberForOrderResponse from JSON", e); - } - } - - /** Create a new builder for AssignOrderNumberForOrderResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AssignOrderNumberForOrderResponse. */ - public static class Builder { - - private Order order; - - private Response httpResponse; - - private Builder() {} - - public Builder order(Order order) { - this.order = order; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AssignOrderNumberForOrderResponse build() { - return new AssignOrderNumberForOrderResponse(this); - } - } - - /** Get the order from the response. */ - public Order getOrder() { - return order; - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/AssignOrderNumberResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/AssignOrderNumberResponse.java new file mode 100644 index 00000000..40036fcf --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/responses/AssignOrderNumberResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.order.responses; + +import com.chargebee.v4.models.order.Order; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for AssignOrderNumber operation. Contains the response data from the + * API. + */ +public final class AssignOrderNumberResponse extends BaseResponse { + private final Order order; + + private AssignOrderNumberResponse(Builder builder) { + super(builder.httpResponse); + + this.order = builder.order; + } + + /** Parse JSON response into AssignOrderNumberResponse object. */ + public static AssignOrderNumberResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into AssignOrderNumberResponse object with HTTP response. */ + public static AssignOrderNumberResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __orderJson = JsonUtil.getObject(json, "order"); + if (__orderJson != null) { + builder.order(Order.fromJson(__orderJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse AssignOrderNumberResponse from JSON", e); + } + } + + /** Create a new builder for AssignOrderNumberResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for AssignOrderNumberResponse. */ + public static class Builder { + + private Order order; + + private Response httpResponse; + + private Builder() {} + + public Builder order(Order order) { + this.order = order; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public AssignOrderNumberResponse build() { + return new AssignOrderNumberResponse(this); + } + } + + /** Get the order from the response. */ + public Order getOrder() { + return order; + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/CancelForOrderResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/CancelForOrderResponse.java deleted file mode 100644 index 6a9a2e35..00000000 --- a/src/main/java/com/chargebee/v4/models/order/responses/CancelForOrderResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.order.responses; - -import com.chargebee.v4.models.order.Order; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CancelForOrder operation. Contains the response data from the API. - */ -public final class CancelForOrderResponse extends BaseResponse { - private final Order order; - - private CancelForOrderResponse(Builder builder) { - super(builder.httpResponse); - - this.order = builder.order; - } - - /** Parse JSON response into CancelForOrderResponse object. */ - public static CancelForOrderResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into CancelForOrderResponse object with HTTP response. */ - public static CancelForOrderResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __orderJson = JsonUtil.getObject(json, "order"); - if (__orderJson != null) { - builder.order(Order.fromJson(__orderJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse CancelForOrderResponse from JSON", e); - } - } - - /** Create a new builder for CancelForOrderResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CancelForOrderResponse. */ - public static class Builder { - - private Order order; - - private Response httpResponse; - - private Builder() {} - - public Builder order(Order order) { - this.order = order; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CancelForOrderResponse build() { - return new CancelForOrderResponse(this); - } - } - - /** Get the order from the response. */ - public Order getOrder() { - return order; - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/CreateRefundableCreditNoteForOrderResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/CreateRefundableCreditNoteForOrderResponse.java deleted file mode 100644 index 9f4d8b88..00000000 --- a/src/main/java/com/chargebee/v4/models/order/responses/CreateRefundableCreditNoteForOrderResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.order.responses; - -import com.chargebee.v4.models.order.Order; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CreateRefundableCreditNoteForOrder operation. Contains the response - * data from the API. - */ -public final class CreateRefundableCreditNoteForOrderResponse extends BaseResponse { - private final Order order; - - private CreateRefundableCreditNoteForOrderResponse(Builder builder) { - super(builder.httpResponse); - - this.order = builder.order; - } - - /** Parse JSON response into CreateRefundableCreditNoteForOrderResponse object. */ - public static CreateRefundableCreditNoteForOrderResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into CreateRefundableCreditNoteForOrderResponse object with HTTP response. - */ - public static CreateRefundableCreditNoteForOrderResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __orderJson = JsonUtil.getObject(json, "order"); - if (__orderJson != null) { - builder.order(Order.fromJson(__orderJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse CreateRefundableCreditNoteForOrderResponse from JSON", e); - } - } - - /** Create a new builder for CreateRefundableCreditNoteForOrderResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CreateRefundableCreditNoteForOrderResponse. */ - public static class Builder { - - private Order order; - - private Response httpResponse; - - private Builder() {} - - public Builder order(Order order) { - this.order = order; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CreateRefundableCreditNoteForOrderResponse build() { - return new CreateRefundableCreditNoteForOrderResponse(this); - } - } - - /** Get the order from the response. */ - public Order getOrder() { - return order; - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/DeleteOrderResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/DeleteOrderResponse.java deleted file mode 100644 index 0fb3d65d..00000000 --- a/src/main/java/com/chargebee/v4/models/order/responses/DeleteOrderResponse.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.chargebee.v4.models.order.responses; - -import com.chargebee.v4.models.order.Order; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** Immutable response object for DeleteOrder operation. Contains the response data from the API. */ -public final class DeleteOrderResponse extends BaseResponse { - private final Order order; - - private DeleteOrderResponse(Builder builder) { - super(builder.httpResponse); - - this.order = builder.order; - } - - /** Parse JSON response into DeleteOrderResponse object. */ - public static DeleteOrderResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteOrderResponse object with HTTP response. */ - public static DeleteOrderResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __orderJson = JsonUtil.getObject(json, "order"); - if (__orderJson != null) { - builder.order(Order.fromJson(__orderJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteOrderResponse from JSON", e); - } - } - - /** Create a new builder for DeleteOrderResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteOrderResponse. */ - public static class Builder { - - private Order order; - - private Response httpResponse; - - private Builder() {} - - public Builder order(Order order) { - this.order = order; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteOrderResponse build() { - return new DeleteOrderResponse(this); - } - } - - /** Get the order from the response. */ - public Order getOrder() { - return order; - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/OrderCancelResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/OrderCancelResponse.java new file mode 100644 index 00000000..62c63865 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/responses/OrderCancelResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.order.responses; + +import com.chargebee.v4.models.order.Order; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for OrderCancel operation. Contains the response data from the API. */ +public final class OrderCancelResponse extends BaseResponse { + private final Order order; + + private OrderCancelResponse(Builder builder) { + super(builder.httpResponse); + + this.order = builder.order; + } + + /** Parse JSON response into OrderCancelResponse object. */ + public static OrderCancelResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into OrderCancelResponse object with HTTP response. */ + public static OrderCancelResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __orderJson = JsonUtil.getObject(json, "order"); + if (__orderJson != null) { + builder.order(Order.fromJson(__orderJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse OrderCancelResponse from JSON", e); + } + } + + /** Create a new builder for OrderCancelResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for OrderCancelResponse. */ + public static class Builder { + + private Order order; + + private Response httpResponse; + + private Builder() {} + + public Builder order(Order order) { + this.order = order; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public OrderCancelResponse build() { + return new OrderCancelResponse(this); + } + } + + /** Get the order from the response. */ + public Order getOrder() { + return order; + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/OrderCreateRefundableCreditNoteResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/OrderCreateRefundableCreditNoteResponse.java new file mode 100644 index 00000000..56989cbe --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/responses/OrderCreateRefundableCreditNoteResponse.java @@ -0,0 +1,79 @@ +package com.chargebee.v4.models.order.responses; + +import com.chargebee.v4.models.order.Order; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for OrderCreateRefundableCreditNote operation. Contains the response + * data from the API. + */ +public final class OrderCreateRefundableCreditNoteResponse extends BaseResponse { + private final Order order; + + private OrderCreateRefundableCreditNoteResponse(Builder builder) { + super(builder.httpResponse); + + this.order = builder.order; + } + + /** Parse JSON response into OrderCreateRefundableCreditNoteResponse object. */ + public static OrderCreateRefundableCreditNoteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into OrderCreateRefundableCreditNoteResponse object with HTTP response. */ + public static OrderCreateRefundableCreditNoteResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __orderJson = JsonUtil.getObject(json, "order"); + if (__orderJson != null) { + builder.order(Order.fromJson(__orderJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse OrderCreateRefundableCreditNoteResponse from JSON", e); + } + } + + /** Create a new builder for OrderCreateRefundableCreditNoteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for OrderCreateRefundableCreditNoteResponse. */ + public static class Builder { + + private Order order; + + private Response httpResponse; + + private Builder() {} + + public Builder order(Order order) { + this.order = order; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public OrderCreateRefundableCreditNoteResponse build() { + return new OrderCreateRefundableCreditNoteResponse(this); + } + } + + /** Get the order from the response. */ + public Order getOrder() { + return order; + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/OrderDeleteResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/OrderDeleteResponse.java new file mode 100644 index 00000000..5c5c6a64 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/responses/OrderDeleteResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.order.responses; + +import com.chargebee.v4.models.order.Order; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for OrderDelete operation. Contains the response data from the API. */ +public final class OrderDeleteResponse extends BaseResponse { + private final Order order; + + private OrderDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.order = builder.order; + } + + /** Parse JSON response into OrderDeleteResponse object. */ + public static OrderDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into OrderDeleteResponse object with HTTP response. */ + public static OrderDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __orderJson = JsonUtil.getObject(json, "order"); + if (__orderJson != null) { + builder.order(Order.fromJson(__orderJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse OrderDeleteResponse from JSON", e); + } + } + + /** Create a new builder for OrderDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for OrderDeleteResponse. */ + public static class Builder { + + private Order order; + + private Response httpResponse; + + private Builder() {} + + public Builder order(Order order) { + this.order = order; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public OrderDeleteResponse build() { + return new OrderDeleteResponse(this); + } + } + + /** Get the order from the response. */ + public Order getOrder() { + return order; + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/OrderListResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/OrderListResponse.java index bbd50a6c..54b8e805 100644 --- a/src/main/java/com/chargebee/v4/models/order/responses/OrderListResponse.java +++ b/src/main/java/com/chargebee/v4/models/order/responses/OrderListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.order.Order; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.OrderService; @@ -95,9 +96,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public OrderListResponse nextPage() throws Exception { + public OrderListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/order/responses/OrderReopenResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/OrderReopenResponse.java new file mode 100644 index 00000000..f341863f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/responses/OrderReopenResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.order.responses; + +import com.chargebee.v4.models.order.Order; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for OrderReopen operation. Contains the response data from the API. */ +public final class OrderReopenResponse extends BaseResponse { + private final Order order; + + private OrderReopenResponse(Builder builder) { + super(builder.httpResponse); + + this.order = builder.order; + } + + /** Parse JSON response into OrderReopenResponse object. */ + public static OrderReopenResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into OrderReopenResponse object with HTTP response. */ + public static OrderReopenResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __orderJson = JsonUtil.getObject(json, "order"); + if (__orderJson != null) { + builder.order(Order.fromJson(__orderJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse OrderReopenResponse from JSON", e); + } + } + + /** Create a new builder for OrderReopenResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for OrderReopenResponse. */ + public static class Builder { + + private Order order; + + private Response httpResponse; + + private Builder() {} + + public Builder order(Order order) { + this.order = order; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public OrderReopenResponse build() { + return new OrderReopenResponse(this); + } + } + + /** Get the order from the response. */ + public Order getOrder() { + return order; + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/OrderResendResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/OrderResendResponse.java new file mode 100644 index 00000000..95e2afe4 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/order/responses/OrderResendResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.order.responses; + +import com.chargebee.v4.models.order.Order; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for OrderResend operation. Contains the response data from the API. */ +public final class OrderResendResponse extends BaseResponse { + private final Order order; + + private OrderResendResponse(Builder builder) { + super(builder.httpResponse); + + this.order = builder.order; + } + + /** Parse JSON response into OrderResendResponse object. */ + public static OrderResendResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into OrderResendResponse object with HTTP response. */ + public static OrderResendResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __orderJson = JsonUtil.getObject(json, "order"); + if (__orderJson != null) { + builder.order(Order.fromJson(__orderJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse OrderResendResponse from JSON", e); + } + } + + /** Create a new builder for OrderResendResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for OrderResendResponse. */ + public static class Builder { + + private Order order; + + private Response httpResponse; + + private Builder() {} + + public Builder order(Order order) { + this.order = order; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public OrderResendResponse build() { + return new OrderResendResponse(this); + } + } + + /** Get the order from the response. */ + public Order getOrder() { + return order; + } +} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/OrdersForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/OrdersForInvoiceResponse.java index a7b291b3..389bea5b 100644 --- a/src/main/java/com/chargebee/v4/models/order/responses/OrdersForInvoiceResponse.java +++ b/src/main/java/com/chargebee/v4/models/order/responses/OrdersForInvoiceResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.order.Order; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.OrderService; @@ -105,9 +106,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public OrdersForInvoiceResponse nextPage() throws Exception { + public OrdersForInvoiceResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/order/responses/ReopenForOrderResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/ReopenForOrderResponse.java deleted file mode 100644 index 9b32e44b..00000000 --- a/src/main/java/com/chargebee/v4/models/order/responses/ReopenForOrderResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.order.responses; - -import com.chargebee.v4.models.order.Order; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ReopenForOrder operation. Contains the response data from the API. - */ -public final class ReopenForOrderResponse extends BaseResponse { - private final Order order; - - private ReopenForOrderResponse(Builder builder) { - super(builder.httpResponse); - - this.order = builder.order; - } - - /** Parse JSON response into ReopenForOrderResponse object. */ - public static ReopenForOrderResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ReopenForOrderResponse object with HTTP response. */ - public static ReopenForOrderResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __orderJson = JsonUtil.getObject(json, "order"); - if (__orderJson != null) { - builder.order(Order.fromJson(__orderJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ReopenForOrderResponse from JSON", e); - } - } - - /** Create a new builder for ReopenForOrderResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ReopenForOrderResponse. */ - public static class Builder { - - private Order order; - - private Response httpResponse; - - private Builder() {} - - public Builder order(Order order) { - this.order = order; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ReopenForOrderResponse build() { - return new ReopenForOrderResponse(this); - } - } - - /** Get the order from the response. */ - public Order getOrder() { - return order; - } -} diff --git a/src/main/java/com/chargebee/v4/models/order/responses/ResendForOrderResponse.java b/src/main/java/com/chargebee/v4/models/order/responses/ResendForOrderResponse.java deleted file mode 100644 index 7cfe8c85..00000000 --- a/src/main/java/com/chargebee/v4/models/order/responses/ResendForOrderResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.order.responses; - -import com.chargebee.v4.models.order.Order; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ResendForOrder operation. Contains the response data from the API. - */ -public final class ResendForOrderResponse extends BaseResponse { - private final Order order; - - private ResendForOrderResponse(Builder builder) { - super(builder.httpResponse); - - this.order = builder.order; - } - - /** Parse JSON response into ResendForOrderResponse object. */ - public static ResendForOrderResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ResendForOrderResponse object with HTTP response. */ - public static ResendForOrderResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __orderJson = JsonUtil.getObject(json, "order"); - if (__orderJson != null) { - builder.order(Order.fromJson(__orderJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ResendForOrderResponse from JSON", e); - } - } - - /** Create a new builder for ResendForOrderResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ResendForOrderResponse. */ - public static class Builder { - - private Order order; - - private Response httpResponse; - - private Builder() {} - - public Builder order(Order order) { - this.order = order; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ResendForOrderResponse build() { - return new ResendForOrderResponse(this); - } - } - - /** Get the order from the response. */ - public Order getOrder() { - return order; - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/params/DeletePaymentScheduleSchemeParams.java b/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/params/DeletePaymentScheduleSchemeParams.java deleted file mode 100644 index 41bc6e4c..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/params/DeletePaymentScheduleSchemeParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.paymentScheduleScheme.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeletePaymentScheduleSchemeParams { - - private DeletePaymentScheduleSchemeParams(DeletePaymentScheduleSchemeBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeletePaymentScheduleSchemeParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeletePaymentScheduleSchemeBuilder builder() { - return new DeletePaymentScheduleSchemeBuilder(); - } - - public static final class DeletePaymentScheduleSchemeBuilder { - - private DeletePaymentScheduleSchemeBuilder() {} - - public DeletePaymentScheduleSchemeParams build() { - return new DeletePaymentScheduleSchemeParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/params/PaymentScheduleSchemeDeleteParams.java b/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/params/PaymentScheduleSchemeDeleteParams.java new file mode 100644 index 00000000..938814c5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/params/PaymentScheduleSchemeDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.paymentScheduleScheme.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PaymentScheduleSchemeDeleteParams { + + private PaymentScheduleSchemeDeleteParams(PaymentScheduleSchemeDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for PaymentScheduleSchemeDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentScheduleSchemeDeleteBuilder builder() { + return new PaymentScheduleSchemeDeleteBuilder(); + } + + public static final class PaymentScheduleSchemeDeleteBuilder { + + private PaymentScheduleSchemeDeleteBuilder() {} + + public PaymentScheduleSchemeDeleteParams build() { + return new PaymentScheduleSchemeDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/responses/DeletePaymentScheduleSchemeResponse.java b/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/responses/DeletePaymentScheduleSchemeResponse.java deleted file mode 100644 index b9ff3821..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/responses/DeletePaymentScheduleSchemeResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.paymentScheduleScheme.responses; - -import com.chargebee.v4.models.paymentScheduleScheme.PaymentScheduleScheme; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeletePaymentScheduleScheme operation. Contains the response data - * from the API. - */ -public final class DeletePaymentScheduleSchemeResponse extends BaseResponse { - private final PaymentScheduleScheme paymentScheduleScheme; - - private DeletePaymentScheduleSchemeResponse(Builder builder) { - super(builder.httpResponse); - - this.paymentScheduleScheme = builder.paymentScheduleScheme; - } - - /** Parse JSON response into DeletePaymentScheduleSchemeResponse object. */ - public static DeletePaymentScheduleSchemeResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeletePaymentScheduleSchemeResponse object with HTTP response. */ - public static DeletePaymentScheduleSchemeResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __paymentScheduleSchemeJson = JsonUtil.getObject(json, "payment_schedule_scheme"); - if (__paymentScheduleSchemeJson != null) { - builder.paymentScheduleScheme(PaymentScheduleScheme.fromJson(__paymentScheduleSchemeJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse DeletePaymentScheduleSchemeResponse from JSON", e); - } - } - - /** Create a new builder for DeletePaymentScheduleSchemeResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeletePaymentScheduleSchemeResponse. */ - public static class Builder { - - private PaymentScheduleScheme paymentScheduleScheme; - - private Response httpResponse; - - private Builder() {} - - public Builder paymentScheduleScheme(PaymentScheduleScheme paymentScheduleScheme) { - this.paymentScheduleScheme = paymentScheduleScheme; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeletePaymentScheduleSchemeResponse build() { - return new DeletePaymentScheduleSchemeResponse(this); - } - } - - /** Get the paymentScheduleScheme from the response. */ - public PaymentScheduleScheme getPaymentScheduleScheme() { - return paymentScheduleScheme; - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/responses/PaymentScheduleSchemeDeleteResponse.java b/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/responses/PaymentScheduleSchemeDeleteResponse.java new file mode 100644 index 00000000..7cd070a1 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentScheduleScheme/responses/PaymentScheduleSchemeDeleteResponse.java @@ -0,0 +1,78 @@ +package com.chargebee.v4.models.paymentScheduleScheme.responses; + +import com.chargebee.v4.models.paymentScheduleScheme.PaymentScheduleScheme; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PaymentScheduleSchemeDelete operation. Contains the response data + * from the API. + */ +public final class PaymentScheduleSchemeDeleteResponse extends BaseResponse { + private final PaymentScheduleScheme paymentScheduleScheme; + + private PaymentScheduleSchemeDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.paymentScheduleScheme = builder.paymentScheduleScheme; + } + + /** Parse JSON response into PaymentScheduleSchemeDeleteResponse object. */ + public static PaymentScheduleSchemeDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PaymentScheduleSchemeDeleteResponse object with HTTP response. */ + public static PaymentScheduleSchemeDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __paymentScheduleSchemeJson = JsonUtil.getObject(json, "payment_schedule_scheme"); + if (__paymentScheduleSchemeJson != null) { + builder.paymentScheduleScheme(PaymentScheduleScheme.fromJson(__paymentScheduleSchemeJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse PaymentScheduleSchemeDeleteResponse from JSON", e); + } + } + + /** Create a new builder for PaymentScheduleSchemeDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PaymentScheduleSchemeDeleteResponse. */ + public static class Builder { + + private PaymentScheduleScheme paymentScheduleScheme; + + private Response httpResponse; + + private Builder() {} + + public Builder paymentScheduleScheme(PaymentScheduleScheme paymentScheduleScheme) { + this.paymentScheduleScheme = paymentScheduleScheme; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PaymentScheduleSchemeDeleteResponse build() { + return new PaymentScheduleSchemeDeleteResponse(this); + } + } + + /** Get the paymentScheduleScheme from the response. */ + public PaymentScheduleScheme getPaymentScheduleScheme() { + return paymentScheduleScheme; + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/AgreementPdfForPaymentSourceParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/AgreementPdfForPaymentSourceParams.java deleted file mode 100644 index 1d5a5c92..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/AgreementPdfForPaymentSourceParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.paymentSource.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class AgreementPdfForPaymentSourceParams { - - private AgreementPdfForPaymentSourceParams(AgreementPdfForPaymentSourceBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for AgreementPdfForPaymentSourceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AgreementPdfForPaymentSourceBuilder builder() { - return new AgreementPdfForPaymentSourceBuilder(); - } - - public static final class AgreementPdfForPaymentSourceBuilder { - - private AgreementPdfForPaymentSourceBuilder() {} - - public AgreementPdfForPaymentSourceParams build() { - return new AgreementPdfForPaymentSourceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/DeleteLocalForPaymentSourceParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/DeleteLocalForPaymentSourceParams.java deleted file mode 100644 index 6d76d3f2..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/DeleteLocalForPaymentSourceParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.paymentSource.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteLocalForPaymentSourceParams { - - private DeleteLocalForPaymentSourceParams(DeleteLocalForPaymentSourceBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteLocalForPaymentSourceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteLocalForPaymentSourceBuilder builder() { - return new DeleteLocalForPaymentSourceBuilder(); - } - - public static final class DeleteLocalForPaymentSourceBuilder { - - private DeleteLocalForPaymentSourceBuilder() {} - - public DeleteLocalForPaymentSourceParams build() { - return new DeleteLocalForPaymentSourceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/DeletePaymentSourceParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/DeletePaymentSourceParams.java deleted file mode 100644 index b8702d74..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/DeletePaymentSourceParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.paymentSource.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeletePaymentSourceParams { - - private DeletePaymentSourceParams(DeletePaymentSourceBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeletePaymentSourceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeletePaymentSourceBuilder builder() { - return new DeletePaymentSourceBuilder(); - } - - public static final class DeletePaymentSourceBuilder { - - private DeletePaymentSourceBuilder() {} - - public DeletePaymentSourceParams build() { - return new DeletePaymentSourceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/ExportPaymentSourceForPaymentSourceParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/ExportPaymentSourceForPaymentSourceParams.java deleted file mode 100644 index 17b46f68..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/ExportPaymentSourceForPaymentSourceParams.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.paymentSource.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ExportPaymentSourceForPaymentSourceParams { - - private final String gatewayAccountId; - - private ExportPaymentSourceForPaymentSourceParams( - ExportPaymentSourceForPaymentSourceBuilder builder) { - - this.gatewayAccountId = builder.gatewayAccountId; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - return formData; - } - - /** Create a new builder for ExportPaymentSourceForPaymentSourceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ExportPaymentSourceForPaymentSourceBuilder builder() { - return new ExportPaymentSourceForPaymentSourceBuilder(); - } - - public static final class ExportPaymentSourceForPaymentSourceBuilder { - - private String gatewayAccountId; - - private ExportPaymentSourceForPaymentSourceBuilder() {} - - public ExportPaymentSourceForPaymentSourceBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public ExportPaymentSourceForPaymentSourceParams build() { - return new ExportPaymentSourceForPaymentSourceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/ExportPaymentSourceParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/ExportPaymentSourceParams.java new file mode 100644 index 00000000..034880e9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/ExportPaymentSourceParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.paymentSource.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ExportPaymentSourceParams { + + private final String gatewayAccountId; + + private ExportPaymentSourceParams(ExportPaymentSourceBuilder builder) { + + this.gatewayAccountId = builder.gatewayAccountId; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + return formData; + } + + /** Create a new builder for ExportPaymentSourceParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ExportPaymentSourceBuilder builder() { + return new ExportPaymentSourceBuilder(); + } + + public static final class ExportPaymentSourceBuilder { + + private String gatewayAccountId; + + private ExportPaymentSourceBuilder() {} + + public ExportPaymentSourceBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public ExportPaymentSourceParams build() { + return new ExportPaymentSourceParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceAgreementPdfParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceAgreementPdfParams.java new file mode 100644 index 00000000..1af071fa --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceAgreementPdfParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.paymentSource.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PaymentSourceAgreementPdfParams { + + private PaymentSourceAgreementPdfParams(PaymentSourceAgreementPdfBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for PaymentSourceAgreementPdfParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentSourceAgreementPdfBuilder builder() { + return new PaymentSourceAgreementPdfBuilder(); + } + + public static final class PaymentSourceAgreementPdfBuilder { + + private PaymentSourceAgreementPdfBuilder() {} + + public PaymentSourceAgreementPdfParams build() { + return new PaymentSourceAgreementPdfParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceDeleteLocalParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceDeleteLocalParams.java new file mode 100644 index 00000000..6e44bac3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceDeleteLocalParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.paymentSource.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PaymentSourceDeleteLocalParams { + + private PaymentSourceDeleteLocalParams(PaymentSourceDeleteLocalBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for PaymentSourceDeleteLocalParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentSourceDeleteLocalBuilder builder() { + return new PaymentSourceDeleteLocalBuilder(); + } + + public static final class PaymentSourceDeleteLocalBuilder { + + private PaymentSourceDeleteLocalBuilder() {} + + public PaymentSourceDeleteLocalParams build() { + return new PaymentSourceDeleteLocalParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceDeleteParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceDeleteParams.java new file mode 100644 index 00000000..241d2cd6 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.paymentSource.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PaymentSourceDeleteParams { + + private PaymentSourceDeleteParams(PaymentSourceDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for PaymentSourceDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentSourceDeleteBuilder builder() { + return new PaymentSourceDeleteBuilder(); + } + + public static final class PaymentSourceDeleteBuilder { + + private PaymentSourceDeleteBuilder() {} + + public PaymentSourceDeleteParams build() { + return new PaymentSourceDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceSwitchGatewayAccountParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceSwitchGatewayAccountParams.java new file mode 100644 index 00000000..62c8f623 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceSwitchGatewayAccountParams.java @@ -0,0 +1,61 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.paymentSource.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PaymentSourceSwitchGatewayAccountParams { + + private final String gatewayAccountId; + + private PaymentSourceSwitchGatewayAccountParams( + PaymentSourceSwitchGatewayAccountBuilder builder) { + + this.gatewayAccountId = builder.gatewayAccountId; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + return formData; + } + + /** Create a new builder for PaymentSourceSwitchGatewayAccountParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentSourceSwitchGatewayAccountBuilder builder() { + return new PaymentSourceSwitchGatewayAccountBuilder(); + } + + public static final class PaymentSourceSwitchGatewayAccountBuilder { + + private String gatewayAccountId; + + private PaymentSourceSwitchGatewayAccountBuilder() {} + + public PaymentSourceSwitchGatewayAccountBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public PaymentSourceSwitchGatewayAccountParams build() { + return new PaymentSourceSwitchGatewayAccountParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceUpdateBankAccountParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceUpdateBankAccountParams.java new file mode 100644 index 00000000..060f1313 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceUpdateBankAccountParams.java @@ -0,0 +1,153 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.paymentSource.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PaymentSourceUpdateBankAccountParams { + + private final BankAccountParams bankAccount; + + private PaymentSourceUpdateBankAccountParams(PaymentSourceUpdateBankAccountBuilder builder) { + + this.bankAccount = builder.bankAccount; + } + + public BankAccountParams getBankAccount() { + return bankAccount; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.bankAccount != null) { + + // Single object + Map nestedData = this.bankAccount.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "bank_account[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for PaymentSourceUpdateBankAccountParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentSourceUpdateBankAccountBuilder builder() { + return new PaymentSourceUpdateBankAccountBuilder(); + } + + public static final class PaymentSourceUpdateBankAccountBuilder { + + private BankAccountParams bankAccount; + + private PaymentSourceUpdateBankAccountBuilder() {} + + public PaymentSourceUpdateBankAccountBuilder bankAccount(BankAccountParams value) { + this.bankAccount = value; + return this; + } + + public PaymentSourceUpdateBankAccountParams build() { + return new PaymentSourceUpdateBankAccountParams(this); + } + } + + public static final class BankAccountParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private BankAccountParams(BankAccountBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + return formData; + } + + /** Create a new builder for BankAccountParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BankAccountBuilder builder() { + return new BankAccountBuilder(); + } + + public static final class BankAccountBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private BankAccountBuilder() {} + + public BankAccountBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public BankAccountBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public BankAccountBuilder email(String value) { + this.email = value; + return this; + } + + public BankAccountParams build() { + return new BankAccountParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceUpdateCardParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceUpdateCardParams.java new file mode 100644 index 00000000..f453ea53 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceUpdateCardParams.java @@ -0,0 +1,374 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.paymentSource.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PaymentSourceUpdateCardParams { + + private final java.util.Map gatewayMetaData; + + private final String referenceTransaction; + + private final CardParams card; + + private PaymentSourceUpdateCardParams(PaymentSourceUpdateCardBuilder builder) { + + this.gatewayMetaData = builder.gatewayMetaData; + + this.referenceTransaction = builder.referenceTransaction; + + this.card = builder.card; + } + + public java.util.Map getGatewayMetaData() { + return gatewayMetaData; + } + + public String getReferenceTransaction() { + return referenceTransaction; + } + + public CardParams getCard() { + return card; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.gatewayMetaData != null) { + + formData.put("gateway_meta_data", JsonUtil.toJson(this.gatewayMetaData)); + } + + if (this.referenceTransaction != null) { + + formData.put("reference_transaction", this.referenceTransaction); + } + + if (this.card != null) { + + // Single object + Map nestedData = this.card.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "card[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for PaymentSourceUpdateCardParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentSourceUpdateCardBuilder builder() { + return new PaymentSourceUpdateCardBuilder(); + } + + public static final class PaymentSourceUpdateCardBuilder { + + private java.util.Map gatewayMetaData; + + private String referenceTransaction; + + private CardParams card; + + private PaymentSourceUpdateCardBuilder() {} + + public PaymentSourceUpdateCardBuilder gatewayMetaData(java.util.Map value) { + this.gatewayMetaData = value; + return this; + } + + public PaymentSourceUpdateCardBuilder referenceTransaction(String value) { + this.referenceTransaction = value; + return this; + } + + public PaymentSourceUpdateCardBuilder card(CardParams value) { + this.card = value; + return this; + } + + public PaymentSourceUpdateCardParams build() { + return new PaymentSourceUpdateCardParams(this); + } + } + + public static final class CardParams { + + private final String firstName; + + private final String lastName; + + private final Integer expiryMonth; + + private final Integer expiryYear; + + private final String billingAddr1; + + private final String billingAddr2; + + private final String billingCity; + + private final String billingZip; + + private final String billingStateCode; + + private final String billingState; + + private final String billingCountry; + + private final java.util.Map additionalInformation; + + private CardParams(CardBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.expiryMonth = builder.expiryMonth; + + this.expiryYear = builder.expiryYear; + + this.billingAddr1 = builder.billingAddr1; + + this.billingAddr2 = builder.billingAddr2; + + this.billingCity = builder.billingCity; + + this.billingZip = builder.billingZip; + + this.billingStateCode = builder.billingStateCode; + + this.billingState = builder.billingState; + + this.billingCountry = builder.billingCountry; + + this.additionalInformation = builder.additionalInformation; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public Integer getExpiryMonth() { + return expiryMonth; + } + + public Integer getExpiryYear() { + return expiryYear; + } + + public String getBillingAddr1() { + return billingAddr1; + } + + public String getBillingAddr2() { + return billingAddr2; + } + + public String getBillingCity() { + return billingCity; + } + + public String getBillingZip() { + return billingZip; + } + + public String getBillingStateCode() { + return billingStateCode; + } + + public String getBillingState() { + return billingState; + } + + public String getBillingCountry() { + return billingCountry; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.expiryMonth != null) { + + formData.put("expiry_month", this.expiryMonth); + } + + if (this.expiryYear != null) { + + formData.put("expiry_year", this.expiryYear); + } + + if (this.billingAddr1 != null) { + + formData.put("billing_addr1", this.billingAddr1); + } + + if (this.billingAddr2 != null) { + + formData.put("billing_addr2", this.billingAddr2); + } + + if (this.billingCity != null) { + + formData.put("billing_city", this.billingCity); + } + + if (this.billingZip != null) { + + formData.put("billing_zip", this.billingZip); + } + + if (this.billingStateCode != null) { + + formData.put("billing_state_code", this.billingStateCode); + } + + if (this.billingState != null) { + + formData.put("billing_state", this.billingState); + } + + if (this.billingCountry != null) { + + formData.put("billing_country", this.billingCountry); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for CardParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CardBuilder builder() { + return new CardBuilder(); + } + + public static final class CardBuilder { + + private String firstName; + + private String lastName; + + private Integer expiryMonth; + + private Integer expiryYear; + + private String billingAddr1; + + private String billingAddr2; + + private String billingCity; + + private String billingZip; + + private String billingStateCode; + + private String billingState; + + private String billingCountry; + + private java.util.Map additionalInformation; + + private CardBuilder() {} + + public CardBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public CardBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public CardBuilder expiryMonth(Integer value) { + this.expiryMonth = value; + return this; + } + + public CardBuilder expiryYear(Integer value) { + this.expiryYear = value; + return this; + } + + public CardBuilder billingAddr1(String value) { + this.billingAddr1 = value; + return this; + } + + public CardBuilder billingAddr2(String value) { + this.billingAddr2 = value; + return this; + } + + public CardBuilder billingCity(String value) { + this.billingCity = value; + return this; + } + + public CardBuilder billingZip(String value) { + this.billingZip = value; + return this; + } + + public CardBuilder billingStateCode(String value) { + this.billingStateCode = value; + return this; + } + + public CardBuilder billingState(String value) { + this.billingState = value; + return this; + } + + public CardBuilder billingCountry(String value) { + this.billingCountry = value; + return this; + } + + public CardBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public CardParams build() { + return new CardParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceVerifyBankAccountParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceVerifyBankAccountParams.java new file mode 100644 index 00000000..956a93d5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceVerifyBankAccountParams.java @@ -0,0 +1,80 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.paymentSource.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PaymentSourceVerifyBankAccountParams { + + private final Long amount1; + + private final Long amount2; + + private PaymentSourceVerifyBankAccountParams(PaymentSourceVerifyBankAccountBuilder builder) { + + this.amount1 = builder.amount1; + + this.amount2 = builder.amount2; + } + + public Long getAmount1() { + return amount1; + } + + public Long getAmount2() { + return amount2; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount1 != null) { + + formData.put("amount1", this.amount1); + } + + if (this.amount2 != null) { + + formData.put("amount2", this.amount2); + } + + return formData; + } + + /** Create a new builder for PaymentSourceVerifyBankAccountParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentSourceVerifyBankAccountBuilder builder() { + return new PaymentSourceVerifyBankAccountBuilder(); + } + + public static final class PaymentSourceVerifyBankAccountBuilder { + + private Long amount1; + + private Long amount2; + + private PaymentSourceVerifyBankAccountBuilder() {} + + public PaymentSourceVerifyBankAccountBuilder amount1(Long value) { + this.amount1 = value; + return this; + } + + public PaymentSourceVerifyBankAccountBuilder amount2(Long value) { + this.amount2 = value; + return this; + } + + public PaymentSourceVerifyBankAccountParams build() { + return new PaymentSourceVerifyBankAccountParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/SwitchGatewayAccountForPaymentSourceParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/SwitchGatewayAccountForPaymentSourceParams.java deleted file mode 100644 index cb8aa511..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/SwitchGatewayAccountForPaymentSourceParams.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.paymentSource.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class SwitchGatewayAccountForPaymentSourceParams { - - private final String gatewayAccountId; - - private SwitchGatewayAccountForPaymentSourceParams( - SwitchGatewayAccountForPaymentSourceBuilder builder) { - - this.gatewayAccountId = builder.gatewayAccountId; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - return formData; - } - - /** Create a new builder for SwitchGatewayAccountForPaymentSourceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SwitchGatewayAccountForPaymentSourceBuilder builder() { - return new SwitchGatewayAccountForPaymentSourceBuilder(); - } - - public static final class SwitchGatewayAccountForPaymentSourceBuilder { - - private String gatewayAccountId; - - private SwitchGatewayAccountForPaymentSourceBuilder() {} - - public SwitchGatewayAccountForPaymentSourceBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public SwitchGatewayAccountForPaymentSourceParams build() { - return new SwitchGatewayAccountForPaymentSourceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/UpdateBankAccountForPaymentSourceParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/UpdateBankAccountForPaymentSourceParams.java deleted file mode 100644 index b4ca9139..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/UpdateBankAccountForPaymentSourceParams.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.paymentSource.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UpdateBankAccountForPaymentSourceParams { - - private final BankAccountParams bankAccount; - - private UpdateBankAccountForPaymentSourceParams( - UpdateBankAccountForPaymentSourceBuilder builder) { - - this.bankAccount = builder.bankAccount; - } - - public BankAccountParams getBankAccount() { - return bankAccount; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.bankAccount != null) { - - // Single object - Map nestedData = this.bankAccount.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "bank_account[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for UpdateBankAccountForPaymentSourceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateBankAccountForPaymentSourceBuilder builder() { - return new UpdateBankAccountForPaymentSourceBuilder(); - } - - public static final class UpdateBankAccountForPaymentSourceBuilder { - - private BankAccountParams bankAccount; - - private UpdateBankAccountForPaymentSourceBuilder() {} - - public UpdateBankAccountForPaymentSourceBuilder bankAccount(BankAccountParams value) { - this.bankAccount = value; - return this; - } - - public UpdateBankAccountForPaymentSourceParams build() { - return new UpdateBankAccountForPaymentSourceParams(this); - } - } - - public static final class BankAccountParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private BankAccountParams(BankAccountBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - return formData; - } - - /** Create a new builder for BankAccountParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BankAccountBuilder builder() { - return new BankAccountBuilder(); - } - - public static final class BankAccountBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private BankAccountBuilder() {} - - public BankAccountBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public BankAccountBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public BankAccountBuilder email(String value) { - this.email = value; - return this; - } - - public BankAccountParams build() { - return new BankAccountParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/UpdateCardForPaymentSourceParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/UpdateCardForPaymentSourceParams.java deleted file mode 100644 index 32bd180c..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/UpdateCardForPaymentSourceParams.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.paymentSource.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UpdateCardForPaymentSourceParams { - - private final java.util.Map gatewayMetaData; - - private final String referenceTransaction; - - private final CardParams card; - - private UpdateCardForPaymentSourceParams(UpdateCardForPaymentSourceBuilder builder) { - - this.gatewayMetaData = builder.gatewayMetaData; - - this.referenceTransaction = builder.referenceTransaction; - - this.card = builder.card; - } - - public java.util.Map getGatewayMetaData() { - return gatewayMetaData; - } - - public String getReferenceTransaction() { - return referenceTransaction; - } - - public CardParams getCard() { - return card; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.gatewayMetaData != null) { - - formData.put("gateway_meta_data", JsonUtil.toJson(this.gatewayMetaData)); - } - - if (this.referenceTransaction != null) { - - formData.put("reference_transaction", this.referenceTransaction); - } - - if (this.card != null) { - - // Single object - Map nestedData = this.card.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "card[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for UpdateCardForPaymentSourceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateCardForPaymentSourceBuilder builder() { - return new UpdateCardForPaymentSourceBuilder(); - } - - public static final class UpdateCardForPaymentSourceBuilder { - - private java.util.Map gatewayMetaData; - - private String referenceTransaction; - - private CardParams card; - - private UpdateCardForPaymentSourceBuilder() {} - - public UpdateCardForPaymentSourceBuilder gatewayMetaData(java.util.Map value) { - this.gatewayMetaData = value; - return this; - } - - public UpdateCardForPaymentSourceBuilder referenceTransaction(String value) { - this.referenceTransaction = value; - return this; - } - - public UpdateCardForPaymentSourceBuilder card(CardParams value) { - this.card = value; - return this; - } - - public UpdateCardForPaymentSourceParams build() { - return new UpdateCardForPaymentSourceParams(this); - } - } - - public static final class CardParams { - - private final String firstName; - - private final String lastName; - - private final Integer expiryMonth; - - private final Integer expiryYear; - - private final String billingAddr1; - - private final String billingAddr2; - - private final String billingCity; - - private final String billingZip; - - private final String billingStateCode; - - private final String billingState; - - private final String billingCountry; - - private final java.util.Map additionalInformation; - - private CardParams(CardBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.expiryMonth = builder.expiryMonth; - - this.expiryYear = builder.expiryYear; - - this.billingAddr1 = builder.billingAddr1; - - this.billingAddr2 = builder.billingAddr2; - - this.billingCity = builder.billingCity; - - this.billingZip = builder.billingZip; - - this.billingStateCode = builder.billingStateCode; - - this.billingState = builder.billingState; - - this.billingCountry = builder.billingCountry; - - this.additionalInformation = builder.additionalInformation; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public Integer getExpiryMonth() { - return expiryMonth; - } - - public Integer getExpiryYear() { - return expiryYear; - } - - public String getBillingAddr1() { - return billingAddr1; - } - - public String getBillingAddr2() { - return billingAddr2; - } - - public String getBillingCity() { - return billingCity; - } - - public String getBillingZip() { - return billingZip; - } - - public String getBillingStateCode() { - return billingStateCode; - } - - public String getBillingState() { - return billingState; - } - - public String getBillingCountry() { - return billingCountry; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.expiryMonth != null) { - - formData.put("expiry_month", this.expiryMonth); - } - - if (this.expiryYear != null) { - - formData.put("expiry_year", this.expiryYear); - } - - if (this.billingAddr1 != null) { - - formData.put("billing_addr1", this.billingAddr1); - } - - if (this.billingAddr2 != null) { - - formData.put("billing_addr2", this.billingAddr2); - } - - if (this.billingCity != null) { - - formData.put("billing_city", this.billingCity); - } - - if (this.billingZip != null) { - - formData.put("billing_zip", this.billingZip); - } - - if (this.billingStateCode != null) { - - formData.put("billing_state_code", this.billingStateCode); - } - - if (this.billingState != null) { - - formData.put("billing_state", this.billingState); - } - - if (this.billingCountry != null) { - - formData.put("billing_country", this.billingCountry); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for CardParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CardBuilder builder() { - return new CardBuilder(); - } - - public static final class CardBuilder { - - private String firstName; - - private String lastName; - - private Integer expiryMonth; - - private Integer expiryYear; - - private String billingAddr1; - - private String billingAddr2; - - private String billingCity; - - private String billingZip; - - private String billingStateCode; - - private String billingState; - - private String billingCountry; - - private java.util.Map additionalInformation; - - private CardBuilder() {} - - public CardBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public CardBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public CardBuilder expiryMonth(Integer value) { - this.expiryMonth = value; - return this; - } - - public CardBuilder expiryYear(Integer value) { - this.expiryYear = value; - return this; - } - - public CardBuilder billingAddr1(String value) { - this.billingAddr1 = value; - return this; - } - - public CardBuilder billingAddr2(String value) { - this.billingAddr2 = value; - return this; - } - - public CardBuilder billingCity(String value) { - this.billingCity = value; - return this; - } - - public CardBuilder billingZip(String value) { - this.billingZip = value; - return this; - } - - public CardBuilder billingStateCode(String value) { - this.billingStateCode = value; - return this; - } - - public CardBuilder billingState(String value) { - this.billingState = value; - return this; - } - - public CardBuilder billingCountry(String value) { - this.billingCountry = value; - return this; - } - - public CardBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public CardParams build() { - return new CardParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/VerifyBankAccountForPaymentSourceParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/VerifyBankAccountForPaymentSourceParams.java deleted file mode 100644 index da8d5d22..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/VerifyBankAccountForPaymentSourceParams.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.paymentSource.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class VerifyBankAccountForPaymentSourceParams { - - private final Long amount1; - - private final Long amount2; - - private VerifyBankAccountForPaymentSourceParams( - VerifyBankAccountForPaymentSourceBuilder builder) { - - this.amount1 = builder.amount1; - - this.amount2 = builder.amount2; - } - - public Long getAmount1() { - return amount1; - } - - public Long getAmount2() { - return amount2; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount1 != null) { - - formData.put("amount1", this.amount1); - } - - if (this.amount2 != null) { - - formData.put("amount2", this.amount2); - } - - return formData; - } - - /** Create a new builder for VerifyBankAccountForPaymentSourceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static VerifyBankAccountForPaymentSourceBuilder builder() { - return new VerifyBankAccountForPaymentSourceBuilder(); - } - - public static final class VerifyBankAccountForPaymentSourceBuilder { - - private Long amount1; - - private Long amount2; - - private VerifyBankAccountForPaymentSourceBuilder() {} - - public VerifyBankAccountForPaymentSourceBuilder amount1(Long value) { - this.amount1 = value; - return this; - } - - public VerifyBankAccountForPaymentSourceBuilder amount2(Long value) { - this.amount2 = value; - return this; - } - - public VerifyBankAccountForPaymentSourceParams build() { - return new VerifyBankAccountForPaymentSourceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/AgreementPdfForPaymentSourceResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/AgreementPdfForPaymentSourceResponse.java deleted file mode 100644 index c506a13c..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/responses/AgreementPdfForPaymentSourceResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.paymentSource.responses; - -import com.chargebee.v4.models.download.Download; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AgreementPdfForPaymentSource operation. Contains the response data - * from the API. - */ -public final class AgreementPdfForPaymentSourceResponse extends BaseResponse { - private final Download download; - - private AgreementPdfForPaymentSourceResponse(Builder builder) { - super(builder.httpResponse); - - this.download = builder.download; - } - - /** Parse JSON response into AgreementPdfForPaymentSourceResponse object. */ - public static AgreementPdfForPaymentSourceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AgreementPdfForPaymentSourceResponse object with HTTP response. */ - public static AgreementPdfForPaymentSourceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __downloadJson = JsonUtil.getObject(json, "download"); - if (__downloadJson != null) { - builder.download(Download.fromJson(__downloadJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse AgreementPdfForPaymentSourceResponse from JSON", e); - } - } - - /** Create a new builder for AgreementPdfForPaymentSourceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AgreementPdfForPaymentSourceResponse. */ - public static class Builder { - - private Download download; - - private Response httpResponse; - - private Builder() {} - - public Builder download(Download download) { - this.download = download; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AgreementPdfForPaymentSourceResponse build() { - return new AgreementPdfForPaymentSourceResponse(this); - } - } - - /** Get the download from the response. */ - public Download getDownload() { - return download; - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/DeleteLocalForPaymentSourceResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/DeleteLocalForPaymentSourceResponse.java deleted file mode 100644 index e11e0edb..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/responses/DeleteLocalForPaymentSourceResponse.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.chargebee.v4.models.paymentSource.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.paymentSource.PaymentSource; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteLocalForPaymentSource operation. Contains the response data - * from the API. - */ -public final class DeleteLocalForPaymentSourceResponse extends BaseResponse { - private final Customer customer; - - private final PaymentSource paymentSource; - - private DeleteLocalForPaymentSourceResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.paymentSource = builder.paymentSource; - } - - /** Parse JSON response into DeleteLocalForPaymentSourceResponse object. */ - public static DeleteLocalForPaymentSourceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteLocalForPaymentSourceResponse object with HTTP response. */ - public static DeleteLocalForPaymentSourceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); - if (__paymentSourceJson != null) { - builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse DeleteLocalForPaymentSourceResponse from JSON", e); - } - } - - /** Create a new builder for DeleteLocalForPaymentSourceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteLocalForPaymentSourceResponse. */ - public static class Builder { - - private Customer customer; - - private PaymentSource paymentSource; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder paymentSource(PaymentSource paymentSource) { - this.paymentSource = paymentSource; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteLocalForPaymentSourceResponse build() { - return new DeleteLocalForPaymentSourceResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the paymentSource from the response. */ - public PaymentSource getPaymentSource() { - return paymentSource; - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/DeletePaymentSourceResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/DeletePaymentSourceResponse.java deleted file mode 100644 index 81a5aa60..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/responses/DeletePaymentSourceResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.paymentSource.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.paymentSource.PaymentSource; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeletePaymentSource operation. Contains the response data from the - * API. - */ -public final class DeletePaymentSourceResponse extends BaseResponse { - private final Customer customer; - - private final PaymentSource paymentSource; - - private DeletePaymentSourceResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.paymentSource = builder.paymentSource; - } - - /** Parse JSON response into DeletePaymentSourceResponse object. */ - public static DeletePaymentSourceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeletePaymentSourceResponse object with HTTP response. */ - public static DeletePaymentSourceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); - if (__paymentSourceJson != null) { - builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeletePaymentSourceResponse from JSON", e); - } - } - - /** Create a new builder for DeletePaymentSourceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeletePaymentSourceResponse. */ - public static class Builder { - - private Customer customer; - - private PaymentSource paymentSource; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder paymentSource(PaymentSource paymentSource) { - this.paymentSource = paymentSource; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeletePaymentSourceResponse build() { - return new DeletePaymentSourceResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the paymentSource from the response. */ - public PaymentSource getPaymentSource() { - return paymentSource; - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/ExportPaymentSourceForPaymentSourceResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/ExportPaymentSourceForPaymentSourceResponse.java deleted file mode 100644 index a9c7f9f6..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/responses/ExportPaymentSourceForPaymentSourceResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.paymentSource.responses; - -import com.chargebee.v4.models.thirdPartyPaymentMethod.ThirdPartyPaymentMethod; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ExportPaymentSourceForPaymentSource operation. Contains the - * response data from the API. - */ -public final class ExportPaymentSourceForPaymentSourceResponse extends BaseResponse { - private final ThirdPartyPaymentMethod thirdPartyPaymentMethod; - - private ExportPaymentSourceForPaymentSourceResponse(Builder builder) { - super(builder.httpResponse); - - this.thirdPartyPaymentMethod = builder.thirdPartyPaymentMethod; - } - - /** Parse JSON response into ExportPaymentSourceForPaymentSourceResponse object. */ - public static ExportPaymentSourceForPaymentSourceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into ExportPaymentSourceForPaymentSourceResponse object with HTTP response. - */ - public static ExportPaymentSourceForPaymentSourceResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __thirdPartyPaymentMethodJson = JsonUtil.getObject(json, "third_party_payment_method"); - if (__thirdPartyPaymentMethodJson != null) { - builder.thirdPartyPaymentMethod( - ThirdPartyPaymentMethod.fromJson(__thirdPartyPaymentMethodJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ExportPaymentSourceForPaymentSourceResponse from JSON", e); - } - } - - /** Create a new builder for ExportPaymentSourceForPaymentSourceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ExportPaymentSourceForPaymentSourceResponse. */ - public static class Builder { - - private ThirdPartyPaymentMethod thirdPartyPaymentMethod; - - private Response httpResponse; - - private Builder() {} - - public Builder thirdPartyPaymentMethod(ThirdPartyPaymentMethod thirdPartyPaymentMethod) { - this.thirdPartyPaymentMethod = thirdPartyPaymentMethod; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ExportPaymentSourceForPaymentSourceResponse build() { - return new ExportPaymentSourceForPaymentSourceResponse(this); - } - } - - /** Get the thirdPartyPaymentMethod from the response. */ - public ThirdPartyPaymentMethod getThirdPartyPaymentMethod() { - return thirdPartyPaymentMethod; - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/ExportPaymentSourceResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/ExportPaymentSourceResponse.java new file mode 100644 index 00000000..6cfa323c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/responses/ExportPaymentSourceResponse.java @@ -0,0 +1,78 @@ +package com.chargebee.v4.models.paymentSource.responses; + +import com.chargebee.v4.models.thirdPartyPaymentMethod.ThirdPartyPaymentMethod; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for ExportPaymentSource operation. Contains the response data from the + * API. + */ +public final class ExportPaymentSourceResponse extends BaseResponse { + private final ThirdPartyPaymentMethod thirdPartyPaymentMethod; + + private ExportPaymentSourceResponse(Builder builder) { + super(builder.httpResponse); + + this.thirdPartyPaymentMethod = builder.thirdPartyPaymentMethod; + } + + /** Parse JSON response into ExportPaymentSourceResponse object. */ + public static ExportPaymentSourceResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into ExportPaymentSourceResponse object with HTTP response. */ + public static ExportPaymentSourceResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __thirdPartyPaymentMethodJson = JsonUtil.getObject(json, "third_party_payment_method"); + if (__thirdPartyPaymentMethodJson != null) { + builder.thirdPartyPaymentMethod( + ThirdPartyPaymentMethod.fromJson(__thirdPartyPaymentMethodJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse ExportPaymentSourceResponse from JSON", e); + } + } + + /** Create a new builder for ExportPaymentSourceResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ExportPaymentSourceResponse. */ + public static class Builder { + + private ThirdPartyPaymentMethod thirdPartyPaymentMethod; + + private Response httpResponse; + + private Builder() {} + + public Builder thirdPartyPaymentMethod(ThirdPartyPaymentMethod thirdPartyPaymentMethod) { + this.thirdPartyPaymentMethod = thirdPartyPaymentMethod; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public ExportPaymentSourceResponse build() { + return new ExportPaymentSourceResponse(this); + } + } + + /** Get the thirdPartyPaymentMethod from the response. */ + public ThirdPartyPaymentMethod getThirdPartyPaymentMethod() { + return thirdPartyPaymentMethod; + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceAgreementPdfResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceAgreementPdfResponse.java new file mode 100644 index 00000000..d3db8c85 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceAgreementPdfResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.paymentSource.responses; + +import com.chargebee.v4.models.download.Download; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PaymentSourceAgreementPdf operation. Contains the response data + * from the API. + */ +public final class PaymentSourceAgreementPdfResponse extends BaseResponse { + private final Download download; + + private PaymentSourceAgreementPdfResponse(Builder builder) { + super(builder.httpResponse); + + this.download = builder.download; + } + + /** Parse JSON response into PaymentSourceAgreementPdfResponse object. */ + public static PaymentSourceAgreementPdfResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PaymentSourceAgreementPdfResponse object with HTTP response. */ + public static PaymentSourceAgreementPdfResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __downloadJson = JsonUtil.getObject(json, "download"); + if (__downloadJson != null) { + builder.download(Download.fromJson(__downloadJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse PaymentSourceAgreementPdfResponse from JSON", e); + } + } + + /** Create a new builder for PaymentSourceAgreementPdfResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PaymentSourceAgreementPdfResponse. */ + public static class Builder { + + private Download download; + + private Response httpResponse; + + private Builder() {} + + public Builder download(Download download) { + this.download = download; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PaymentSourceAgreementPdfResponse build() { + return new PaymentSourceAgreementPdfResponse(this); + } + } + + /** Get the download from the response. */ + public Download getDownload() { + return download; + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceDeleteLocalResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceDeleteLocalResponse.java new file mode 100644 index 00000000..fcc5e921 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceDeleteLocalResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.paymentSource.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.paymentSource.PaymentSource; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PaymentSourceDeleteLocal operation. Contains the response data from + * the API. + */ +public final class PaymentSourceDeleteLocalResponse extends BaseResponse { + private final Customer customer; + + private final PaymentSource paymentSource; + + private PaymentSourceDeleteLocalResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.paymentSource = builder.paymentSource; + } + + /** Parse JSON response into PaymentSourceDeleteLocalResponse object. */ + public static PaymentSourceDeleteLocalResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PaymentSourceDeleteLocalResponse object with HTTP response. */ + public static PaymentSourceDeleteLocalResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); + if (__paymentSourceJson != null) { + builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse PaymentSourceDeleteLocalResponse from JSON", e); + } + } + + /** Create a new builder for PaymentSourceDeleteLocalResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PaymentSourceDeleteLocalResponse. */ + public static class Builder { + + private Customer customer; + + private PaymentSource paymentSource; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder paymentSource(PaymentSource paymentSource) { + this.paymentSource = paymentSource; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PaymentSourceDeleteLocalResponse build() { + return new PaymentSourceDeleteLocalResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the paymentSource from the response. */ + public PaymentSource getPaymentSource() { + return paymentSource; + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceDeleteResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceDeleteResponse.java new file mode 100644 index 00000000..57007979 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceDeleteResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.paymentSource.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.paymentSource.PaymentSource; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PaymentSourceDelete operation. Contains the response data from the + * API. + */ +public final class PaymentSourceDeleteResponse extends BaseResponse { + private final Customer customer; + + private final PaymentSource paymentSource; + + private PaymentSourceDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.paymentSource = builder.paymentSource; + } + + /** Parse JSON response into PaymentSourceDeleteResponse object. */ + public static PaymentSourceDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PaymentSourceDeleteResponse object with HTTP response. */ + public static PaymentSourceDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); + if (__paymentSourceJson != null) { + builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse PaymentSourceDeleteResponse from JSON", e); + } + } + + /** Create a new builder for PaymentSourceDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PaymentSourceDeleteResponse. */ + public static class Builder { + + private Customer customer; + + private PaymentSource paymentSource; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder paymentSource(PaymentSource paymentSource) { + this.paymentSource = paymentSource; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PaymentSourceDeleteResponse build() { + return new PaymentSourceDeleteResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the paymentSource from the response. */ + public PaymentSource getPaymentSource() { + return paymentSource; + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceListResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceListResponse.java index 180c137b..0cd02cd0 100644 --- a/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceListResponse.java +++ b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.paymentSource.PaymentSource; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.PaymentSourceService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public PaymentSourceListResponse nextPage() throws Exception { + public PaymentSourceListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceSwitchGatewayAccountResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceSwitchGatewayAccountResponse.java new file mode 100644 index 00000000..33d6c8eb --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceSwitchGatewayAccountResponse.java @@ -0,0 +1,104 @@ +package com.chargebee.v4.models.paymentSource.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.paymentSource.PaymentSource; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PaymentSourceSwitchGatewayAccount operation. Contains the response + * data from the API. + */ +public final class PaymentSourceSwitchGatewayAccountResponse extends BaseResponse { + private final Customer customer; + + private final PaymentSource paymentSource; + + private PaymentSourceSwitchGatewayAccountResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.paymentSource = builder.paymentSource; + } + + /** Parse JSON response into PaymentSourceSwitchGatewayAccountResponse object. */ + public static PaymentSourceSwitchGatewayAccountResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into PaymentSourceSwitchGatewayAccountResponse object with HTTP response. + */ + public static PaymentSourceSwitchGatewayAccountResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); + if (__paymentSourceJson != null) { + builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse PaymentSourceSwitchGatewayAccountResponse from JSON", e); + } + } + + /** Create a new builder for PaymentSourceSwitchGatewayAccountResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PaymentSourceSwitchGatewayAccountResponse. */ + public static class Builder { + + private Customer customer; + + private PaymentSource paymentSource; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder paymentSource(PaymentSource paymentSource) { + this.paymentSource = paymentSource; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PaymentSourceSwitchGatewayAccountResponse build() { + return new PaymentSourceSwitchGatewayAccountResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the paymentSource from the response. */ + public PaymentSource getPaymentSource() { + return paymentSource; + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceUpdateBankAccountResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceUpdateBankAccountResponse.java new file mode 100644 index 00000000..84a9d400 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceUpdateBankAccountResponse.java @@ -0,0 +1,102 @@ +package com.chargebee.v4.models.paymentSource.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.paymentSource.PaymentSource; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PaymentSourceUpdateBankAccount operation. Contains the response + * data from the API. + */ +public final class PaymentSourceUpdateBankAccountResponse extends BaseResponse { + private final Customer customer; + + private final PaymentSource paymentSource; + + private PaymentSourceUpdateBankAccountResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.paymentSource = builder.paymentSource; + } + + /** Parse JSON response into PaymentSourceUpdateBankAccountResponse object. */ + public static PaymentSourceUpdateBankAccountResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PaymentSourceUpdateBankAccountResponse object with HTTP response. */ + public static PaymentSourceUpdateBankAccountResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); + if (__paymentSourceJson != null) { + builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse PaymentSourceUpdateBankAccountResponse from JSON", e); + } + } + + /** Create a new builder for PaymentSourceUpdateBankAccountResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PaymentSourceUpdateBankAccountResponse. */ + public static class Builder { + + private Customer customer; + + private PaymentSource paymentSource; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder paymentSource(PaymentSource paymentSource) { + this.paymentSource = paymentSource; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PaymentSourceUpdateBankAccountResponse build() { + return new PaymentSourceUpdateBankAccountResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the paymentSource from the response. */ + public PaymentSource getPaymentSource() { + return paymentSource; + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceUpdateCardResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceUpdateCardResponse.java new file mode 100644 index 00000000..1ad9fdd9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceUpdateCardResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.paymentSource.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.paymentSource.PaymentSource; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PaymentSourceUpdateCard operation. Contains the response data from + * the API. + */ +public final class PaymentSourceUpdateCardResponse extends BaseResponse { + private final Customer customer; + + private final PaymentSource paymentSource; + + private PaymentSourceUpdateCardResponse(Builder builder) { + super(builder.httpResponse); + + this.customer = builder.customer; + + this.paymentSource = builder.paymentSource; + } + + /** Parse JSON response into PaymentSourceUpdateCardResponse object. */ + public static PaymentSourceUpdateCardResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PaymentSourceUpdateCardResponse object with HTTP response. */ + public static PaymentSourceUpdateCardResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); + if (__paymentSourceJson != null) { + builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse PaymentSourceUpdateCardResponse from JSON", e); + } + } + + /** Create a new builder for PaymentSourceUpdateCardResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PaymentSourceUpdateCardResponse. */ + public static class Builder { + + private Customer customer; + + private PaymentSource paymentSource; + + private Response httpResponse; + + private Builder() {} + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder paymentSource(PaymentSource paymentSource) { + this.paymentSource = paymentSource; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PaymentSourceUpdateCardResponse build() { + return new PaymentSourceUpdateCardResponse(this); + } + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the paymentSource from the response. */ + public PaymentSource getPaymentSource() { + return paymentSource; + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceVerifyBankAccountResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceVerifyBankAccountResponse.java new file mode 100644 index 00000000..f2257402 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/paymentSource/responses/PaymentSourceVerifyBankAccountResponse.java @@ -0,0 +1,79 @@ +package com.chargebee.v4.models.paymentSource.responses; + +import com.chargebee.v4.models.paymentSource.PaymentSource; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PaymentSourceVerifyBankAccount operation. Contains the response + * data from the API. + */ +public final class PaymentSourceVerifyBankAccountResponse extends BaseResponse { + private final PaymentSource paymentSource; + + private PaymentSourceVerifyBankAccountResponse(Builder builder) { + super(builder.httpResponse); + + this.paymentSource = builder.paymentSource; + } + + /** Parse JSON response into PaymentSourceVerifyBankAccountResponse object. */ + public static PaymentSourceVerifyBankAccountResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PaymentSourceVerifyBankAccountResponse object with HTTP response. */ + public static PaymentSourceVerifyBankAccountResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); + if (__paymentSourceJson != null) { + builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse PaymentSourceVerifyBankAccountResponse from JSON", e); + } + } + + /** Create a new builder for PaymentSourceVerifyBankAccountResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PaymentSourceVerifyBankAccountResponse. */ + public static class Builder { + + private PaymentSource paymentSource; + + private Response httpResponse; + + private Builder() {} + + public Builder paymentSource(PaymentSource paymentSource) { + this.paymentSource = paymentSource; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PaymentSourceVerifyBankAccountResponse build() { + return new PaymentSourceVerifyBankAccountResponse(this); + } + } + + /** Get the paymentSource from the response. */ + public PaymentSource getPaymentSource() { + return paymentSource; + } +} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/SwitchGatewayAccountForPaymentSourceResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/SwitchGatewayAccountForPaymentSourceResponse.java deleted file mode 100644 index 000c89ac..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/responses/SwitchGatewayAccountForPaymentSourceResponse.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.chargebee.v4.models.paymentSource.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.paymentSource.PaymentSource; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for SwitchGatewayAccountForPaymentSource operation. Contains the - * response data from the API. - */ -public final class SwitchGatewayAccountForPaymentSourceResponse extends BaseResponse { - private final Customer customer; - - private final PaymentSource paymentSource; - - private SwitchGatewayAccountForPaymentSourceResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.paymentSource = builder.paymentSource; - } - - /** Parse JSON response into SwitchGatewayAccountForPaymentSourceResponse object. */ - public static SwitchGatewayAccountForPaymentSourceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into SwitchGatewayAccountForPaymentSourceResponse object with HTTP - * response. - */ - public static SwitchGatewayAccountForPaymentSourceResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); - if (__paymentSourceJson != null) { - builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse SwitchGatewayAccountForPaymentSourceResponse from JSON", e); - } - } - - /** Create a new builder for SwitchGatewayAccountForPaymentSourceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for SwitchGatewayAccountForPaymentSourceResponse. */ - public static class Builder { - - private Customer customer; - - private PaymentSource paymentSource; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder paymentSource(PaymentSource paymentSource) { - this.paymentSource = paymentSource; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public SwitchGatewayAccountForPaymentSourceResponse build() { - return new SwitchGatewayAccountForPaymentSourceResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the paymentSource from the response. */ - public PaymentSource getPaymentSource() { - return paymentSource; - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/UpdateBankAccountForPaymentSourceResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/UpdateBankAccountForPaymentSourceResponse.java deleted file mode 100644 index a3269ab4..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/responses/UpdateBankAccountForPaymentSourceResponse.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.chargebee.v4.models.paymentSource.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.paymentSource.PaymentSource; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateBankAccountForPaymentSource operation. Contains the response - * data from the API. - */ -public final class UpdateBankAccountForPaymentSourceResponse extends BaseResponse { - private final Customer customer; - - private final PaymentSource paymentSource; - - private UpdateBankAccountForPaymentSourceResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.paymentSource = builder.paymentSource; - } - - /** Parse JSON response into UpdateBankAccountForPaymentSourceResponse object. */ - public static UpdateBankAccountForPaymentSourceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into UpdateBankAccountForPaymentSourceResponse object with HTTP response. - */ - public static UpdateBankAccountForPaymentSourceResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); - if (__paymentSourceJson != null) { - builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse UpdateBankAccountForPaymentSourceResponse from JSON", e); - } - } - - /** Create a new builder for UpdateBankAccountForPaymentSourceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateBankAccountForPaymentSourceResponse. */ - public static class Builder { - - private Customer customer; - - private PaymentSource paymentSource; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder paymentSource(PaymentSource paymentSource) { - this.paymentSource = paymentSource; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateBankAccountForPaymentSourceResponse build() { - return new UpdateBankAccountForPaymentSourceResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the paymentSource from the response. */ - public PaymentSource getPaymentSource() { - return paymentSource; - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/UpdateCardForPaymentSourceResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/UpdateCardForPaymentSourceResponse.java deleted file mode 100644 index d07ad81e..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/responses/UpdateCardForPaymentSourceResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.paymentSource.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.paymentSource.PaymentSource; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateCardForPaymentSource operation. Contains the response data - * from the API. - */ -public final class UpdateCardForPaymentSourceResponse extends BaseResponse { - private final Customer customer; - - private final PaymentSource paymentSource; - - private UpdateCardForPaymentSourceResponse(Builder builder) { - super(builder.httpResponse); - - this.customer = builder.customer; - - this.paymentSource = builder.paymentSource; - } - - /** Parse JSON response into UpdateCardForPaymentSourceResponse object. */ - public static UpdateCardForPaymentSourceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdateCardForPaymentSourceResponse object with HTTP response. */ - public static UpdateCardForPaymentSourceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); - if (__paymentSourceJson != null) { - builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UpdateCardForPaymentSourceResponse from JSON", e); - } - } - - /** Create a new builder for UpdateCardForPaymentSourceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateCardForPaymentSourceResponse. */ - public static class Builder { - - private Customer customer; - - private PaymentSource paymentSource; - - private Response httpResponse; - - private Builder() {} - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder paymentSource(PaymentSource paymentSource) { - this.paymentSource = paymentSource; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateCardForPaymentSourceResponse build() { - return new UpdateCardForPaymentSourceResponse(this); - } - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the paymentSource from the response. */ - public PaymentSource getPaymentSource() { - return paymentSource; - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/responses/VerifyBankAccountForPaymentSourceResponse.java b/src/main/java/com/chargebee/v4/models/paymentSource/responses/VerifyBankAccountForPaymentSourceResponse.java deleted file mode 100644 index 47f1044c..00000000 --- a/src/main/java/com/chargebee/v4/models/paymentSource/responses/VerifyBankAccountForPaymentSourceResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.paymentSource.responses; - -import com.chargebee.v4.models.paymentSource.PaymentSource; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for VerifyBankAccountForPaymentSource operation. Contains the response - * data from the API. - */ -public final class VerifyBankAccountForPaymentSourceResponse extends BaseResponse { - private final PaymentSource paymentSource; - - private VerifyBankAccountForPaymentSourceResponse(Builder builder) { - super(builder.httpResponse); - - this.paymentSource = builder.paymentSource; - } - - /** Parse JSON response into VerifyBankAccountForPaymentSourceResponse object. */ - public static VerifyBankAccountForPaymentSourceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into VerifyBankAccountForPaymentSourceResponse object with HTTP response. - */ - public static VerifyBankAccountForPaymentSourceResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); - if (__paymentSourceJson != null) { - builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse VerifyBankAccountForPaymentSourceResponse from JSON", e); - } - } - - /** Create a new builder for VerifyBankAccountForPaymentSourceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for VerifyBankAccountForPaymentSourceResponse. */ - public static class Builder { - - private PaymentSource paymentSource; - - private Response httpResponse; - - private Builder() {} - - public Builder paymentSource(PaymentSource paymentSource) { - this.paymentSource = paymentSource; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public VerifyBankAccountForPaymentSourceResponse build() { - return new VerifyBankAccountForPaymentSourceResponse(this); - } - } - - /** Get the paymentSource from the response. */ - public PaymentSource getPaymentSource() { - return paymentSource; - } -} diff --git a/src/main/java/com/chargebee/v4/models/paymentVoucher/responses/PaymentVouchersForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/paymentVoucher/responses/PaymentVouchersForCustomerResponse.java index 89371ba1..90ee6b91 100644 --- a/src/main/java/com/chargebee/v4/models/paymentVoucher/responses/PaymentVouchersForCustomerResponse.java +++ b/src/main/java/com/chargebee/v4/models/paymentVoucher/responses/PaymentVouchersForCustomerResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.paymentVoucher.PaymentVoucher; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.PaymentVoucherService; @@ -107,9 +108,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public PaymentVouchersForCustomerResponse nextPage() throws Exception { + public PaymentVouchersForCustomerResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/paymentVoucher/responses/PaymentVouchersForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/paymentVoucher/responses/PaymentVouchersForInvoiceResponse.java index 3b741a37..09554754 100644 --- a/src/main/java/com/chargebee/v4/models/paymentVoucher/responses/PaymentVouchersForInvoiceResponse.java +++ b/src/main/java/com/chargebee/v4/models/paymentVoucher/responses/PaymentVouchersForInvoiceResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.paymentVoucher.PaymentVoucher; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.PaymentVoucherService; @@ -107,9 +108,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public PaymentVouchersForInvoiceResponse nextPage() throws Exception { + public PaymentVouchersForInvoiceResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/pc2Migration/params/ContactSupportForPc2MigrationParams.java b/src/main/java/com/chargebee/v4/models/pc2Migration/params/ContactSupportForPc2MigrationParams.java deleted file mode 100644 index f9cb76ba..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2Migration/params/ContactSupportForPc2MigrationParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.pc2Migration.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ContactSupportForPc2MigrationParams { - - private ContactSupportForPc2MigrationParams(ContactSupportForPc2MigrationBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for ContactSupportForPc2MigrationParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContactSupportForPc2MigrationBuilder builder() { - return new ContactSupportForPc2MigrationBuilder(); - } - - public static final class ContactSupportForPc2MigrationBuilder { - - private ContactSupportForPc2MigrationBuilder() {} - - public ContactSupportForPc2MigrationParams build() { - return new ContactSupportForPc2MigrationParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2Migration/params/InitiateForPc2MigrationParams.java b/src/main/java/com/chargebee/v4/models/pc2Migration/params/InitiateForPc2MigrationParams.java deleted file mode 100644 index 6c2b7675..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2Migration/params/InitiateForPc2MigrationParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.pc2Migration.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class InitiateForPc2MigrationParams { - - private InitiateForPc2MigrationParams(InitiateForPc2MigrationBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for InitiateForPc2MigrationParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static InitiateForPc2MigrationBuilder builder() { - return new InitiateForPc2MigrationBuilder(); - } - - public static final class InitiateForPc2MigrationBuilder { - - private InitiateForPc2MigrationBuilder() {} - - public InitiateForPc2MigrationParams build() { - return new InitiateForPc2MigrationParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2Migration/params/Pc2MigrationContactSupportParams.java b/src/main/java/com/chargebee/v4/models/pc2Migration/params/Pc2MigrationContactSupportParams.java new file mode 100644 index 00000000..665e6e94 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2Migration/params/Pc2MigrationContactSupportParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.pc2Migration.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class Pc2MigrationContactSupportParams { + + private Pc2MigrationContactSupportParams(Pc2MigrationContactSupportBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for Pc2MigrationContactSupportParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static Pc2MigrationContactSupportBuilder builder() { + return new Pc2MigrationContactSupportBuilder(); + } + + public static final class Pc2MigrationContactSupportBuilder { + + private Pc2MigrationContactSupportBuilder() {} + + public Pc2MigrationContactSupportParams build() { + return new Pc2MigrationContactSupportParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2Migration/params/Pc2MigrationInitiateParams.java b/src/main/java/com/chargebee/v4/models/pc2Migration/params/Pc2MigrationInitiateParams.java new file mode 100644 index 00000000..dcd2ca04 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2Migration/params/Pc2MigrationInitiateParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.pc2Migration.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class Pc2MigrationInitiateParams { + + private Pc2MigrationInitiateParams(Pc2MigrationInitiateBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for Pc2MigrationInitiateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static Pc2MigrationInitiateBuilder builder() { + return new Pc2MigrationInitiateBuilder(); + } + + public static final class Pc2MigrationInitiateBuilder { + + private Pc2MigrationInitiateBuilder() {} + + public Pc2MigrationInitiateParams build() { + return new Pc2MigrationInitiateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2Migration/responses/ContactSupportForPc2MigrationResponse.java b/src/main/java/com/chargebee/v4/models/pc2Migration/responses/ContactSupportForPc2MigrationResponse.java deleted file mode 100644 index 054f3bac..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2Migration/responses/ContactSupportForPc2MigrationResponse.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.chargebee.v4.models.pc2Migration.responses; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ContactSupportForPc2Migration operation. Contains the response data - * from the API. - */ -public final class ContactSupportForPc2MigrationResponse extends BaseResponse { - - private ContactSupportForPc2MigrationResponse(Builder builder) { - super(builder.httpResponse); - } - - /** Parse JSON response into ContactSupportForPc2MigrationResponse object. */ - public static ContactSupportForPc2MigrationResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ContactSupportForPc2MigrationResponse object with HTTP response. */ - public static ContactSupportForPc2MigrationResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ContactSupportForPc2MigrationResponse from JSON", e); - } - } - - /** Create a new builder for ContactSupportForPc2MigrationResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ContactSupportForPc2MigrationResponse. */ - public static class Builder { - - private Response httpResponse; - - private Builder() {} - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ContactSupportForPc2MigrationResponse build() { - return new ContactSupportForPc2MigrationResponse(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2Migration/responses/InitiateForPc2MigrationResponse.java b/src/main/java/com/chargebee/v4/models/pc2Migration/responses/InitiateForPc2MigrationResponse.java deleted file mode 100644 index 7b44bde8..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2Migration/responses/InitiateForPc2MigrationResponse.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.chargebee.v4.models.pc2Migration.responses; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for InitiateForPc2Migration operation. Contains the response data from - * the API. - */ -public final class InitiateForPc2MigrationResponse extends BaseResponse { - - private InitiateForPc2MigrationResponse(Builder builder) { - super(builder.httpResponse); - } - - /** Parse JSON response into InitiateForPc2MigrationResponse object. */ - public static InitiateForPc2MigrationResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into InitiateForPc2MigrationResponse object with HTTP response. */ - public static InitiateForPc2MigrationResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse InitiateForPc2MigrationResponse from JSON", e); - } - } - - /** Create a new builder for InitiateForPc2MigrationResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for InitiateForPc2MigrationResponse. */ - public static class Builder { - - private Response httpResponse; - - private Builder() {} - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public InitiateForPc2MigrationResponse build() { - return new InitiateForPc2MigrationResponse(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2Migration/responses/Pc2MigrationContactSupportResponse.java b/src/main/java/com/chargebee/v4/models/pc2Migration/responses/Pc2MigrationContactSupportResponse.java new file mode 100644 index 00000000..5ee55101 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2Migration/responses/Pc2MigrationContactSupportResponse.java @@ -0,0 +1,54 @@ +package com.chargebee.v4.models.pc2Migration.responses; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for Pc2MigrationContactSupport operation. Contains the response data + * from the API. + */ +public final class Pc2MigrationContactSupportResponse extends BaseResponse { + + private Pc2MigrationContactSupportResponse(Builder builder) { + super(builder.httpResponse); + } + + /** Parse JSON response into Pc2MigrationContactSupportResponse object. */ + public static Pc2MigrationContactSupportResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into Pc2MigrationContactSupportResponse object with HTTP response. */ + public static Pc2MigrationContactSupportResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse Pc2MigrationContactSupportResponse from JSON", e); + } + } + + /** Create a new builder for Pc2MigrationContactSupportResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for Pc2MigrationContactSupportResponse. */ + public static class Builder { + + private Response httpResponse; + + private Builder() {} + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public Pc2MigrationContactSupportResponse build() { + return new Pc2MigrationContactSupportResponse(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2Migration/responses/Pc2MigrationInitiateResponse.java b/src/main/java/com/chargebee/v4/models/pc2Migration/responses/Pc2MigrationInitiateResponse.java new file mode 100644 index 00000000..af777160 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2Migration/responses/Pc2MigrationInitiateResponse.java @@ -0,0 +1,54 @@ +package com.chargebee.v4.models.pc2Migration.responses; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for Pc2MigrationInitiate operation. Contains the response data from the + * API. + */ +public final class Pc2MigrationInitiateResponse extends BaseResponse { + + private Pc2MigrationInitiateResponse(Builder builder) { + super(builder.httpResponse); + } + + /** Parse JSON response into Pc2MigrationInitiateResponse object. */ + public static Pc2MigrationInitiateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into Pc2MigrationInitiateResponse object with HTTP response. */ + public static Pc2MigrationInitiateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse Pc2MigrationInitiateResponse from JSON", e); + } + } + + /** Create a new builder for Pc2MigrationInitiateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for Pc2MigrationInitiateResponse. */ + public static class Builder { + + private Response httpResponse; + + private Builder() {} + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public Pc2MigrationInitiateResponse build() { + return new Pc2MigrationInitiateResponse(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/DeletePc2MigrationItemParams.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/DeletePc2MigrationItemParams.java deleted file mode 100644 index e9785732..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/DeletePc2MigrationItemParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.pc2MigrationItem.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeletePc2MigrationItemParams { - - private DeletePc2MigrationItemParams(DeletePc2MigrationItemBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeletePc2MigrationItemParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeletePc2MigrationItemBuilder builder() { - return new DeletePc2MigrationItemBuilder(); - } - - public static final class DeletePc2MigrationItemBuilder { - - private DeletePc2MigrationItemBuilder() {} - - public DeletePc2MigrationItemParams build() { - return new DeletePc2MigrationItemParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/Pc2MigrationItemDeleteParams.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/Pc2MigrationItemDeleteParams.java new file mode 100644 index 00000000..bc9fc58f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/Pc2MigrationItemDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.pc2MigrationItem.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class Pc2MigrationItemDeleteParams { + + private Pc2MigrationItemDeleteParams(Pc2MigrationItemDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for Pc2MigrationItemDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static Pc2MigrationItemDeleteBuilder builder() { + return new Pc2MigrationItemDeleteBuilder(); + } + + public static final class Pc2MigrationItemDeleteBuilder { + + private Pc2MigrationItemDeleteBuilder() {} + + public Pc2MigrationItemDeleteParams build() { + return new Pc2MigrationItemDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/Pc2MigrationItemListApplicableAddonsParams.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/Pc2MigrationItemListApplicableAddonsParams.java new file mode 100644 index 00000000..ca86e143 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/Pc2MigrationItemListApplicableAddonsParams.java @@ -0,0 +1,109 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.pc2MigrationItem.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class Pc2MigrationItemListApplicableAddonsParams { + + private final Map queryParams; + + private Pc2MigrationItemListApplicableAddonsParams( + Pc2MigrationItemListApplicableAddonsBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public Pc2MigrationItemListApplicableAddonsBuilder toBuilder() { + Pc2MigrationItemListApplicableAddonsBuilder builder = + new Pc2MigrationItemListApplicableAddonsBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for Pc2MigrationItemListApplicableAddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static Pc2MigrationItemListApplicableAddonsBuilder builder() { + return new Pc2MigrationItemListApplicableAddonsBuilder(); + } + + public static final class Pc2MigrationItemListApplicableAddonsBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private Pc2MigrationItemListApplicableAddonsBuilder() {} + + public Pc2MigrationItemListApplicableAddonsBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public Pc2MigrationItemListApplicableAddonsBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + public IsRecurringFilter isRecurring() { + return new IsRecurringFilter("is_recurring", this); + } + + public Pc2MigrationItemListApplicableAddonsParams build() { + return new Pc2MigrationItemListApplicableAddonsParams(this); + } + + public static final class IsRecurringFilter { + private final String fieldName; + private final Pc2MigrationItemListApplicableAddonsBuilder builder; + + IsRecurringFilter(String fieldName, Pc2MigrationItemListApplicableAddonsBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public Pc2MigrationItemListApplicableAddonsBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + } + } + + public enum IsRecurringIs { + TRUE("true"), + + FALSE("false"), + + /** An enum member indicating that IsRecurringIs was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + IsRecurringIs(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static IsRecurringIs fromString(String value) { + if (value == null) return _UNKNOWN; + for (IsRecurringIs enumValue : IsRecurringIs.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/Pc2MigrationItemListApplicableItemsParams.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/Pc2MigrationItemListApplicableItemsParams.java deleted file mode 100644 index 84d331ad..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/params/Pc2MigrationItemListApplicableItemsParams.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.pc2MigrationItem.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class Pc2MigrationItemListApplicableItemsParams { - - private final Map queryParams; - - private Pc2MigrationItemListApplicableItemsParams( - Pc2MigrationItemListApplicableItemsBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public Pc2MigrationItemListApplicableItemsBuilder toBuilder() { - Pc2MigrationItemListApplicableItemsBuilder builder = - new Pc2MigrationItemListApplicableItemsBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for Pc2MigrationItemListApplicableItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static Pc2MigrationItemListApplicableItemsBuilder builder() { - return new Pc2MigrationItemListApplicableItemsBuilder(); - } - - public static final class Pc2MigrationItemListApplicableItemsBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private Pc2MigrationItemListApplicableItemsBuilder() {} - - public Pc2MigrationItemListApplicableItemsBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public Pc2MigrationItemListApplicableItemsBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - public IsRecurringFilter isRecurring() { - return new IsRecurringFilter("is_recurring", this); - } - - public Pc2MigrationItemListApplicableItemsParams build() { - return new Pc2MigrationItemListApplicableItemsParams(this); - } - - public static final class IsRecurringFilter { - private final String fieldName; - private final Pc2MigrationItemListApplicableItemsBuilder builder; - - IsRecurringFilter(String fieldName, Pc2MigrationItemListApplicableItemsBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public Pc2MigrationItemListApplicableItemsBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - } - } - - public enum IsRecurringIs { - TRUE("true"), - - FALSE("false"), - - /** An enum member indicating that IsRecurringIs was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - IsRecurringIs(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static IsRecurringIs fromString(String value) { - if (value == null) return _UNKNOWN; - for (IsRecurringIs enumValue : IsRecurringIs.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/DeletePc2MigrationItemResponse.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/DeletePc2MigrationItemResponse.java deleted file mode 100644 index 4674a0b5..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/DeletePc2MigrationItemResponse.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.chargebee.v4.models.pc2MigrationItem.responses; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeletePc2MigrationItem operation. Contains the response data from - * the API. - */ -public final class DeletePc2MigrationItemResponse extends BaseResponse { - private final Boolean isDeleted; - - private DeletePc2MigrationItemResponse(Builder builder) { - super(builder.httpResponse); - - this.isDeleted = builder.isDeleted; - } - - /** Parse JSON response into DeletePc2MigrationItemResponse object. */ - public static DeletePc2MigrationItemResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeletePc2MigrationItemResponse object with HTTP response. */ - public static DeletePc2MigrationItemResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.isDeleted(JsonUtil.getBoolean(json, "is_deleted")); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeletePc2MigrationItemResponse from JSON", e); - } - } - - /** Create a new builder for DeletePc2MigrationItemResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeletePc2MigrationItemResponse. */ - public static class Builder { - - private Boolean isDeleted; - - private Response httpResponse; - - private Builder() {} - - public Builder isDeleted(Boolean isDeleted) { - this.isDeleted = isDeleted; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeletePc2MigrationItemResponse build() { - return new DeletePc2MigrationItemResponse(this); - } - } - - /** Get the isDeleted from the response. */ - public Boolean getIsDeleted() { - return isDeleted; - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemDeleteResponse.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemDeleteResponse.java new file mode 100644 index 00000000..c0aa3803 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemDeleteResponse.java @@ -0,0 +1,72 @@ +package com.chargebee.v4.models.pc2MigrationItem.responses; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for Pc2MigrationItemDelete operation. Contains the response data from + * the API. + */ +public final class Pc2MigrationItemDeleteResponse extends BaseResponse { + private final Boolean isDeleted; + + private Pc2MigrationItemDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.isDeleted = builder.isDeleted; + } + + /** Parse JSON response into Pc2MigrationItemDeleteResponse object. */ + public static Pc2MigrationItemDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into Pc2MigrationItemDeleteResponse object with HTTP response. */ + public static Pc2MigrationItemDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.isDeleted(JsonUtil.getBoolean(json, "is_deleted")); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse Pc2MigrationItemDeleteResponse from JSON", e); + } + } + + /** Create a new builder for Pc2MigrationItemDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for Pc2MigrationItemDeleteResponse. */ + public static class Builder { + + private Boolean isDeleted; + + private Response httpResponse; + + private Builder() {} + + public Builder isDeleted(Boolean isDeleted) { + this.isDeleted = isDeleted; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public Pc2MigrationItemDeleteResponse build() { + return new Pc2MigrationItemDeleteResponse(this); + } + } + + /** Get the isDeleted from the response. */ + public Boolean getIsDeleted() { + return isDeleted; + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemListApplicableAddonsResponse.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemListApplicableAddonsResponse.java new file mode 100644 index 00000000..62df4ac7 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemListApplicableAddonsResponse.java @@ -0,0 +1,151 @@ +package com.chargebee.v4.models.pc2MigrationItem.responses; + +import java.util.List; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.Pc2MigrationItemService; +import com.chargebee.v4.models.pc2MigrationItem.params.Pc2MigrationItemListApplicableAddonsParams; + +/** + * Immutable response object for Pc2MigrationItemListApplicableAddons operation. Contains paginated + * list data. + */ +public final class Pc2MigrationItemListApplicableAddonsResponse { + + private final List> list; + + private final String nextOffset; + + private final Pc2MigrationItemService service; + private final Pc2MigrationItemListApplicableAddonsParams originalParams; + private final Response httpResponse; + + private Pc2MigrationItemListApplicableAddonsResponse( + List> list, + String nextOffset, + Pc2MigrationItemService service, + Pc2MigrationItemListApplicableAddonsParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into Pc2MigrationItemListApplicableAddonsResponse object (no service + * context). Use this when you only need to read a single page (no nextPage()). + */ + public static Pc2MigrationItemListApplicableAddonsResponse fromJson(String json) { + try { + + List> list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(JsonUtil::parseJsonObjectToMap) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new Pc2MigrationItemListApplicableAddonsResponse(list, nextOffset, null, null, null); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse Pc2MigrationItemListApplicableAddonsResponse from JSON", e); + } + } + + /** + * Parse JSON response into Pc2MigrationItemListApplicableAddonsResponse object with service + * context for pagination (enables nextPage()). + */ + public static Pc2MigrationItemListApplicableAddonsResponse fromJson( + String json, + Pc2MigrationItemService service, + Pc2MigrationItemListApplicableAddonsParams originalParams, + Response httpResponse) { + try { + + List> list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(JsonUtil::parseJsonObjectToMap) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new Pc2MigrationItemListApplicableAddonsResponse( + list, nextOffset, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse Pc2MigrationItemListApplicableAddonsResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List> getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public Pc2MigrationItemListApplicableAddonsResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + Pc2MigrationItemListApplicableAddonsParams nextParams = + (originalParams != null + ? originalParams.toBuilder() + : Pc2MigrationItemListApplicableAddonsParams.builder()) + .offset(nextOffset) + .build(); + + return service.listApplicableAddons(nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemListApplicableItemsResponse.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemListApplicableItemsResponse.java deleted file mode 100644 index 03af3a45..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemListApplicableItemsResponse.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.chargebee.v4.models.pc2MigrationItem.responses; - -import java.util.List; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.Pc2MigrationItemService; -import com.chargebee.v4.models.pc2MigrationItem.params.Pc2MigrationItemListApplicableItemsParams; - -/** - * Immutable response object for Pc2MigrationItemListApplicableItems operation. Contains paginated - * list data. - */ -public final class Pc2MigrationItemListApplicableItemsResponse { - - private final List> list; - - private final String nextOffset; - - private final Pc2MigrationItemService service; - private final Pc2MigrationItemListApplicableItemsParams originalParams; - private final Response httpResponse; - - private Pc2MigrationItemListApplicableItemsResponse( - List> list, - String nextOffset, - Pc2MigrationItemService service, - Pc2MigrationItemListApplicableItemsParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into Pc2MigrationItemListApplicableItemsResponse object (no service - * context). Use this when you only need to read a single page (no nextPage()). - */ - public static Pc2MigrationItemListApplicableItemsResponse fromJson(String json) { - try { - - List> list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(JsonUtil::parseJsonObjectToMap) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new Pc2MigrationItemListApplicableItemsResponse(list, nextOffset, null, null, null); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse Pc2MigrationItemListApplicableItemsResponse from JSON", e); - } - } - - /** - * Parse JSON response into Pc2MigrationItemListApplicableItemsResponse object with service - * context for pagination (enables nextPage()). - */ - public static Pc2MigrationItemListApplicableItemsResponse fromJson( - String json, - Pc2MigrationItemService service, - Pc2MigrationItemListApplicableItemsParams originalParams, - Response httpResponse) { - try { - - List> list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(JsonUtil::parseJsonObjectToMap) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new Pc2MigrationItemListApplicableItemsResponse( - list, nextOffset, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse Pc2MigrationItemListApplicableItemsResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List> getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public Pc2MigrationItemListApplicableItemsResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - Pc2MigrationItemListApplicableItemsParams nextParams = - (originalParams != null - ? originalParams.toBuilder() - : Pc2MigrationItemListApplicableItemsParams.builder()) - .offset(nextOffset) - .build(); - - return service.listApplicableItems(nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemListResponse.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemListResponse.java index 4ea51812..0df83f65 100644 --- a/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemListResponse.java +++ b/src/main/java/com/chargebee/v4/models/pc2MigrationItem/responses/Pc2MigrationItemListResponse.java @@ -2,6 +2,7 @@ import java.util.List; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.Pc2MigrationItemService; @@ -97,9 +98,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public Pc2MigrationItemListResponse nextPage() throws Exception { + public Pc2MigrationItemListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/params/DeletePc2MigrationItemFamilyParams.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/params/DeletePc2MigrationItemFamilyParams.java deleted file mode 100644 index 1a3dbd0e..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/params/DeletePc2MigrationItemFamilyParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.pc2MigrationItemFamily.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeletePc2MigrationItemFamilyParams { - - private DeletePc2MigrationItemFamilyParams(DeletePc2MigrationItemFamilyBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeletePc2MigrationItemFamilyParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeletePc2MigrationItemFamilyBuilder builder() { - return new DeletePc2MigrationItemFamilyBuilder(); - } - - public static final class DeletePc2MigrationItemFamilyBuilder { - - private DeletePc2MigrationItemFamilyBuilder() {} - - public DeletePc2MigrationItemFamilyParams build() { - return new DeletePc2MigrationItemFamilyParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/params/Pc2MigrationItemFamilyDeleteParams.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/params/Pc2MigrationItemFamilyDeleteParams.java new file mode 100644 index 00000000..aed845d0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/params/Pc2MigrationItemFamilyDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.pc2MigrationItemFamily.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class Pc2MigrationItemFamilyDeleteParams { + + private Pc2MigrationItemFamilyDeleteParams(Pc2MigrationItemFamilyDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for Pc2MigrationItemFamilyDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static Pc2MigrationItemFamilyDeleteBuilder builder() { + return new Pc2MigrationItemFamilyDeleteBuilder(); + } + + public static final class Pc2MigrationItemFamilyDeleteBuilder { + + private Pc2MigrationItemFamilyDeleteBuilder() {} + + public Pc2MigrationItemFamilyDeleteParams build() { + return new Pc2MigrationItemFamilyDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/responses/DeletePc2MigrationItemFamilyResponse.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/responses/DeletePc2MigrationItemFamilyResponse.java deleted file mode 100644 index 3adea8af..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/responses/DeletePc2MigrationItemFamilyResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.chargebee.v4.models.pc2MigrationItemFamily.responses; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeletePc2MigrationItemFamily operation. Contains the response data - * from the API. - */ -public final class DeletePc2MigrationItemFamilyResponse extends BaseResponse { - private final Boolean isDeleted; - - private DeletePc2MigrationItemFamilyResponse(Builder builder) { - super(builder.httpResponse); - - this.isDeleted = builder.isDeleted; - } - - /** Parse JSON response into DeletePc2MigrationItemFamilyResponse object. */ - public static DeletePc2MigrationItemFamilyResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeletePc2MigrationItemFamilyResponse object with HTTP response. */ - public static DeletePc2MigrationItemFamilyResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.isDeleted(JsonUtil.getBoolean(json, "is_deleted")); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse DeletePc2MigrationItemFamilyResponse from JSON", e); - } - } - - /** Create a new builder for DeletePc2MigrationItemFamilyResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeletePc2MigrationItemFamilyResponse. */ - public static class Builder { - - private Boolean isDeleted; - - private Response httpResponse; - - private Builder() {} - - public Builder isDeleted(Boolean isDeleted) { - this.isDeleted = isDeleted; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeletePc2MigrationItemFamilyResponse build() { - return new DeletePc2MigrationItemFamilyResponse(this); - } - } - - /** Get the isDeleted from the response. */ - public Boolean getIsDeleted() { - return isDeleted; - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/responses/Pc2MigrationItemFamilyDeleteResponse.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/responses/Pc2MigrationItemFamilyDeleteResponse.java new file mode 100644 index 00000000..7153f26e --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/responses/Pc2MigrationItemFamilyDeleteResponse.java @@ -0,0 +1,73 @@ +package com.chargebee.v4.models.pc2MigrationItemFamily.responses; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for Pc2MigrationItemFamilyDelete operation. Contains the response data + * from the API. + */ +public final class Pc2MigrationItemFamilyDeleteResponse extends BaseResponse { + private final Boolean isDeleted; + + private Pc2MigrationItemFamilyDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.isDeleted = builder.isDeleted; + } + + /** Parse JSON response into Pc2MigrationItemFamilyDeleteResponse object. */ + public static Pc2MigrationItemFamilyDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into Pc2MigrationItemFamilyDeleteResponse object with HTTP response. */ + public static Pc2MigrationItemFamilyDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.isDeleted(JsonUtil.getBoolean(json, "is_deleted")); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse Pc2MigrationItemFamilyDeleteResponse from JSON", e); + } + } + + /** Create a new builder for Pc2MigrationItemFamilyDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for Pc2MigrationItemFamilyDeleteResponse. */ + public static class Builder { + + private Boolean isDeleted; + + private Response httpResponse; + + private Builder() {} + + public Builder isDeleted(Boolean isDeleted) { + this.isDeleted = isDeleted; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public Pc2MigrationItemFamilyDeleteResponse build() { + return new Pc2MigrationItemFamilyDeleteResponse(this); + } + } + + /** Get the isDeleted from the response. */ + public Boolean getIsDeleted() { + return isDeleted; + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/responses/Pc2MigrationItemFamilyListResponse.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/responses/Pc2MigrationItemFamilyListResponse.java index 50188ac1..1f9fe18c 100644 --- a/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/responses/Pc2MigrationItemFamilyListResponse.java +++ b/src/main/java/com/chargebee/v4/models/pc2MigrationItemFamily/responses/Pc2MigrationItemFamilyListResponse.java @@ -2,6 +2,7 @@ import java.util.List; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.Pc2MigrationItemFamilyService; @@ -99,9 +100,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public Pc2MigrationItemFamilyListResponse nextPage() throws Exception { + public Pc2MigrationItemFamilyListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/params/DeletePc2MigrationItemPriceParams.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/params/DeletePc2MigrationItemPriceParams.java deleted file mode 100644 index 959ced20..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/params/DeletePc2MigrationItemPriceParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.pc2MigrationItemPrice.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeletePc2MigrationItemPriceParams { - - private DeletePc2MigrationItemPriceParams(DeletePc2MigrationItemPriceBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeletePc2MigrationItemPriceParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeletePc2MigrationItemPriceBuilder builder() { - return new DeletePc2MigrationItemPriceBuilder(); - } - - public static final class DeletePc2MigrationItemPriceBuilder { - - private DeletePc2MigrationItemPriceBuilder() {} - - public DeletePc2MigrationItemPriceParams build() { - return new DeletePc2MigrationItemPriceParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/params/Pc2MigrationItemPriceDeleteParams.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/params/Pc2MigrationItemPriceDeleteParams.java new file mode 100644 index 00000000..a072d92f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/params/Pc2MigrationItemPriceDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.pc2MigrationItemPrice.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class Pc2MigrationItemPriceDeleteParams { + + private Pc2MigrationItemPriceDeleteParams(Pc2MigrationItemPriceDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for Pc2MigrationItemPriceDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static Pc2MigrationItemPriceDeleteBuilder builder() { + return new Pc2MigrationItemPriceDeleteBuilder(); + } + + public static final class Pc2MigrationItemPriceDeleteBuilder { + + private Pc2MigrationItemPriceDeleteBuilder() {} + + public Pc2MigrationItemPriceDeleteParams build() { + return new Pc2MigrationItemPriceDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/responses/DeletePc2MigrationItemPriceResponse.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/responses/DeletePc2MigrationItemPriceResponse.java deleted file mode 100644 index 739eb22b..00000000 --- a/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/responses/DeletePc2MigrationItemPriceResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.chargebee.v4.models.pc2MigrationItemPrice.responses; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeletePc2MigrationItemPrice operation. Contains the response data - * from the API. - */ -public final class DeletePc2MigrationItemPriceResponse extends BaseResponse { - private final Boolean isDeleted; - - private DeletePc2MigrationItemPriceResponse(Builder builder) { - super(builder.httpResponse); - - this.isDeleted = builder.isDeleted; - } - - /** Parse JSON response into DeletePc2MigrationItemPriceResponse object. */ - public static DeletePc2MigrationItemPriceResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeletePc2MigrationItemPriceResponse object with HTTP response. */ - public static DeletePc2MigrationItemPriceResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.isDeleted(JsonUtil.getBoolean(json, "is_deleted")); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse DeletePc2MigrationItemPriceResponse from JSON", e); - } - } - - /** Create a new builder for DeletePc2MigrationItemPriceResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeletePc2MigrationItemPriceResponse. */ - public static class Builder { - - private Boolean isDeleted; - - private Response httpResponse; - - private Builder() {} - - public Builder isDeleted(Boolean isDeleted) { - this.isDeleted = isDeleted; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeletePc2MigrationItemPriceResponse build() { - return new DeletePc2MigrationItemPriceResponse(this); - } - } - - /** Get the isDeleted from the response. */ - public Boolean getIsDeleted() { - return isDeleted; - } -} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/responses/Pc2MigrationItemPriceDeleteResponse.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/responses/Pc2MigrationItemPriceDeleteResponse.java new file mode 100644 index 00000000..4f9bec27 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/responses/Pc2MigrationItemPriceDeleteResponse.java @@ -0,0 +1,73 @@ +package com.chargebee.v4.models.pc2MigrationItemPrice.responses; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for Pc2MigrationItemPriceDelete operation. Contains the response data + * from the API. + */ +public final class Pc2MigrationItemPriceDeleteResponse extends BaseResponse { + private final Boolean isDeleted; + + private Pc2MigrationItemPriceDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.isDeleted = builder.isDeleted; + } + + /** Parse JSON response into Pc2MigrationItemPriceDeleteResponse object. */ + public static Pc2MigrationItemPriceDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into Pc2MigrationItemPriceDeleteResponse object with HTTP response. */ + public static Pc2MigrationItemPriceDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.isDeleted(JsonUtil.getBoolean(json, "is_deleted")); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse Pc2MigrationItemPriceDeleteResponse from JSON", e); + } + } + + /** Create a new builder for Pc2MigrationItemPriceDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for Pc2MigrationItemPriceDeleteResponse. */ + public static class Builder { + + private Boolean isDeleted; + + private Response httpResponse; + + private Builder() {} + + public Builder isDeleted(Boolean isDeleted) { + this.isDeleted = isDeleted; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public Pc2MigrationItemPriceDeleteResponse build() { + return new Pc2MigrationItemPriceDeleteResponse(this); + } + } + + /** Get the isDeleted from the response. */ + public Boolean getIsDeleted() { + return isDeleted; + } +} diff --git a/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/responses/Pc2MigrationItemPriceListResponse.java b/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/responses/Pc2MigrationItemPriceListResponse.java index e3203b40..58fbc675 100644 --- a/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/responses/Pc2MigrationItemPriceListResponse.java +++ b/src/main/java/com/chargebee/v4/models/pc2MigrationItemPrice/responses/Pc2MigrationItemPriceListResponse.java @@ -2,6 +2,7 @@ import java.util.List; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.Pc2MigrationItemPriceService; @@ -99,9 +100,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public Pc2MigrationItemPriceListResponse nextPage() throws Exception { + public Pc2MigrationItemPriceListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/personalizedOffer/params/PersonalizedOfferCreateParams.java b/src/main/java/com/chargebee/v4/models/personalizedOffer/params/PersonalizedOfferCreateParams.java deleted file mode 100644 index 5a944361..00000000 --- a/src/main/java/com/chargebee/v4/models/personalizedOffer/params/PersonalizedOfferCreateParams.java +++ /dev/null @@ -1,355 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.personalizedOffer.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class PersonalizedOfferCreateParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final List roles; - - private final String externalUserId; - - private final String subscriptionId; - - private final String customerId; - - private final java.util.Map custom; - - private final RequestContextParams requestContext; - - private PersonalizedOfferCreateParams(PersonalizedOfferCreateBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.roles = builder.roles; - - this.externalUserId = builder.externalUserId; - - this.subscriptionId = builder.subscriptionId; - - this.customerId = builder.customerId; - - this.custom = builder.custom; - - this.requestContext = builder.requestContext; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public List getRoles() { - return roles; - } - - public String getExternalUserId() { - return externalUserId; - } - - public String getSubscriptionId() { - return subscriptionId; - } - - public String getCustomerId() { - return customerId; - } - - public java.util.Map getCustom() { - return custom; - } - - public RequestContextParams getRequestContext() { - return requestContext; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.roles != null) { - - formData.put("roles", this.roles); - } - - if (this.externalUserId != null) { - - formData.put("external_user_id", this.externalUserId); - } - - if (this.subscriptionId != null) { - - formData.put("subscription_id", this.subscriptionId); - } - - if (this.customerId != null) { - - formData.put("customer_id", this.customerId); - } - - if (this.custom != null) { - - formData.put("custom", JsonUtil.toJson(this.custom)); - } - - if (this.requestContext != null) { - - // Single object - Map nestedData = this.requestContext.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "request_context[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for PersonalizedOfferCreateParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PersonalizedOfferCreateBuilder builder() { - return new PersonalizedOfferCreateBuilder(); - } - - public static final class PersonalizedOfferCreateBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private List roles; - - private String externalUserId; - - private String subscriptionId; - - private String customerId; - - private java.util.Map custom; - - private RequestContextParams requestContext; - - private PersonalizedOfferCreateBuilder() {} - - public PersonalizedOfferCreateBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public PersonalizedOfferCreateBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public PersonalizedOfferCreateBuilder email(String value) { - this.email = value; - return this; - } - - public PersonalizedOfferCreateBuilder roles(List value) { - this.roles = value; - return this; - } - - public PersonalizedOfferCreateBuilder externalUserId(String value) { - this.externalUserId = value; - return this; - } - - public PersonalizedOfferCreateBuilder subscriptionId(String value) { - this.subscriptionId = value; - return this; - } - - public PersonalizedOfferCreateBuilder customerId(String value) { - this.customerId = value; - return this; - } - - public PersonalizedOfferCreateBuilder custom(java.util.Map value) { - this.custom = value; - return this; - } - - public PersonalizedOfferCreateBuilder requestContext(RequestContextParams value) { - this.requestContext = value; - return this; - } - - public PersonalizedOfferCreateParams build() { - return new PersonalizedOfferCreateParams(this); - } - } - - public static final class RequestContextParams { - - private final String userAgent; - - private final String locale; - - private final String timezone; - - private final String url; - - private final String referrerUrl; - - private RequestContextParams(RequestContextBuilder builder) { - - this.userAgent = builder.userAgent; - - this.locale = builder.locale; - - this.timezone = builder.timezone; - - this.url = builder.url; - - this.referrerUrl = builder.referrerUrl; - } - - public String getUserAgent() { - return userAgent; - } - - public String getLocale() { - return locale; - } - - public String getTimezone() { - return timezone; - } - - public String getUrl() { - return url; - } - - public String getReferrerUrl() { - return referrerUrl; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.userAgent != null) { - - formData.put("user_agent", this.userAgent); - } - - if (this.locale != null) { - - formData.put("locale", this.locale); - } - - if (this.timezone != null) { - - formData.put("timezone", this.timezone); - } - - if (this.url != null) { - - formData.put("url", this.url); - } - - if (this.referrerUrl != null) { - - formData.put("referrer_url", this.referrerUrl); - } - - return formData; - } - - /** Create a new builder for RequestContextParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RequestContextBuilder builder() { - return new RequestContextBuilder(); - } - - public static final class RequestContextBuilder { - - private String userAgent; - - private String locale; - - private String timezone; - - private String url; - - private String referrerUrl; - - private RequestContextBuilder() {} - - public RequestContextBuilder userAgent(String value) { - this.userAgent = value; - return this; - } - - public RequestContextBuilder locale(String value) { - this.locale = value; - return this; - } - - public RequestContextBuilder timezone(String value) { - this.timezone = value; - return this; - } - - public RequestContextBuilder url(String value) { - this.url = value; - return this; - } - - public RequestContextBuilder referrerUrl(String value) { - this.referrerUrl = value; - return this; - } - - public RequestContextParams build() { - return new RequestContextParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/personalizedOffer/params/PersonalizedOffersParams.java b/src/main/java/com/chargebee/v4/models/personalizedOffer/params/PersonalizedOffersParams.java new file mode 100644 index 00000000..cba1109a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/personalizedOffer/params/PersonalizedOffersParams.java @@ -0,0 +1,355 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.personalizedOffer.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class PersonalizedOffersParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final List roles; + + private final String externalUserId; + + private final String subscriptionId; + + private final String customerId; + + private final java.util.Map custom; + + private final RequestContextParams requestContext; + + private PersonalizedOffersParams(PersonalizedOffersBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.roles = builder.roles; + + this.externalUserId = builder.externalUserId; + + this.subscriptionId = builder.subscriptionId; + + this.customerId = builder.customerId; + + this.custom = builder.custom; + + this.requestContext = builder.requestContext; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public List getRoles() { + return roles; + } + + public String getExternalUserId() { + return externalUserId; + } + + public String getSubscriptionId() { + return subscriptionId; + } + + public String getCustomerId() { + return customerId; + } + + public java.util.Map getCustom() { + return custom; + } + + public RequestContextParams getRequestContext() { + return requestContext; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.roles != null) { + + formData.put("roles", this.roles); + } + + if (this.externalUserId != null) { + + formData.put("external_user_id", this.externalUserId); + } + + if (this.subscriptionId != null) { + + formData.put("subscription_id", this.subscriptionId); + } + + if (this.customerId != null) { + + formData.put("customer_id", this.customerId); + } + + if (this.custom != null) { + + formData.put("custom", JsonUtil.toJson(this.custom)); + } + + if (this.requestContext != null) { + + // Single object + Map nestedData = this.requestContext.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "request_context[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for PersonalizedOffersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PersonalizedOffersBuilder builder() { + return new PersonalizedOffersBuilder(); + } + + public static final class PersonalizedOffersBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private List roles; + + private String externalUserId; + + private String subscriptionId; + + private String customerId; + + private java.util.Map custom; + + private RequestContextParams requestContext; + + private PersonalizedOffersBuilder() {} + + public PersonalizedOffersBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public PersonalizedOffersBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public PersonalizedOffersBuilder email(String value) { + this.email = value; + return this; + } + + public PersonalizedOffersBuilder roles(List value) { + this.roles = value; + return this; + } + + public PersonalizedOffersBuilder externalUserId(String value) { + this.externalUserId = value; + return this; + } + + public PersonalizedOffersBuilder subscriptionId(String value) { + this.subscriptionId = value; + return this; + } + + public PersonalizedOffersBuilder customerId(String value) { + this.customerId = value; + return this; + } + + public PersonalizedOffersBuilder custom(java.util.Map value) { + this.custom = value; + return this; + } + + public PersonalizedOffersBuilder requestContext(RequestContextParams value) { + this.requestContext = value; + return this; + } + + public PersonalizedOffersParams build() { + return new PersonalizedOffersParams(this); + } + } + + public static final class RequestContextParams { + + private final String userAgent; + + private final String locale; + + private final String timezone; + + private final String url; + + private final String referrerUrl; + + private RequestContextParams(RequestContextBuilder builder) { + + this.userAgent = builder.userAgent; + + this.locale = builder.locale; + + this.timezone = builder.timezone; + + this.url = builder.url; + + this.referrerUrl = builder.referrerUrl; + } + + public String getUserAgent() { + return userAgent; + } + + public String getLocale() { + return locale; + } + + public String getTimezone() { + return timezone; + } + + public String getUrl() { + return url; + } + + public String getReferrerUrl() { + return referrerUrl; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.userAgent != null) { + + formData.put("user_agent", this.userAgent); + } + + if (this.locale != null) { + + formData.put("locale", this.locale); + } + + if (this.timezone != null) { + + formData.put("timezone", this.timezone); + } + + if (this.url != null) { + + formData.put("url", this.url); + } + + if (this.referrerUrl != null) { + + formData.put("referrer_url", this.referrerUrl); + } + + return formData; + } + + /** Create a new builder for RequestContextParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static RequestContextBuilder builder() { + return new RequestContextBuilder(); + } + + public static final class RequestContextBuilder { + + private String userAgent; + + private String locale; + + private String timezone; + + private String url; + + private String referrerUrl; + + private RequestContextBuilder() {} + + public RequestContextBuilder userAgent(String value) { + this.userAgent = value; + return this; + } + + public RequestContextBuilder locale(String value) { + this.locale = value; + return this; + } + + public RequestContextBuilder timezone(String value) { + this.timezone = value; + return this; + } + + public RequestContextBuilder url(String value) { + this.url = value; + return this; + } + + public RequestContextBuilder referrerUrl(String value) { + this.referrerUrl = value; + return this; + } + + public RequestContextParams build() { + return new RequestContextParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/personalizedOffer/responses/PersonalizedOfferCreateResponse.java b/src/main/java/com/chargebee/v4/models/personalizedOffer/responses/PersonalizedOfferCreateResponse.java deleted file mode 100644 index 69563fab..00000000 --- a/src/main/java/com/chargebee/v4/models/personalizedOffer/responses/PersonalizedOfferCreateResponse.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.chargebee.v4.models.personalizedOffer.responses; - -import java.util.List; - -import com.chargebee.v4.models.brand.Brand; - -import com.chargebee.v4.models.personalizedOffer.PersonalizedOffer; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import java.sql.Timestamp; - -/** - * Immutable response object for PersonalizedOfferCreate operation. Contains the response data from - * the API. - */ -public final class PersonalizedOfferCreateResponse extends BaseResponse { - private final List personalizedOffers; - - private final Brand brand; - - private final Timestamp expiresAt; - - private PersonalizedOfferCreateResponse(Builder builder) { - super(builder.httpResponse); - - this.personalizedOffers = builder.personalizedOffers; - - this.brand = builder.brand; - - this.expiresAt = builder.expiresAt; - } - - /** Parse JSON response into PersonalizedOfferCreateResponse object. */ - public static PersonalizedOfferCreateResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into PersonalizedOfferCreateResponse object with HTTP response. */ - public static PersonalizedOfferCreateResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.personalizedOffers( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "personalized_offers")).stream() - .map(PersonalizedOffer::fromJson) - .collect(java.util.stream.Collectors.toList())); - - String __brandJson = JsonUtil.getObject(json, "brand"); - if (__brandJson != null) { - builder.brand(Brand.fromJson(__brandJson)); - } - - builder.expiresAt(JsonUtil.getTimestamp(json, "expires_at")); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse PersonalizedOfferCreateResponse from JSON", e); - } - } - - /** Create a new builder for PersonalizedOfferCreateResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for PersonalizedOfferCreateResponse. */ - public static class Builder { - - private List personalizedOffers; - - private Brand brand; - - private Timestamp expiresAt; - - private Response httpResponse; - - private Builder() {} - - public Builder personalizedOffers(List personalizedOffers) { - this.personalizedOffers = personalizedOffers; - return this; - } - - public Builder brand(Brand brand) { - this.brand = brand; - return this; - } - - public Builder expiresAt(Timestamp expiresAt) { - this.expiresAt = expiresAt; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public PersonalizedOfferCreateResponse build() { - return new PersonalizedOfferCreateResponse(this); - } - } - - /** Get the personalizedOffers from the response. */ - public List getPersonalizedOffers() { - return personalizedOffers; - } - - /** Get the brand from the response. */ - public Brand getBrand() { - return brand; - } - - /** Get the expiresAt from the response. */ - public Timestamp getExpiresAt() { - return expiresAt; - } -} diff --git a/src/main/java/com/chargebee/v4/models/personalizedOffer/responses/PersonalizedOffersResponse.java b/src/main/java/com/chargebee/v4/models/personalizedOffer/responses/PersonalizedOffersResponse.java new file mode 100644 index 00000000..1266a53f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/personalizedOffer/responses/PersonalizedOffersResponse.java @@ -0,0 +1,121 @@ +package com.chargebee.v4.models.personalizedOffer.responses; + +import java.util.List; + +import com.chargebee.v4.models.brand.Brand; + +import com.chargebee.v4.models.personalizedOffer.PersonalizedOffer; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import java.sql.Timestamp; + +/** + * Immutable response object for PersonalizedOffers operation. Contains the response data from the + * API. + */ +public final class PersonalizedOffersResponse extends BaseResponse { + private final List personalizedOffers; + + private final Brand brand; + + private final Timestamp expiresAt; + + private PersonalizedOffersResponse(Builder builder) { + super(builder.httpResponse); + + this.personalizedOffers = builder.personalizedOffers; + + this.brand = builder.brand; + + this.expiresAt = builder.expiresAt; + } + + /** Parse JSON response into PersonalizedOffersResponse object. */ + public static PersonalizedOffersResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PersonalizedOffersResponse object with HTTP response. */ + public static PersonalizedOffersResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.personalizedOffers( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "personalized_offers")).stream() + .map(PersonalizedOffer::fromJson) + .collect(java.util.stream.Collectors.toList())); + + String __brandJson = JsonUtil.getObject(json, "brand"); + if (__brandJson != null) { + builder.brand(Brand.fromJson(__brandJson)); + } + + builder.expiresAt(JsonUtil.getTimestamp(json, "expires_at")); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse PersonalizedOffersResponse from JSON", e); + } + } + + /** Create a new builder for PersonalizedOffersResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PersonalizedOffersResponse. */ + public static class Builder { + + private List personalizedOffers; + + private Brand brand; + + private Timestamp expiresAt; + + private Response httpResponse; + + private Builder() {} + + public Builder personalizedOffers(List personalizedOffers) { + this.personalizedOffers = personalizedOffers; + return this; + } + + public Builder brand(Brand brand) { + this.brand = brand; + return this; + } + + public Builder expiresAt(Timestamp expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PersonalizedOffersResponse build() { + return new PersonalizedOffersResponse(this); + } + } + + /** Get the personalizedOffers from the response. */ + public List getPersonalizedOffers() { + return personalizedOffers; + } + + /** Get the brand from the response. */ + public Brand getBrand() { + return brand; + } + + /** Get the expiresAt from the response. */ + public Timestamp getExpiresAt() { + return expiresAt; + } +} diff --git a/src/main/java/com/chargebee/v4/models/plan/params/DeletePlanParams.java b/src/main/java/com/chargebee/v4/models/plan/params/DeletePlanParams.java deleted file mode 100644 index ff355270..00000000 --- a/src/main/java/com/chargebee/v4/models/plan/params/DeletePlanParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.plan.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeletePlanParams { - - private DeletePlanParams(DeletePlanBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeletePlanParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeletePlanBuilder builder() { - return new DeletePlanBuilder(); - } - - public static final class DeletePlanBuilder { - - private DeletePlanBuilder() {} - - public DeletePlanParams build() { - return new DeletePlanParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/plan/params/PlanDeleteParams.java b/src/main/java/com/chargebee/v4/models/plan/params/PlanDeleteParams.java new file mode 100644 index 00000000..e2ae1078 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/plan/params/PlanDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.plan.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PlanDeleteParams { + + private PlanDeleteParams(PlanDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for PlanDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PlanDeleteBuilder builder() { + return new PlanDeleteBuilder(); + } + + public static final class PlanDeleteBuilder { + + private PlanDeleteBuilder() {} + + public PlanDeleteParams build() { + return new PlanDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/plan/params/PlanUnarchiveParams.java b/src/main/java/com/chargebee/v4/models/plan/params/PlanUnarchiveParams.java new file mode 100644 index 00000000..11f7724b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/plan/params/PlanUnarchiveParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.plan.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PlanUnarchiveParams { + + private PlanUnarchiveParams(PlanUnarchiveBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for PlanUnarchiveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PlanUnarchiveBuilder builder() { + return new PlanUnarchiveBuilder(); + } + + public static final class PlanUnarchiveBuilder { + + private PlanUnarchiveBuilder() {} + + public PlanUnarchiveParams build() { + return new PlanUnarchiveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/plan/params/UnarchiveForPlanParams.java b/src/main/java/com/chargebee/v4/models/plan/params/UnarchiveForPlanParams.java deleted file mode 100644 index 5b3ef1ca..00000000 --- a/src/main/java/com/chargebee/v4/models/plan/params/UnarchiveForPlanParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.plan.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UnarchiveForPlanParams { - - private UnarchiveForPlanParams(UnarchiveForPlanBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for UnarchiveForPlanParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UnarchiveForPlanBuilder builder() { - return new UnarchiveForPlanBuilder(); - } - - public static final class UnarchiveForPlanBuilder { - - private UnarchiveForPlanBuilder() {} - - public UnarchiveForPlanParams build() { - return new UnarchiveForPlanParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/plan/responses/DeletePlanResponse.java b/src/main/java/com/chargebee/v4/models/plan/responses/DeletePlanResponse.java deleted file mode 100644 index 254e43fa..00000000 --- a/src/main/java/com/chargebee/v4/models/plan/responses/DeletePlanResponse.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.chargebee.v4.models.plan.responses; - -import com.chargebee.v4.models.plan.Plan; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** Immutable response object for DeletePlan operation. Contains the response data from the API. */ -public final class DeletePlanResponse extends BaseResponse { - private final Plan plan; - - private DeletePlanResponse(Builder builder) { - super(builder.httpResponse); - - this.plan = builder.plan; - } - - /** Parse JSON response into DeletePlanResponse object. */ - public static DeletePlanResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeletePlanResponse object with HTTP response. */ - public static DeletePlanResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __planJson = JsonUtil.getObject(json, "plan"); - if (__planJson != null) { - builder.plan(Plan.fromJson(__planJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeletePlanResponse from JSON", e); - } - } - - /** Create a new builder for DeletePlanResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeletePlanResponse. */ - public static class Builder { - - private Plan plan; - - private Response httpResponse; - - private Builder() {} - - public Builder plan(Plan plan) { - this.plan = plan; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeletePlanResponse build() { - return new DeletePlanResponse(this); - } - } - - /** Get the plan from the response. */ - public Plan getPlan() { - return plan; - } -} diff --git a/src/main/java/com/chargebee/v4/models/plan/responses/PlanDeleteResponse.java b/src/main/java/com/chargebee/v4/models/plan/responses/PlanDeleteResponse.java new file mode 100644 index 00000000..0aeec263 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/plan/responses/PlanDeleteResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.plan.responses; + +import com.chargebee.v4.models.plan.Plan; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for PlanDelete operation. Contains the response data from the API. */ +public final class PlanDeleteResponse extends BaseResponse { + private final Plan plan; + + private PlanDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.plan = builder.plan; + } + + /** Parse JSON response into PlanDeleteResponse object. */ + public static PlanDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PlanDeleteResponse object with HTTP response. */ + public static PlanDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __planJson = JsonUtil.getObject(json, "plan"); + if (__planJson != null) { + builder.plan(Plan.fromJson(__planJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse PlanDeleteResponse from JSON", e); + } + } + + /** Create a new builder for PlanDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PlanDeleteResponse. */ + public static class Builder { + + private Plan plan; + + private Response httpResponse; + + private Builder() {} + + public Builder plan(Plan plan) { + this.plan = plan; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PlanDeleteResponse build() { + return new PlanDeleteResponse(this); + } + } + + /** Get the plan from the response. */ + public Plan getPlan() { + return plan; + } +} diff --git a/src/main/java/com/chargebee/v4/models/plan/responses/PlanListResponse.java b/src/main/java/com/chargebee/v4/models/plan/responses/PlanListResponse.java index 732c2c0a..293c8686 100644 --- a/src/main/java/com/chargebee/v4/models/plan/responses/PlanListResponse.java +++ b/src/main/java/com/chargebee/v4/models/plan/responses/PlanListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.plan.Plan; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.PlanService; @@ -95,9 +96,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public PlanListResponse nextPage() throws Exception { + public PlanListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/plan/responses/PlanUnarchiveResponse.java b/src/main/java/com/chargebee/v4/models/plan/responses/PlanUnarchiveResponse.java new file mode 100644 index 00000000..53571a40 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/plan/responses/PlanUnarchiveResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.plan.responses; + +import com.chargebee.v4.models.plan.Plan; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PlanUnarchive operation. Contains the response data from the API. + */ +public final class PlanUnarchiveResponse extends BaseResponse { + private final Plan plan; + + private PlanUnarchiveResponse(Builder builder) { + super(builder.httpResponse); + + this.plan = builder.plan; + } + + /** Parse JSON response into PlanUnarchiveResponse object. */ + public static PlanUnarchiveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PlanUnarchiveResponse object with HTTP response. */ + public static PlanUnarchiveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __planJson = JsonUtil.getObject(json, "plan"); + if (__planJson != null) { + builder.plan(Plan.fromJson(__planJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse PlanUnarchiveResponse from JSON", e); + } + } + + /** Create a new builder for PlanUnarchiveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PlanUnarchiveResponse. */ + public static class Builder { + + private Plan plan; + + private Response httpResponse; + + private Builder() {} + + public Builder plan(Plan plan) { + this.plan = plan; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PlanUnarchiveResponse build() { + return new PlanUnarchiveResponse(this); + } + } + + /** Get the plan from the response. */ + public Plan getPlan() { + return plan; + } +} diff --git a/src/main/java/com/chargebee/v4/models/plan/responses/UnarchiveForPlanResponse.java b/src/main/java/com/chargebee/v4/models/plan/responses/UnarchiveForPlanResponse.java deleted file mode 100644 index 1a2c6dda..00000000 --- a/src/main/java/com/chargebee/v4/models/plan/responses/UnarchiveForPlanResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.plan.responses; - -import com.chargebee.v4.models.plan.Plan; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UnarchiveForPlan operation. Contains the response data from the - * API. - */ -public final class UnarchiveForPlanResponse extends BaseResponse { - private final Plan plan; - - private UnarchiveForPlanResponse(Builder builder) { - super(builder.httpResponse); - - this.plan = builder.plan; - } - - /** Parse JSON response into UnarchiveForPlanResponse object. */ - public static UnarchiveForPlanResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UnarchiveForPlanResponse object with HTTP response. */ - public static UnarchiveForPlanResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __planJson = JsonUtil.getObject(json, "plan"); - if (__planJson != null) { - builder.plan(Plan.fromJson(__planJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UnarchiveForPlanResponse from JSON", e); - } - } - - /** Create a new builder for UnarchiveForPlanResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UnarchiveForPlanResponse. */ - public static class Builder { - - private Plan plan; - - private Response httpResponse; - - private Builder() {} - - public Builder plan(Plan plan) { - this.plan = plan; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UnarchiveForPlanResponse build() { - return new UnarchiveForPlanResponse(this); - } - } - - /** Get the plan from the response. */ - public Plan getPlan() { - return plan; - } -} diff --git a/src/main/java/com/chargebee/v4/models/portalSession/params/ActivateForPortalSessionParams.java b/src/main/java/com/chargebee/v4/models/portalSession/params/ActivateForPortalSessionParams.java deleted file mode 100644 index 94fe2bf9..00000000 --- a/src/main/java/com/chargebee/v4/models/portalSession/params/ActivateForPortalSessionParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.portalSession.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ActivateForPortalSessionParams { - - private final String token; - - private ActivateForPortalSessionParams(ActivateForPortalSessionBuilder builder) { - - this.token = builder.token; - } - - public String getToken() { - return token; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.token != null) { - - formData.put("token", this.token); - } - - return formData; - } - - /** Create a new builder for ActivateForPortalSessionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ActivateForPortalSessionBuilder builder() { - return new ActivateForPortalSessionBuilder(); - } - - public static final class ActivateForPortalSessionBuilder { - - private String token; - - private ActivateForPortalSessionBuilder() {} - - public ActivateForPortalSessionBuilder token(String value) { - this.token = value; - return this; - } - - public ActivateForPortalSessionParams build() { - return new ActivateForPortalSessionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/portalSession/params/LogoutForPortalSessionParams.java b/src/main/java/com/chargebee/v4/models/portalSession/params/LogoutForPortalSessionParams.java deleted file mode 100644 index 77987e25..00000000 --- a/src/main/java/com/chargebee/v4/models/portalSession/params/LogoutForPortalSessionParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.portalSession.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class LogoutForPortalSessionParams { - - private LogoutForPortalSessionParams(LogoutForPortalSessionBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for LogoutForPortalSessionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static LogoutForPortalSessionBuilder builder() { - return new LogoutForPortalSessionBuilder(); - } - - public static final class LogoutForPortalSessionBuilder { - - private LogoutForPortalSessionBuilder() {} - - public LogoutForPortalSessionParams build() { - return new LogoutForPortalSessionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/portalSession/params/PortalSessionActivateParams.java b/src/main/java/com/chargebee/v4/models/portalSession/params/PortalSessionActivateParams.java new file mode 100644 index 00000000..49f466b1 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/portalSession/params/PortalSessionActivateParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.portalSession.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PortalSessionActivateParams { + + private final String token; + + private PortalSessionActivateParams(PortalSessionActivateBuilder builder) { + + this.token = builder.token; + } + + public String getToken() { + return token; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.token != null) { + + formData.put("token", this.token); + } + + return formData; + } + + /** Create a new builder for PortalSessionActivateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PortalSessionActivateBuilder builder() { + return new PortalSessionActivateBuilder(); + } + + public static final class PortalSessionActivateBuilder { + + private String token; + + private PortalSessionActivateBuilder() {} + + public PortalSessionActivateBuilder token(String value) { + this.token = value; + return this; + } + + public PortalSessionActivateParams build() { + return new PortalSessionActivateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/portalSession/params/PortalSessionLogoutParams.java b/src/main/java/com/chargebee/v4/models/portalSession/params/PortalSessionLogoutParams.java new file mode 100644 index 00000000..8e61b2e6 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/portalSession/params/PortalSessionLogoutParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.portalSession.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PortalSessionLogoutParams { + + private PortalSessionLogoutParams(PortalSessionLogoutBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for PortalSessionLogoutParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PortalSessionLogoutBuilder builder() { + return new PortalSessionLogoutBuilder(); + } + + public static final class PortalSessionLogoutBuilder { + + private PortalSessionLogoutBuilder() {} + + public PortalSessionLogoutParams build() { + return new PortalSessionLogoutParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/portalSession/responses/ActivateForPortalSessionResponse.java b/src/main/java/com/chargebee/v4/models/portalSession/responses/ActivateForPortalSessionResponse.java deleted file mode 100644 index 4a5a3f6e..00000000 --- a/src/main/java/com/chargebee/v4/models/portalSession/responses/ActivateForPortalSessionResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.portalSession.responses; - -import com.chargebee.v4.models.portalSession.PortalSession; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ActivateForPortalSession operation. Contains the response data from - * the API. - */ -public final class ActivateForPortalSessionResponse extends BaseResponse { - private final PortalSession portalSession; - - private ActivateForPortalSessionResponse(Builder builder) { - super(builder.httpResponse); - - this.portalSession = builder.portalSession; - } - - /** Parse JSON response into ActivateForPortalSessionResponse object. */ - public static ActivateForPortalSessionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ActivateForPortalSessionResponse object with HTTP response. */ - public static ActivateForPortalSessionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __portalSessionJson = JsonUtil.getObject(json, "portal_session"); - if (__portalSessionJson != null) { - builder.portalSession(PortalSession.fromJson(__portalSessionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ActivateForPortalSessionResponse from JSON", e); - } - } - - /** Create a new builder for ActivateForPortalSessionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ActivateForPortalSessionResponse. */ - public static class Builder { - - private PortalSession portalSession; - - private Response httpResponse; - - private Builder() {} - - public Builder portalSession(PortalSession portalSession) { - this.portalSession = portalSession; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ActivateForPortalSessionResponse build() { - return new ActivateForPortalSessionResponse(this); - } - } - - /** Get the portalSession from the response. */ - public PortalSession getPortalSession() { - return portalSession; - } -} diff --git a/src/main/java/com/chargebee/v4/models/portalSession/responses/LogoutForPortalSessionResponse.java b/src/main/java/com/chargebee/v4/models/portalSession/responses/LogoutForPortalSessionResponse.java deleted file mode 100644 index b92e08bb..00000000 --- a/src/main/java/com/chargebee/v4/models/portalSession/responses/LogoutForPortalSessionResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.portalSession.responses; - -import com.chargebee.v4.models.portalSession.PortalSession; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for LogoutForPortalSession operation. Contains the response data from - * the API. - */ -public final class LogoutForPortalSessionResponse extends BaseResponse { - private final PortalSession portalSession; - - private LogoutForPortalSessionResponse(Builder builder) { - super(builder.httpResponse); - - this.portalSession = builder.portalSession; - } - - /** Parse JSON response into LogoutForPortalSessionResponse object. */ - public static LogoutForPortalSessionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into LogoutForPortalSessionResponse object with HTTP response. */ - public static LogoutForPortalSessionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __portalSessionJson = JsonUtil.getObject(json, "portal_session"); - if (__portalSessionJson != null) { - builder.portalSession(PortalSession.fromJson(__portalSessionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse LogoutForPortalSessionResponse from JSON", e); - } - } - - /** Create a new builder for LogoutForPortalSessionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for LogoutForPortalSessionResponse. */ - public static class Builder { - - private PortalSession portalSession; - - private Response httpResponse; - - private Builder() {} - - public Builder portalSession(PortalSession portalSession) { - this.portalSession = portalSession; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public LogoutForPortalSessionResponse build() { - return new LogoutForPortalSessionResponse(this); - } - } - - /** Get the portalSession from the response. */ - public PortalSession getPortalSession() { - return portalSession; - } -} diff --git a/src/main/java/com/chargebee/v4/models/portalSession/responses/PortalSessionActivateResponse.java b/src/main/java/com/chargebee/v4/models/portalSession/responses/PortalSessionActivateResponse.java new file mode 100644 index 00000000..de9ba2a1 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/portalSession/responses/PortalSessionActivateResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.portalSession.responses; + +import com.chargebee.v4.models.portalSession.PortalSession; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PortalSessionActivate operation. Contains the response data from + * the API. + */ +public final class PortalSessionActivateResponse extends BaseResponse { + private final PortalSession portalSession; + + private PortalSessionActivateResponse(Builder builder) { + super(builder.httpResponse); + + this.portalSession = builder.portalSession; + } + + /** Parse JSON response into PortalSessionActivateResponse object. */ + public static PortalSessionActivateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PortalSessionActivateResponse object with HTTP response. */ + public static PortalSessionActivateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __portalSessionJson = JsonUtil.getObject(json, "portal_session"); + if (__portalSessionJson != null) { + builder.portalSession(PortalSession.fromJson(__portalSessionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse PortalSessionActivateResponse from JSON", e); + } + } + + /** Create a new builder for PortalSessionActivateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PortalSessionActivateResponse. */ + public static class Builder { + + private PortalSession portalSession; + + private Response httpResponse; + + private Builder() {} + + public Builder portalSession(PortalSession portalSession) { + this.portalSession = portalSession; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PortalSessionActivateResponse build() { + return new PortalSessionActivateResponse(this); + } + } + + /** Get the portalSession from the response. */ + public PortalSession getPortalSession() { + return portalSession; + } +} diff --git a/src/main/java/com/chargebee/v4/models/portalSession/responses/PortalSessionLogoutResponse.java b/src/main/java/com/chargebee/v4/models/portalSession/responses/PortalSessionLogoutResponse.java new file mode 100644 index 00000000..9bf9c474 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/portalSession/responses/PortalSessionLogoutResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.portalSession.responses; + +import com.chargebee.v4.models.portalSession.PortalSession; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PortalSessionLogout operation. Contains the response data from the + * API. + */ +public final class PortalSessionLogoutResponse extends BaseResponse { + private final PortalSession portalSession; + + private PortalSessionLogoutResponse(Builder builder) { + super(builder.httpResponse); + + this.portalSession = builder.portalSession; + } + + /** Parse JSON response into PortalSessionLogoutResponse object. */ + public static PortalSessionLogoutResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PortalSessionLogoutResponse object with HTTP response. */ + public static PortalSessionLogoutResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __portalSessionJson = JsonUtil.getObject(json, "portal_session"); + if (__portalSessionJson != null) { + builder.portalSession(PortalSession.fromJson(__portalSessionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse PortalSessionLogoutResponse from JSON", e); + } + } + + /** Create a new builder for PortalSessionLogoutResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PortalSessionLogoutResponse. */ + public static class Builder { + + private PortalSession portalSession; + + private Response httpResponse; + + private Builder() {} + + public Builder portalSession(PortalSession portalSession) { + this.portalSession = portalSession; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PortalSessionLogoutResponse build() { + return new PortalSessionLogoutResponse(this); + } + } + + /** Get the portalSession from the response. */ + public PortalSession getPortalSession() { + return portalSession; + } +} diff --git a/src/main/java/com/chargebee/v4/models/priceVariant/params/DeletePriceVariantParams.java b/src/main/java/com/chargebee/v4/models/priceVariant/params/DeletePriceVariantParams.java deleted file mode 100644 index cab9f641..00000000 --- a/src/main/java/com/chargebee/v4/models/priceVariant/params/DeletePriceVariantParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.priceVariant.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeletePriceVariantParams { - - private DeletePriceVariantParams(DeletePriceVariantBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeletePriceVariantParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeletePriceVariantBuilder builder() { - return new DeletePriceVariantBuilder(); - } - - public static final class DeletePriceVariantBuilder { - - private DeletePriceVariantBuilder() {} - - public DeletePriceVariantParams build() { - return new DeletePriceVariantParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/priceVariant/params/PriceVariantDeleteParams.java b/src/main/java/com/chargebee/v4/models/priceVariant/params/PriceVariantDeleteParams.java new file mode 100644 index 00000000..bc75b902 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/priceVariant/params/PriceVariantDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.priceVariant.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class PriceVariantDeleteParams { + + private PriceVariantDeleteParams(PriceVariantDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for PriceVariantDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PriceVariantDeleteBuilder builder() { + return new PriceVariantDeleteBuilder(); + } + + public static final class PriceVariantDeleteBuilder { + + private PriceVariantDeleteBuilder() {} + + public PriceVariantDeleteParams build() { + return new PriceVariantDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/priceVariant/params/PriceVariantListParams.java b/src/main/java/com/chargebee/v4/models/priceVariant/params/PriceVariantListParams.java index 839773ab..741750ee 100644 --- a/src/main/java/com/chargebee/v4/models/priceVariant/params/PriceVariantListParams.java +++ b/src/main/java/com/chargebee/v4/models/priceVariant/params/PriceVariantListParams.java @@ -263,13 +263,13 @@ public static final class BusinessEntityIdFilter { this.builder = builder; } - public PriceVariantListBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); + public PriceVariantListBuilder isPresent(boolean value) { + builder.queryParams.put(fieldName + "[is_present]", String.valueOf(value)); return builder; } - public PriceVariantListBuilder isPresent(boolean value) { - builder.queryParams.put(fieldName + "[is_present]", String.valueOf(value)); + public PriceVariantListBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); return builder; } } diff --git a/src/main/java/com/chargebee/v4/models/priceVariant/responses/DeletePriceVariantResponse.java b/src/main/java/com/chargebee/v4/models/priceVariant/responses/DeletePriceVariantResponse.java deleted file mode 100644 index b60fba69..00000000 --- a/src/main/java/com/chargebee/v4/models/priceVariant/responses/DeletePriceVariantResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.priceVariant.responses; - -import com.chargebee.v4.models.priceVariant.PriceVariant; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeletePriceVariant operation. Contains the response data from the - * API. - */ -public final class DeletePriceVariantResponse extends BaseResponse { - private final PriceVariant priceVariant; - - private DeletePriceVariantResponse(Builder builder) { - super(builder.httpResponse); - - this.priceVariant = builder.priceVariant; - } - - /** Parse JSON response into DeletePriceVariantResponse object. */ - public static DeletePriceVariantResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeletePriceVariantResponse object with HTTP response. */ - public static DeletePriceVariantResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __priceVariantJson = JsonUtil.getObject(json, "price_variant"); - if (__priceVariantJson != null) { - builder.priceVariant(PriceVariant.fromJson(__priceVariantJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeletePriceVariantResponse from JSON", e); - } - } - - /** Create a new builder for DeletePriceVariantResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeletePriceVariantResponse. */ - public static class Builder { - - private PriceVariant priceVariant; - - private Response httpResponse; - - private Builder() {} - - public Builder priceVariant(PriceVariant priceVariant) { - this.priceVariant = priceVariant; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeletePriceVariantResponse build() { - return new DeletePriceVariantResponse(this); - } - } - - /** Get the priceVariant from the response. */ - public PriceVariant getPriceVariant() { - return priceVariant; - } -} diff --git a/src/main/java/com/chargebee/v4/models/priceVariant/responses/PriceVariantDeleteResponse.java b/src/main/java/com/chargebee/v4/models/priceVariant/responses/PriceVariantDeleteResponse.java new file mode 100644 index 00000000..82bd3b6a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/priceVariant/responses/PriceVariantDeleteResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.priceVariant.responses; + +import com.chargebee.v4.models.priceVariant.PriceVariant; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for PriceVariantDelete operation. Contains the response data from the + * API. + */ +public final class PriceVariantDeleteResponse extends BaseResponse { + private final PriceVariant priceVariant; + + private PriceVariantDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.priceVariant = builder.priceVariant; + } + + /** Parse JSON response into PriceVariantDeleteResponse object. */ + public static PriceVariantDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into PriceVariantDeleteResponse object with HTTP response. */ + public static PriceVariantDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __priceVariantJson = JsonUtil.getObject(json, "price_variant"); + if (__priceVariantJson != null) { + builder.priceVariant(PriceVariant.fromJson(__priceVariantJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse PriceVariantDeleteResponse from JSON", e); + } + } + + /** Create a new builder for PriceVariantDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for PriceVariantDeleteResponse. */ + public static class Builder { + + private PriceVariant priceVariant; + + private Response httpResponse; + + private Builder() {} + + public Builder priceVariant(PriceVariant priceVariant) { + this.priceVariant = priceVariant; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public PriceVariantDeleteResponse build() { + return new PriceVariantDeleteResponse(this); + } + } + + /** Get the priceVariant from the response. */ + public PriceVariant getPriceVariant() { + return priceVariant; + } +} diff --git a/src/main/java/com/chargebee/v4/models/priceVariant/responses/PriceVariantListResponse.java b/src/main/java/com/chargebee/v4/models/priceVariant/responses/PriceVariantListResponse.java index 99640570..bc9ca0a7 100644 --- a/src/main/java/com/chargebee/v4/models/priceVariant/responses/PriceVariantListResponse.java +++ b/src/main/java/com/chargebee/v4/models/priceVariant/responses/PriceVariantListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.priceVariant.PriceVariant; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.PriceVariantService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public PriceVariantListResponse nextPage() throws Exception { + public PriceVariantListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/product/params/DeleteProductParams.java b/src/main/java/com/chargebee/v4/models/product/params/DeleteProductParams.java deleted file mode 100644 index 10f8a3f5..00000000 --- a/src/main/java/com/chargebee/v4/models/product/params/DeleteProductParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.product.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteProductParams { - - private DeleteProductParams(DeleteProductBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteProductParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteProductBuilder builder() { - return new DeleteProductBuilder(); - } - - public static final class DeleteProductBuilder { - - private DeleteProductBuilder() {} - - public DeleteProductParams build() { - return new DeleteProductParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/product/params/ProductDeleteParams.java b/src/main/java/com/chargebee/v4/models/product/params/ProductDeleteParams.java new file mode 100644 index 00000000..44f74240 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/product/params/ProductDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.product.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ProductDeleteParams { + + private ProductDeleteParams(ProductDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for ProductDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ProductDeleteBuilder builder() { + return new ProductDeleteBuilder(); + } + + public static final class ProductDeleteBuilder { + + private ProductDeleteBuilder() {} + + public ProductDeleteParams build() { + return new ProductDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/product/params/ProductUpdateOptionsParams.java b/src/main/java/com/chargebee/v4/models/product/params/ProductUpdateOptionsParams.java new file mode 100644 index 00000000..8d5066f7 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/product/params/ProductUpdateOptionsParams.java @@ -0,0 +1,180 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.product.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class ProductUpdateOptionsParams { + + private final List removeOptions; + + private final List options; + + private ProductUpdateOptionsParams(ProductUpdateOptionsBuilder builder) { + + this.removeOptions = builder.removeOptions; + + this.options = builder.options; + } + + public List getRemoveOptions() { + return removeOptions; + } + + public List getOptions() { + return options; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.removeOptions != null) { + + formData.put("remove_options", this.removeOptions); + } + + if (this.options != null) { + + // List of objects + for (int i = 0; i < this.options.size(); i++) { + OptionsParams item = this.options.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "options[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for ProductUpdateOptionsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ProductUpdateOptionsBuilder builder() { + return new ProductUpdateOptionsBuilder(); + } + + public static final class ProductUpdateOptionsBuilder { + + private List removeOptions; + + private List options; + + private ProductUpdateOptionsBuilder() {} + + public ProductUpdateOptionsBuilder removeOptions(List value) { + this.removeOptions = value; + return this; + } + + public ProductUpdateOptionsBuilder options(List value) { + this.options = value; + return this; + } + + public ProductUpdateOptionsParams build() { + return new ProductUpdateOptionsParams(this); + } + } + + public static final class OptionsParams { + + private final String name; + + private final List values; + + private final String defaultValue; + + private OptionsParams(OptionsBuilder builder) { + + this.name = builder.name; + + this.values = builder.values; + + this.defaultValue = builder.defaultValue; + } + + public String getName() { + return name; + } + + public List getValues() { + return values; + } + + public String getDefaultValue() { + return defaultValue; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.name != null) { + + formData.put("name", this.name); + } + + if (this.values != null) { + + formData.put("values", JsonUtil.toJson(this.values)); + } + + if (this.defaultValue != null) { + + formData.put("default_value", this.defaultValue); + } + + return formData; + } + + /** Create a new builder for OptionsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OptionsBuilder builder() { + return new OptionsBuilder(); + } + + public static final class OptionsBuilder { + + private String name; + + private List values; + + private String defaultValue; + + private OptionsBuilder() {} + + public OptionsBuilder name(String value) { + this.name = value; + return this; + } + + public OptionsBuilder values(List value) { + this.values = value; + return this; + } + + public OptionsBuilder defaultValue(String value) { + this.defaultValue = value; + return this; + } + + public OptionsParams build() { + return new OptionsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/product/params/UpdateOptionsForProductParams.java b/src/main/java/com/chargebee/v4/models/product/params/UpdateOptionsForProductParams.java deleted file mode 100644 index 1aaff3a5..00000000 --- a/src/main/java/com/chargebee/v4/models/product/params/UpdateOptionsForProductParams.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.product.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class UpdateOptionsForProductParams { - - private final List removeOptions; - - private final List options; - - private UpdateOptionsForProductParams(UpdateOptionsForProductBuilder builder) { - - this.removeOptions = builder.removeOptions; - - this.options = builder.options; - } - - public List getRemoveOptions() { - return removeOptions; - } - - public List getOptions() { - return options; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.removeOptions != null) { - - formData.put("remove_options", this.removeOptions); - } - - if (this.options != null) { - - // List of objects - for (int i = 0; i < this.options.size(); i++) { - OptionsParams item = this.options.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "options[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for UpdateOptionsForProductParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateOptionsForProductBuilder builder() { - return new UpdateOptionsForProductBuilder(); - } - - public static final class UpdateOptionsForProductBuilder { - - private List removeOptions; - - private List options; - - private UpdateOptionsForProductBuilder() {} - - public UpdateOptionsForProductBuilder removeOptions(List value) { - this.removeOptions = value; - return this; - } - - public UpdateOptionsForProductBuilder options(List value) { - this.options = value; - return this; - } - - public UpdateOptionsForProductParams build() { - return new UpdateOptionsForProductParams(this); - } - } - - public static final class OptionsParams { - - private final String name; - - private final List values; - - private final String defaultValue; - - private OptionsParams(OptionsBuilder builder) { - - this.name = builder.name; - - this.values = builder.values; - - this.defaultValue = builder.defaultValue; - } - - public String getName() { - return name; - } - - public List getValues() { - return values; - } - - public String getDefaultValue() { - return defaultValue; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.name != null) { - - formData.put("name", this.name); - } - - if (this.values != null) { - - formData.put("values", JsonUtil.toJson(this.values)); - } - - if (this.defaultValue != null) { - - formData.put("default_value", this.defaultValue); - } - - return formData; - } - - /** Create a new builder for OptionsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static OptionsBuilder builder() { - return new OptionsBuilder(); - } - - public static final class OptionsBuilder { - - private String name; - - private List values; - - private String defaultValue; - - private OptionsBuilder() {} - - public OptionsBuilder name(String value) { - this.name = value; - return this; - } - - public OptionsBuilder values(List value) { - this.values = value; - return this; - } - - public OptionsBuilder defaultValue(String value) { - this.defaultValue = value; - return this; - } - - public OptionsParams build() { - return new OptionsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/product/responses/DeleteProductResponse.java b/src/main/java/com/chargebee/v4/models/product/responses/DeleteProductResponse.java deleted file mode 100644 index 9f10e0da..00000000 --- a/src/main/java/com/chargebee/v4/models/product/responses/DeleteProductResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.product.responses; - -import com.chargebee.v4.models.product.Product; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteProduct operation. Contains the response data from the API. - */ -public final class DeleteProductResponse extends BaseResponse { - private final Product product; - - private DeleteProductResponse(Builder builder) { - super(builder.httpResponse); - - this.product = builder.product; - } - - /** Parse JSON response into DeleteProductResponse object. */ - public static DeleteProductResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteProductResponse object with HTTP response. */ - public static DeleteProductResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __productJson = JsonUtil.getObject(json, "product"); - if (__productJson != null) { - builder.product(Product.fromJson(__productJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteProductResponse from JSON", e); - } - } - - /** Create a new builder for DeleteProductResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteProductResponse. */ - public static class Builder { - - private Product product; - - private Response httpResponse; - - private Builder() {} - - public Builder product(Product product) { - this.product = product; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteProductResponse build() { - return new DeleteProductResponse(this); - } - } - - /** Get the product from the response. */ - public Product getProduct() { - return product; - } -} diff --git a/src/main/java/com/chargebee/v4/models/product/responses/ProductDeleteResponse.java b/src/main/java/com/chargebee/v4/models/product/responses/ProductDeleteResponse.java new file mode 100644 index 00000000..ea97ef40 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/product/responses/ProductDeleteResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.product.responses; + +import com.chargebee.v4.models.product.Product; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for ProductDelete operation. Contains the response data from the API. + */ +public final class ProductDeleteResponse extends BaseResponse { + private final Product product; + + private ProductDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.product = builder.product; + } + + /** Parse JSON response into ProductDeleteResponse object. */ + public static ProductDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into ProductDeleteResponse object with HTTP response. */ + public static ProductDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __productJson = JsonUtil.getObject(json, "product"); + if (__productJson != null) { + builder.product(Product.fromJson(__productJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse ProductDeleteResponse from JSON", e); + } + } + + /** Create a new builder for ProductDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ProductDeleteResponse. */ + public static class Builder { + + private Product product; + + private Response httpResponse; + + private Builder() {} + + public Builder product(Product product) { + this.product = product; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public ProductDeleteResponse build() { + return new ProductDeleteResponse(this); + } + } + + /** Get the product from the response. */ + public Product getProduct() { + return product; + } +} diff --git a/src/main/java/com/chargebee/v4/models/product/responses/ProductListResponse.java b/src/main/java/com/chargebee/v4/models/product/responses/ProductListResponse.java index 6009f4d5..44ae3df3 100644 --- a/src/main/java/com/chargebee/v4/models/product/responses/ProductListResponse.java +++ b/src/main/java/com/chargebee/v4/models/product/responses/ProductListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.product.Product; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.ProductService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public ProductListResponse nextPage() throws Exception { + public ProductListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/product/responses/ProductUpdateOptionsResponse.java b/src/main/java/com/chargebee/v4/models/product/responses/ProductUpdateOptionsResponse.java new file mode 100644 index 00000000..6ad2d74e --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/product/responses/ProductUpdateOptionsResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.product.responses; + +import com.chargebee.v4.models.product.Product; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for ProductUpdateOptions operation. Contains the response data from the + * API. + */ +public final class ProductUpdateOptionsResponse extends BaseResponse { + private final Product product; + + private ProductUpdateOptionsResponse(Builder builder) { + super(builder.httpResponse); + + this.product = builder.product; + } + + /** Parse JSON response into ProductUpdateOptionsResponse object. */ + public static ProductUpdateOptionsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into ProductUpdateOptionsResponse object with HTTP response. */ + public static ProductUpdateOptionsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __productJson = JsonUtil.getObject(json, "product"); + if (__productJson != null) { + builder.product(Product.fromJson(__productJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse ProductUpdateOptionsResponse from JSON", e); + } + } + + /** Create a new builder for ProductUpdateOptionsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ProductUpdateOptionsResponse. */ + public static class Builder { + + private Product product; + + private Response httpResponse; + + private Builder() {} + + public Builder product(Product product) { + this.product = product; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public ProductUpdateOptionsResponse build() { + return new ProductUpdateOptionsResponse(this); + } + } + + /** Get the product from the response. */ + public Product getProduct() { + return product; + } +} diff --git a/src/main/java/com/chargebee/v4/models/product/responses/UpdateOptionsForProductResponse.java b/src/main/java/com/chargebee/v4/models/product/responses/UpdateOptionsForProductResponse.java deleted file mode 100644 index 449c6d48..00000000 --- a/src/main/java/com/chargebee/v4/models/product/responses/UpdateOptionsForProductResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.product.responses; - -import com.chargebee.v4.models.product.Product; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateOptionsForProduct operation. Contains the response data from - * the API. - */ -public final class UpdateOptionsForProductResponse extends BaseResponse { - private final Product product; - - private UpdateOptionsForProductResponse(Builder builder) { - super(builder.httpResponse); - - this.product = builder.product; - } - - /** Parse JSON response into UpdateOptionsForProductResponse object. */ - public static UpdateOptionsForProductResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdateOptionsForProductResponse object with HTTP response. */ - public static UpdateOptionsForProductResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __productJson = JsonUtil.getObject(json, "product"); - if (__productJson != null) { - builder.product(Product.fromJson(__productJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UpdateOptionsForProductResponse from JSON", e); - } - } - - /** Create a new builder for UpdateOptionsForProductResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateOptionsForProductResponse. */ - public static class Builder { - - private Product product; - - private Response httpResponse; - - private Builder() {} - - public Builder product(Product product) { - this.product = product; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateOptionsForProductResponse build() { - return new UpdateOptionsForProductResponse(this); - } - } - - /** Get the product from the response. */ - public Product getProduct() { - return product; - } -} diff --git a/src/main/java/com/chargebee/v4/models/promotionalCredit/responses/PromotionalCreditListResponse.java b/src/main/java/com/chargebee/v4/models/promotionalCredit/responses/PromotionalCreditListResponse.java index 0a4466e4..a67c08c2 100644 --- a/src/main/java/com/chargebee/v4/models/promotionalCredit/responses/PromotionalCreditListResponse.java +++ b/src/main/java/com/chargebee/v4/models/promotionalCredit/responses/PromotionalCreditListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.promotionalCredit.PromotionalCredit; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.PromotionalCreditService; @@ -99,9 +100,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public PromotionalCreditListResponse nextPage() throws Exception { + public PromotionalCreditListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/quote/params/ConvertForQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/ConvertForQuoteParams.java deleted file mode 100644 index 74dbb6cf..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/ConvertForQuoteParams.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class ConvertForQuoteParams { - - private final Timestamp invoiceDate; - - private final Boolean invoiceImmediately; - - private final Boolean createPendingInvoices; - - private final Boolean firstInvoicePending; - - private final SubscriptionParams subscription; - - private ConvertForQuoteParams(ConvertForQuoteBuilder builder) { - - this.invoiceDate = builder.invoiceDate; - - this.invoiceImmediately = builder.invoiceImmediately; - - this.createPendingInvoices = builder.createPendingInvoices; - - this.firstInvoicePending = builder.firstInvoicePending; - - this.subscription = builder.subscription; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - public Boolean getCreatePendingInvoices() { - return createPendingInvoices; - } - - public Boolean getFirstInvoicePending() { - return firstInvoicePending; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - if (this.createPendingInvoices != null) { - - formData.put("create_pending_invoices", this.createPendingInvoices); - } - - if (this.firstInvoicePending != null) { - - formData.put("first_invoice_pending", this.firstInvoicePending); - } - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for ConvertForQuoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ConvertForQuoteBuilder builder() { - return new ConvertForQuoteBuilder(); - } - - public static final class ConvertForQuoteBuilder { - - private Timestamp invoiceDate; - - private Boolean invoiceImmediately; - - private Boolean createPendingInvoices; - - private Boolean firstInvoicePending; - - private SubscriptionParams subscription; - - private ConvertForQuoteBuilder() {} - - public ConvertForQuoteBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public ConvertForQuoteBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public ConvertForQuoteBuilder createPendingInvoices(Boolean value) { - this.createPendingInvoices = value; - return this; - } - - public ConvertForQuoteBuilder firstInvoicePending(Boolean value) { - this.firstInvoicePending = value; - return this; - } - - public ConvertForQuoteBuilder subscription(SubscriptionParams value) { - this.subscription = value; - return this; - } - - public ConvertForQuoteParams build() { - return new ConvertForQuoteParams(this); - } - } - - public static final class SubscriptionParams { - - private final String id; - - private final AutoCollection autoCollection; - - private final String poNumber; - - private final Boolean autoCloseInvoices; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.id = builder.id; - - this.autoCollection = builder.autoCollection; - - this.poNumber = builder.poNumber; - - this.autoCloseInvoices = builder.autoCloseInvoices; - } - - public String getId() { - return id; - } - - public AutoCollection getAutoCollection() { - return autoCollection; - } - - public String getPoNumber() { - return poNumber; - } - - public Boolean getAutoCloseInvoices() { - return autoCloseInvoices; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.autoCollection != null) { - - formData.put("auto_collection", this.autoCollection); - } - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.autoCloseInvoices != null) { - - formData.put("auto_close_invoices", this.autoCloseInvoices); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private String id; - - private AutoCollection autoCollection; - - private String poNumber; - - private Boolean autoCloseInvoices; - - private SubscriptionBuilder() {} - - public SubscriptionBuilder id(String value) { - this.id = value; - return this; - } - - public SubscriptionBuilder autoCollection(AutoCollection value) { - this.autoCollection = value; - return this; - } - - public SubscriptionBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public SubscriptionBuilder autoCloseInvoices(Boolean value) { - this.autoCloseInvoices = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - - public enum AutoCollection { - ON("on"), - - OFF("off"), - - /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AutoCollection(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AutoCollection fromString(String value) { - if (value == null) return _UNKNOWN; - for (AutoCollection enumValue : AutoCollection.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionForCustomerQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionForCustomerQuoteParams.java new file mode 100644 index 00000000..810f7c00 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionForCustomerQuoteParams.java @@ -0,0 +1,1567 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class CreateSubscriptionForCustomerQuoteParams { + + private final String name; + + private final String notes; + + private final Timestamp expiresAt; + + private final Integer billingCycles; + + private final List mandatoryAddonsToRemove; + + private final Integer termsToCharge; + + private final BillingAlignmentMode billingAlignmentMode; + + private final List couponIds; + + private final SubscriptionParams subscription; + + private final ShippingAddressParams shippingAddress; + + private final ContractTermParams contractTerm; + + private final List addons; + + private final List eventBasedAddons; + + private CreateSubscriptionForCustomerQuoteParams( + CreateSubscriptionForCustomerQuoteBuilder builder) { + + this.name = builder.name; + + this.notes = builder.notes; + + this.expiresAt = builder.expiresAt; + + this.billingCycles = builder.billingCycles; + + this.mandatoryAddonsToRemove = builder.mandatoryAddonsToRemove; + + this.termsToCharge = builder.termsToCharge; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.couponIds = builder.couponIds; + + this.subscription = builder.subscription; + + this.shippingAddress = builder.shippingAddress; + + this.contractTerm = builder.contractTerm; + + this.addons = builder.addons; + + this.eventBasedAddons = builder.eventBasedAddons; + } + + public String getName() { + return name; + } + + public String getNotes() { + return notes; + } + + public Timestamp getExpiresAt() { + return expiresAt; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public List getMandatoryAddonsToRemove() { + return mandatoryAddonsToRemove; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public List getCouponIds() { + return couponIds; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public List getAddons() { + return addons; + } + + public List getEventBasedAddons() { + return eventBasedAddons; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.name != null) { + + formData.put("name", this.name); + } + + if (this.notes != null) { + + formData.put("notes", this.notes); + } + + if (this.expiresAt != null) { + + formData.put("expires_at", this.expiresAt); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.mandatoryAddonsToRemove != null) { + + formData.put("mandatory_addons_to_remove", this.mandatoryAddonsToRemove); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.addons != null) { + + // List of objects + for (int i = 0; i < this.addons.size(); i++) { + AddonsParams item = this.addons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.eventBasedAddons != null) { + + // List of objects + for (int i = 0; i < this.eventBasedAddons.size(); i++) { + EventBasedAddonsParams item = this.eventBasedAddons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for CreateSubscriptionForCustomerQuoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreateSubscriptionForCustomerQuoteBuilder builder() { + return new CreateSubscriptionForCustomerQuoteBuilder(); + } + + public static final class CreateSubscriptionForCustomerQuoteBuilder { + + private String name; + + private String notes; + + private Timestamp expiresAt; + + private Integer billingCycles; + + private List mandatoryAddonsToRemove; + + private Integer termsToCharge; + + private BillingAlignmentMode billingAlignmentMode; + + private List couponIds; + + private SubscriptionParams subscription; + + private ShippingAddressParams shippingAddress; + + private ContractTermParams contractTerm; + + private List addons; + + private List eventBasedAddons; + + private CreateSubscriptionForCustomerQuoteBuilder() {} + + public CreateSubscriptionForCustomerQuoteBuilder name(String value) { + this.name = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder notes(String value) { + this.notes = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder expiresAt(Timestamp value) { + this.expiresAt = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder mandatoryAddonsToRemove(List value) { + this.mandatoryAddonsToRemove = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder billingAlignmentMode( + BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder subscription(SubscriptionParams value) { + this.subscription = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder addons(List value) { + this.addons = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteBuilder eventBasedAddons( + List value) { + this.eventBasedAddons = value; + return this; + } + + public CreateSubscriptionForCustomerQuoteParams build() { + return new CreateSubscriptionForCustomerQuoteParams(this); + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionParams { + + private final String id; + + private final String poNumber; + + private final String planId; + + private final Integer planQuantity; + + private final String planQuantityInDecimal; + + private final Long planUnitPrice; + + private final String planUnitPriceInDecimal; + + private final Long setupFee; + + private final Timestamp trialEnd; + + private final Timestamp startDate; + + private final OfflinePaymentMethod offlinePaymentMethod; + + private final Integer contractTermBillingCycleOnRenewal; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.id = builder.id; + + this.poNumber = builder.poNumber; + + this.planId = builder.planId; + + this.planQuantity = builder.planQuantity; + + this.planQuantityInDecimal = builder.planQuantityInDecimal; + + this.planUnitPrice = builder.planUnitPrice; + + this.planUnitPriceInDecimal = builder.planUnitPriceInDecimal; + + this.setupFee = builder.setupFee; + + this.trialEnd = builder.trialEnd; + + this.startDate = builder.startDate; + + this.offlinePaymentMethod = builder.offlinePaymentMethod; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + } + + public String getId() { + return id; + } + + public String getPoNumber() { + return poNumber; + } + + public String getPlanId() { + return planId; + } + + public Integer getPlanQuantity() { + return planQuantity; + } + + public String getPlanQuantityInDecimal() { + return planQuantityInDecimal; + } + + public Long getPlanUnitPrice() { + return planUnitPrice; + } + + public String getPlanUnitPriceInDecimal() { + return planUnitPriceInDecimal; + } + + public Long getSetupFee() { + return setupFee; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Timestamp getStartDate() { + return startDate; + } + + public OfflinePaymentMethod getOfflinePaymentMethod() { + return offlinePaymentMethod; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.planId != null) { + + formData.put("plan_id", this.planId); + } + + if (this.planQuantity != null) { + + formData.put("plan_quantity", this.planQuantity); + } + + if (this.planQuantityInDecimal != null) { + + formData.put("plan_quantity_in_decimal", this.planQuantityInDecimal); + } + + if (this.planUnitPrice != null) { + + formData.put("plan_unit_price", this.planUnitPrice); + } + + if (this.planUnitPriceInDecimal != null) { + + formData.put("plan_unit_price_in_decimal", this.planUnitPriceInDecimal); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.offlinePaymentMethod != null) { + + formData.put("offline_payment_method", this.offlinePaymentMethod); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private String id; + + private String poNumber; + + private String planId; + + private Integer planQuantity; + + private String planQuantityInDecimal; + + private Long planUnitPrice; + + private String planUnitPriceInDecimal; + + private Long setupFee; + + private Timestamp trialEnd; + + private Timestamp startDate; + + private OfflinePaymentMethod offlinePaymentMethod; + + private Integer contractTermBillingCycleOnRenewal; + + private SubscriptionBuilder() {} + + public SubscriptionBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public SubscriptionBuilder planId(String value) { + this.planId = value; + return this; + } + + public SubscriptionBuilder planQuantity(Integer value) { + this.planQuantity = value; + return this; + } + + public SubscriptionBuilder planQuantityInDecimal(String value) { + this.planQuantityInDecimal = value; + return this; + } + + public SubscriptionBuilder planUnitPrice(Long value) { + this.planUnitPrice = value; + return this; + } + + public SubscriptionBuilder planUnitPriceInDecimal(String value) { + this.planUnitPriceInDecimal = value; + return this; + } + + public SubscriptionBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + this.offlinePaymentMethod = value; + return this; + } + + public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class AddonsParams { + + private final String id; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Timestamp trialEnd; + + private AddonsParams(AddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.trialEnd = builder.trialEnd; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + return formData; + } + + /** Create a new builder for AddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddonsBuilder builder() { + return new AddonsBuilder(); + } + + public static final class AddonsBuilder { + + private String id; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Timestamp trialEnd; + + private AddonsBuilder() {} + + public AddonsBuilder id(String value) { + this.id = value; + return this; + } + + public AddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public AddonsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public AddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public AddonsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public AddonsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public AddonsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public AddonsParams build() { + return new AddonsParams(this); + } + } + } + + public static final class EventBasedAddonsParams { + + private final String id; + + private final Integer quantity; + + private final Long unitPrice; + + private final String quantityInDecimal; + + private final String unitPriceInDecimal; + + private final Integer servicePeriodInDays; + + private final OnEvent onEvent; + + private final Boolean chargeOnce; + + private final ChargeOn chargeOn; + + private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.unitPrice = builder.unitPrice; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.servicePeriodInDays = builder.servicePeriodInDays; + + this.onEvent = builder.onEvent; + + this.chargeOnce = builder.chargeOnce; + + this.chargeOn = builder.chargeOn; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getServicePeriodInDays() { + return servicePeriodInDays; + } + + public OnEvent getOnEvent() { + return onEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ChargeOn getChargeOn() { + return chargeOn; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.servicePeriodInDays != null) { + + formData.put("service_period_in_days", this.servicePeriodInDays); + } + + if (this.onEvent != null) { + + formData.put("on_event", this.onEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.chargeOn != null) { + + formData.put("charge_on", this.chargeOn); + } + + return formData; + } + + /** Create a new builder for EventBasedAddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EventBasedAddonsBuilder builder() { + return new EventBasedAddonsBuilder(); + } + + public static final class EventBasedAddonsBuilder { + + private String id; + + private Integer quantity; + + private Long unitPrice; + + private String quantityInDecimal; + + private String unitPriceInDecimal; + + private Integer servicePeriodInDays; + + private OnEvent onEvent; + + private Boolean chargeOnce; + + private ChargeOn chargeOn; + + private EventBasedAddonsBuilder() {} + + public EventBasedAddonsBuilder id(String value) { + this.id = value; + return this; + } + + public EventBasedAddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public EventBasedAddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public EventBasedAddonsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public EventBasedAddonsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { + this.servicePeriodInDays = value; + return this; + } + + public EventBasedAddonsBuilder onEvent(OnEvent value) { + this.onEvent = value; + return this; + } + + public EventBasedAddonsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public EventBasedAddonsBuilder chargeOn(ChargeOn value) { + this.chargeOn = value; + return this; + } + + public EventBasedAddonsParams build() { + return new EventBasedAddonsParams(this); + } + } + + public enum OnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that OnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + OnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (OnEvent enumValue : OnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOn { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOn enumValue : ChargeOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionItemsForCustomerQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionItemsForCustomerQuoteParams.java new file mode 100644 index 00000000..df6d21e5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionItemsForCustomerQuoteParams.java @@ -0,0 +1,2685 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class CreateSubscriptionItemsForCustomerQuoteParams { + + private final String name; + + private final String notes; + + private final Timestamp expiresAt; + + private final Integer billingCycles; + + private final List mandatoryItemsToRemove; + + private final Integer termsToCharge; + + private final BillingAlignmentMode billingAlignmentMode; + + private final List couponIds; + + private final BillingStartOption billingStartOption; + + private final Integer netTermDays; + + private final SubscriptionParams subscription; + + private final ShippingAddressParams shippingAddress; + + private final ContractTermParams contractTerm; + + private final BillingAddressParams billingAddress; + + private final List subscriptionItems; + + private final List discounts; + + private final List itemTiers; + + private final List coupons; + + private final Map customFields; + + private CreateSubscriptionItemsForCustomerQuoteParams( + CreateSubscriptionItemsForCustomerQuoteBuilder builder) { + + this.name = builder.name; + + this.notes = builder.notes; + + this.expiresAt = builder.expiresAt; + + this.billingCycles = builder.billingCycles; + + this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; + + this.termsToCharge = builder.termsToCharge; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.couponIds = builder.couponIds; + + this.billingStartOption = builder.billingStartOption; + + this.netTermDays = builder.netTermDays; + + this.subscription = builder.subscription; + + this.shippingAddress = builder.shippingAddress; + + this.contractTerm = builder.contractTerm; + + this.billingAddress = builder.billingAddress; + + this.subscriptionItems = builder.subscriptionItems; + + this.discounts = builder.discounts; + + this.itemTiers = builder.itemTiers; + + this.coupons = builder.coupons; + + this.customFields = + builder.customFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); + } + + public String getName() { + return name; + } + + public String getNotes() { + return notes; + } + + public Timestamp getExpiresAt() { + return expiresAt; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public List getMandatoryItemsToRemove() { + return mandatoryItemsToRemove; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public List getCouponIds() { + return couponIds; + } + + public BillingStartOption getBillingStartOption() { + return billingStartOption; + } + + public Integer getNetTermDays() { + return netTermDays; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public BillingAddressParams getBillingAddress() { + return billingAddress; + } + + public List getSubscriptionItems() { + return subscriptionItems; + } + + public List getDiscounts() { + return discounts; + } + + public List getItemTiers() { + return itemTiers; + } + + public List getCoupons() { + return coupons; + } + + public Map customFields() { + return customFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.name != null) { + + formData.put("name", this.name); + } + + if (this.notes != null) { + + formData.put("notes", this.notes); + } + + if (this.expiresAt != null) { + + formData.put("expires_at", this.expiresAt); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.mandatoryItemsToRemove != null) { + + formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.billingStartOption != null) { + + formData.put("billing_start_option", this.billingStartOption); + } + + if (this.netTermDays != null) { + + formData.put("net_term_days", this.netTermDays); + } + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.billingAddress != null) { + + // Single object + Map nestedData = this.billingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.subscriptionItems != null) { + + // List of objects + for (int i = 0; i < this.subscriptionItems.size(); i++) { + SubscriptionItemsParams item = this.subscriptionItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discounts != null) { + + // List of objects + for (int i = 0; i < this.discounts.size(); i++) { + DiscountsParams item = this.discounts.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.coupons != null) { + + // List of objects + for (int i = 0; i < this.coupons.size(); i++) { + CouponsParams item = this.coupons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(customFields); + + return formData; + } + + /** Create a new builder for CreateSubscriptionItemsForCustomerQuoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreateSubscriptionItemsForCustomerQuoteBuilder builder() { + return new CreateSubscriptionItemsForCustomerQuoteBuilder(); + } + + public static final class CreateSubscriptionItemsForCustomerQuoteBuilder { + + private String name; + + private String notes; + + private Timestamp expiresAt; + + private Integer billingCycles; + + private List mandatoryItemsToRemove; + + private Integer termsToCharge; + + private BillingAlignmentMode billingAlignmentMode; + + private List couponIds; + + private BillingStartOption billingStartOption; + + private Integer netTermDays; + + private SubscriptionParams subscription; + + private ShippingAddressParams shippingAddress; + + private ContractTermParams contractTerm; + + private BillingAddressParams billingAddress; + + private List subscriptionItems; + + private List discounts; + + private List itemTiers; + + private List coupons; + + private Map customFields = new LinkedHashMap<>(); + + private CreateSubscriptionItemsForCustomerQuoteBuilder() {} + + public CreateSubscriptionItemsForCustomerQuoteBuilder name(String value) { + this.name = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder notes(String value) { + this.notes = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder expiresAt(Timestamp value) { + this.expiresAt = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder mandatoryItemsToRemove( + List value) { + this.mandatoryItemsToRemove = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder billingAlignmentMode( + BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder billingStartOption( + BillingStartOption value) { + this.billingStartOption = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder netTermDays(Integer value) { + this.netTermDays = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder subscription(SubscriptionParams value) { + this.subscription = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder shippingAddress( + ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder billingAddress( + BillingAddressParams value) { + this.billingAddress = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder subscriptionItems( + List value) { + this.subscriptionItems = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder discounts(List value) { + this.discounts = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder itemTiers(List value) { + this.itemTiers = value; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteBuilder coupons(List value) { + this.coupons = value; + return this; + } + + /** + * Add a custom field to the request. Custom fields must start with "cf_". + * + * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") + * @param value the value of the custom field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cf_" + */ + public CreateSubscriptionItemsForCustomerQuoteBuilder customField( + String fieldName, String value) { + if (fieldName == null || !fieldName.startsWith("cf_")) { + throw new IllegalArgumentException("Custom field name must start with 'cf_'"); + } + this.customFields.put(fieldName, value); + return this; + } + + /** + * Add multiple custom fields to the request. All field names must start with "cf_". + * + * @param customFields map of custom field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cf_" + */ + public CreateSubscriptionItemsForCustomerQuoteBuilder customFields( + Map customFields) { + if (customFields != null) { + for (Map.Entry entry : customFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { + throw new IllegalArgumentException( + "Custom field name must start with 'cf_': " + entry.getKey()); + } + this.customFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteParams build() { + return new CreateSubscriptionItemsForCustomerQuoteParams(this); + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum BillingStartOption { + IMMEDIATELY("immediately"), + + ON_SPECIFIC_DATE("on_specific_date"), + + /** An enum member indicating that BillingStartOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + BillingStartOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingStartOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingStartOption enumValue : BillingStartOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionParams { + + private final String id; + + private final String poNumber; + + private final Timestamp trialEnd; + + private final Long setupFee; + + private final Timestamp startDate; + + private final OfflinePaymentMethod offlinePaymentMethod; + + private final Integer contractTermBillingCycleOnRenewal; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.id = builder.id; + + this.poNumber = builder.poNumber; + + this.trialEnd = builder.trialEnd; + + this.setupFee = builder.setupFee; + + this.startDate = builder.startDate; + + this.offlinePaymentMethod = builder.offlinePaymentMethod; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + } + + public String getId() { + return id; + } + + public String getPoNumber() { + return poNumber; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Long getSetupFee() { + return setupFee; + } + + public Timestamp getStartDate() { + return startDate; + } + + public OfflinePaymentMethod getOfflinePaymentMethod() { + return offlinePaymentMethod; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.offlinePaymentMethod != null) { + + formData.put("offline_payment_method", this.offlinePaymentMethod); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private String id; + + private String poNumber; + + private Timestamp trialEnd; + + private Long setupFee; + + private Timestamp startDate; + + private OfflinePaymentMethod offlinePaymentMethod; + + private Integer contractTermBillingCycleOnRenewal; + + private SubscriptionBuilder() {} + + public SubscriptionBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public SubscriptionBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + @Deprecated + public SubscriptionBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + this.offlinePaymentMethod = value; + return this; + } + + public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class BillingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private BillingAddressParams(BillingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for BillingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingAddressBuilder builder() { + return new BillingAddressBuilder(); + } + + public static final class BillingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private BillingAddressBuilder() {} + + public BillingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public BillingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public BillingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public BillingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public BillingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public BillingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public BillingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public BillingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public BillingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public BillingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public BillingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public BillingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public BillingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public BillingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public BillingAddressParams build() { + return new BillingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class SubscriptionItemsParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Timestamp trialEnd; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ItemType itemType; + + private final ChargeOnOption chargeOnOption; + + private final Timestamp startDate; + + private final Timestamp endDate; + + private final String rampTierId; + + private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.trialEnd = builder.trialEnd; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.itemType = builder.itemType; + + this.chargeOnOption = builder.chargeOnOption; + + this.startDate = builder.startDate; + + this.endDate = builder.endDate; + + this.rampTierId = builder.rampTierId; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ItemType getItemType() { + return itemType; + } + + public ChargeOnOption getChargeOnOption() { + return chargeOnOption; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getEndDate() { + return endDate; + } + + public String getRampTierId() { + return rampTierId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.itemType != null) { + + formData.put("item_type", this.itemType); + } + + if (this.chargeOnOption != null) { + + formData.put("charge_on_option", this.chargeOnOption); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + if (this.rampTierId != null) { + + formData.put("ramp_tier_id", this.rampTierId); + } + + return formData; + } + + /** Create a new builder for SubscriptionItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionItemsBuilder builder() { + return new SubscriptionItemsBuilder(); + } + + public static final class SubscriptionItemsBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Timestamp trialEnd; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ItemType itemType; + + private ChargeOnOption chargeOnOption; + + private Timestamp startDate; + + private Timestamp endDate; + + private String rampTierId; + + private SubscriptionItemsBuilder() {} + + public SubscriptionItemsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public SubscriptionItemsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public SubscriptionItemsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public SubscriptionItemsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public SubscriptionItemsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionItemsBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public SubscriptionItemsBuilder itemType(ItemType value) { + this.itemType = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { + this.chargeOnOption = value; + return this; + } + + public SubscriptionItemsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionItemsBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public SubscriptionItemsBuilder rampTierId(String value) { + this.rampTierId = value; + return this; + } + + public SubscriptionItemsParams build() { + return new SubscriptionItemsParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ItemType { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemType enumValue : ItemType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnOption { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnOption enumValue : ChargeOnOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class DiscountsParams { + + private final ApplyOn applyOn; + + private final DurationType durationType; + + private final Number percentage; + + private final Long amount; + + private final Integer period; + + private final PeriodUnit periodUnit; + + private final Boolean includedInMrr; + + private final String itemPriceId; + + private final Integer quantity; + + private final Timestamp startDate; + + private final Timestamp endDate; + + private DiscountsParams(DiscountsBuilder builder) { + + this.applyOn = builder.applyOn; + + this.durationType = builder.durationType; + + this.percentage = builder.percentage; + + this.amount = builder.amount; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + + this.includedInMrr = builder.includedInMrr; + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.startDate = builder.startDate; + + this.endDate = builder.endDate; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public DurationType getDurationType() { + return durationType; + } + + public Number getPercentage() { + return percentage; + } + + public Long getAmount() { + return amount; + } + + public Integer getPeriod() { + return period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public Boolean getIncludedInMrr() { + return includedInMrr; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getEndDate() { + return endDate; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.durationType != null) { + + formData.put("duration_type", this.durationType); + } + + if (this.percentage != null) { + + formData.put("percentage", this.percentage); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.includedInMrr != null) { + + formData.put("included_in_mrr", this.includedInMrr); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + return formData; + } + + /** Create a new builder for DiscountsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsBuilder builder() { + return new DiscountsBuilder(); + } + + public static final class DiscountsBuilder { + + private ApplyOn applyOn; + + private DurationType durationType; + + private Number percentage; + + private Long amount; + + private Integer period; + + private PeriodUnit periodUnit; + + private Boolean includedInMrr; + + private String itemPriceId; + + private Integer quantity; + + private Timestamp startDate; + + private Timestamp endDate; + + private DiscountsBuilder() {} + + public DiscountsBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public DiscountsBuilder durationType(DurationType value) { + this.durationType = value; + return this; + } + + public DiscountsBuilder percentage(Number value) { + this.percentage = value; + return this; + } + + public DiscountsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsBuilder period(Integer value) { + this.period = value; + return this; + } + + public DiscountsBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public DiscountsBuilder includedInMrr(Boolean value) { + this.includedInMrr = value; + return this; + } + + public DiscountsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DiscountsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public DiscountsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public DiscountsBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public DiscountsParams build() { + return new DiscountsParams(this); + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIC_ITEM_PRICE("specific_item_price"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum DurationType { + ONE_TIME("one_time"), + + FOREVER("forever"), + + LIMITED_PERIOD("limited_period"), + + /** An enum member indicating that DurationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DurationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DurationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DurationType enumValue : DurationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemTiersParams { + + private final String itemPriceId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private final String rampTierId; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + + this.rampTierId = builder.rampTierId; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + public String getRampTierId() { + return rampTierId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + if (this.rampTierId != null) { + + formData.put("ramp_tier_id", this.rampTierId); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private String itemPriceId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private String rampTierId; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersBuilder rampTierId(String value) { + this.rampTierId = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CouponsParams { + + private final String id; + + private final Timestamp startDate; + + private final Timestamp endDate; + + private CouponsParams(CouponsBuilder builder) { + + this.id = builder.id; + + this.startDate = builder.startDate; + + this.endDate = builder.endDate; + } + + public String getId() { + return id; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getEndDate() { + return endDate; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + return formData; + } + + /** Create a new builder for CouponsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponsBuilder builder() { + return new CouponsBuilder(); + } + + public static final class CouponsBuilder { + + private String id; + + private Timestamp startDate; + + private Timestamp endDate; + + private CouponsBuilder() {} + + public CouponsBuilder id(String value) { + this.id = value; + return this; + } + + public CouponsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public CouponsBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public CouponsParams build() { + return new CouponsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionQuoteForCustomerParams.java b/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionQuoteForCustomerParams.java deleted file mode 100644 index b0a88d69..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionQuoteForCustomerParams.java +++ /dev/null @@ -1,1567 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class CreateSubscriptionQuoteForCustomerParams { - - private final String name; - - private final String notes; - - private final Timestamp expiresAt; - - private final Integer billingCycles; - - private final List mandatoryAddonsToRemove; - - private final Integer termsToCharge; - - private final BillingAlignmentMode billingAlignmentMode; - - private final List couponIds; - - private final SubscriptionParams subscription; - - private final ShippingAddressParams shippingAddress; - - private final ContractTermParams contractTerm; - - private final List addons; - - private final List eventBasedAddons; - - private CreateSubscriptionQuoteForCustomerParams( - CreateSubscriptionQuoteForCustomerBuilder builder) { - - this.name = builder.name; - - this.notes = builder.notes; - - this.expiresAt = builder.expiresAt; - - this.billingCycles = builder.billingCycles; - - this.mandatoryAddonsToRemove = builder.mandatoryAddonsToRemove; - - this.termsToCharge = builder.termsToCharge; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.couponIds = builder.couponIds; - - this.subscription = builder.subscription; - - this.shippingAddress = builder.shippingAddress; - - this.contractTerm = builder.contractTerm; - - this.addons = builder.addons; - - this.eventBasedAddons = builder.eventBasedAddons; - } - - public String getName() { - return name; - } - - public String getNotes() { - return notes; - } - - public Timestamp getExpiresAt() { - return expiresAt; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public List getMandatoryAddonsToRemove() { - return mandatoryAddonsToRemove; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public List getCouponIds() { - return couponIds; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public List getAddons() { - return addons; - } - - public List getEventBasedAddons() { - return eventBasedAddons; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.name != null) { - - formData.put("name", this.name); - } - - if (this.notes != null) { - - formData.put("notes", this.notes); - } - - if (this.expiresAt != null) { - - formData.put("expires_at", this.expiresAt); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.mandatoryAddonsToRemove != null) { - - formData.put("mandatory_addons_to_remove", this.mandatoryAddonsToRemove); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.addons != null) { - - // List of objects - for (int i = 0; i < this.addons.size(); i++) { - AddonsParams item = this.addons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.eventBasedAddons != null) { - - // List of objects - for (int i = 0; i < this.eventBasedAddons.size(); i++) { - EventBasedAddonsParams item = this.eventBasedAddons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for CreateSubscriptionQuoteForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreateSubscriptionQuoteForCustomerBuilder builder() { - return new CreateSubscriptionQuoteForCustomerBuilder(); - } - - public static final class CreateSubscriptionQuoteForCustomerBuilder { - - private String name; - - private String notes; - - private Timestamp expiresAt; - - private Integer billingCycles; - - private List mandatoryAddonsToRemove; - - private Integer termsToCharge; - - private BillingAlignmentMode billingAlignmentMode; - - private List couponIds; - - private SubscriptionParams subscription; - - private ShippingAddressParams shippingAddress; - - private ContractTermParams contractTerm; - - private List addons; - - private List eventBasedAddons; - - private CreateSubscriptionQuoteForCustomerBuilder() {} - - public CreateSubscriptionQuoteForCustomerBuilder name(String value) { - this.name = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder notes(String value) { - this.notes = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder expiresAt(Timestamp value) { - this.expiresAt = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder mandatoryAddonsToRemove(List value) { - this.mandatoryAddonsToRemove = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder billingAlignmentMode( - BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder subscription(SubscriptionParams value) { - this.subscription = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder shippingAddress(ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder addons(List value) { - this.addons = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerBuilder eventBasedAddons( - List value) { - this.eventBasedAddons = value; - return this; - } - - public CreateSubscriptionQuoteForCustomerParams build() { - return new CreateSubscriptionQuoteForCustomerParams(this); - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionParams { - - private final String id; - - private final String poNumber; - - private final String planId; - - private final Integer planQuantity; - - private final String planQuantityInDecimal; - - private final Long planUnitPrice; - - private final String planUnitPriceInDecimal; - - private final Long setupFee; - - private final Timestamp trialEnd; - - private final Timestamp startDate; - - private final OfflinePaymentMethod offlinePaymentMethod; - - private final Integer contractTermBillingCycleOnRenewal; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.id = builder.id; - - this.poNumber = builder.poNumber; - - this.planId = builder.planId; - - this.planQuantity = builder.planQuantity; - - this.planQuantityInDecimal = builder.planQuantityInDecimal; - - this.planUnitPrice = builder.planUnitPrice; - - this.planUnitPriceInDecimal = builder.planUnitPriceInDecimal; - - this.setupFee = builder.setupFee; - - this.trialEnd = builder.trialEnd; - - this.startDate = builder.startDate; - - this.offlinePaymentMethod = builder.offlinePaymentMethod; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - } - - public String getId() { - return id; - } - - public String getPoNumber() { - return poNumber; - } - - public String getPlanId() { - return planId; - } - - public Integer getPlanQuantity() { - return planQuantity; - } - - public String getPlanQuantityInDecimal() { - return planQuantityInDecimal; - } - - public Long getPlanUnitPrice() { - return planUnitPrice; - } - - public String getPlanUnitPriceInDecimal() { - return planUnitPriceInDecimal; - } - - public Long getSetupFee() { - return setupFee; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Timestamp getStartDate() { - return startDate; - } - - public OfflinePaymentMethod getOfflinePaymentMethod() { - return offlinePaymentMethod; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.planId != null) { - - formData.put("plan_id", this.planId); - } - - if (this.planQuantity != null) { - - formData.put("plan_quantity", this.planQuantity); - } - - if (this.planQuantityInDecimal != null) { - - formData.put("plan_quantity_in_decimal", this.planQuantityInDecimal); - } - - if (this.planUnitPrice != null) { - - formData.put("plan_unit_price", this.planUnitPrice); - } - - if (this.planUnitPriceInDecimal != null) { - - formData.put("plan_unit_price_in_decimal", this.planUnitPriceInDecimal); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.offlinePaymentMethod != null) { - - formData.put("offline_payment_method", this.offlinePaymentMethod); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private String id; - - private String poNumber; - - private String planId; - - private Integer planQuantity; - - private String planQuantityInDecimal; - - private Long planUnitPrice; - - private String planUnitPriceInDecimal; - - private Long setupFee; - - private Timestamp trialEnd; - - private Timestamp startDate; - - private OfflinePaymentMethod offlinePaymentMethod; - - private Integer contractTermBillingCycleOnRenewal; - - private SubscriptionBuilder() {} - - public SubscriptionBuilder id(String value) { - this.id = value; - return this; - } - - public SubscriptionBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public SubscriptionBuilder planId(String value) { - this.planId = value; - return this; - } - - public SubscriptionBuilder planQuantity(Integer value) { - this.planQuantity = value; - return this; - } - - public SubscriptionBuilder planQuantityInDecimal(String value) { - this.planQuantityInDecimal = value; - return this; - } - - public SubscriptionBuilder planUnitPrice(Long value) { - this.planUnitPrice = value; - return this; - } - - public SubscriptionBuilder planUnitPriceInDecimal(String value) { - this.planUnitPriceInDecimal = value; - return this; - } - - public SubscriptionBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public SubscriptionBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - this.offlinePaymentMethod = value; - return this; - } - - public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class AddonsParams { - - private final String id; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Timestamp trialEnd; - - private AddonsParams(AddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.trialEnd = builder.trialEnd; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - return formData; - } - - /** Create a new builder for AddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddonsBuilder builder() { - return new AddonsBuilder(); - } - - public static final class AddonsBuilder { - - private String id; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Timestamp trialEnd; - - private AddonsBuilder() {} - - public AddonsBuilder id(String value) { - this.id = value; - return this; - } - - public AddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public AddonsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public AddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public AddonsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public AddonsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public AddonsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public AddonsParams build() { - return new AddonsParams(this); - } - } - } - - public static final class EventBasedAddonsParams { - - private final String id; - - private final Integer quantity; - - private final Long unitPrice; - - private final String quantityInDecimal; - - private final String unitPriceInDecimal; - - private final Integer servicePeriodInDays; - - private final OnEvent onEvent; - - private final Boolean chargeOnce; - - private final ChargeOn chargeOn; - - private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.unitPrice = builder.unitPrice; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.servicePeriodInDays = builder.servicePeriodInDays; - - this.onEvent = builder.onEvent; - - this.chargeOnce = builder.chargeOnce; - - this.chargeOn = builder.chargeOn; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getServicePeriodInDays() { - return servicePeriodInDays; - } - - public OnEvent getOnEvent() { - return onEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ChargeOn getChargeOn() { - return chargeOn; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.servicePeriodInDays != null) { - - formData.put("service_period_in_days", this.servicePeriodInDays); - } - - if (this.onEvent != null) { - - formData.put("on_event", this.onEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.chargeOn != null) { - - formData.put("charge_on", this.chargeOn); - } - - return formData; - } - - /** Create a new builder for EventBasedAddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EventBasedAddonsBuilder builder() { - return new EventBasedAddonsBuilder(); - } - - public static final class EventBasedAddonsBuilder { - - private String id; - - private Integer quantity; - - private Long unitPrice; - - private String quantityInDecimal; - - private String unitPriceInDecimal; - - private Integer servicePeriodInDays; - - private OnEvent onEvent; - - private Boolean chargeOnce; - - private ChargeOn chargeOn; - - private EventBasedAddonsBuilder() {} - - public EventBasedAddonsBuilder id(String value) { - this.id = value; - return this; - } - - public EventBasedAddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public EventBasedAddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public EventBasedAddonsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public EventBasedAddonsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { - this.servicePeriodInDays = value; - return this; - } - - public EventBasedAddonsBuilder onEvent(OnEvent value) { - this.onEvent = value; - return this; - } - - public EventBasedAddonsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public EventBasedAddonsBuilder chargeOn(ChargeOn value) { - this.chargeOn = value; - return this; - } - - public EventBasedAddonsParams build() { - return new EventBasedAddonsParams(this); - } - } - - public enum OnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that OnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - OnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (OnEvent enumValue : OnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOn { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOn enumValue : ChargeOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionQuoteForItemsForCustomerParams.java b/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionQuoteForItemsForCustomerParams.java deleted file mode 100644 index 21e99991..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/CreateSubscriptionQuoteForItemsForCustomerParams.java +++ /dev/null @@ -1,2689 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class CreateSubscriptionQuoteForItemsForCustomerParams { - - private final String name; - - private final String notes; - - private final Timestamp expiresAt; - - private final Integer billingCycles; - - private final List mandatoryItemsToRemove; - - private final Integer termsToCharge; - - private final BillingAlignmentMode billingAlignmentMode; - - private final List couponIds; - - private final BillingStartOption billingStartOption; - - private final Integer netTermDays; - - private final SubscriptionParams subscription; - - private final ShippingAddressParams shippingAddress; - - private final ContractTermParams contractTerm; - - private final BillingAddressParams billingAddress; - - private final List subscriptionItems; - - private final List discounts; - - private final List itemTiers; - - private final List coupons; - - private final Map customFields; - - private CreateSubscriptionQuoteForItemsForCustomerParams( - CreateSubscriptionQuoteForItemsForCustomerBuilder builder) { - - this.name = builder.name; - - this.notes = builder.notes; - - this.expiresAt = builder.expiresAt; - - this.billingCycles = builder.billingCycles; - - this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; - - this.termsToCharge = builder.termsToCharge; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.couponIds = builder.couponIds; - - this.billingStartOption = builder.billingStartOption; - - this.netTermDays = builder.netTermDays; - - this.subscription = builder.subscription; - - this.shippingAddress = builder.shippingAddress; - - this.contractTerm = builder.contractTerm; - - this.billingAddress = builder.billingAddress; - - this.subscriptionItems = builder.subscriptionItems; - - this.discounts = builder.discounts; - - this.itemTiers = builder.itemTiers; - - this.coupons = builder.coupons; - - this.customFields = - builder.customFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); - } - - public String getName() { - return name; - } - - public String getNotes() { - return notes; - } - - public Timestamp getExpiresAt() { - return expiresAt; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public List getMandatoryItemsToRemove() { - return mandatoryItemsToRemove; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public List getCouponIds() { - return couponIds; - } - - public BillingStartOption getBillingStartOption() { - return billingStartOption; - } - - public Integer getNetTermDays() { - return netTermDays; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public BillingAddressParams getBillingAddress() { - return billingAddress; - } - - public List getSubscriptionItems() { - return subscriptionItems; - } - - public List getDiscounts() { - return discounts; - } - - public List getItemTiers() { - return itemTiers; - } - - public List getCoupons() { - return coupons; - } - - public Map customFields() { - return customFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.name != null) { - - formData.put("name", this.name); - } - - if (this.notes != null) { - - formData.put("notes", this.notes); - } - - if (this.expiresAt != null) { - - formData.put("expires_at", this.expiresAt); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.mandatoryItemsToRemove != null) { - - formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.billingStartOption != null) { - - formData.put("billing_start_option", this.billingStartOption); - } - - if (this.netTermDays != null) { - - formData.put("net_term_days", this.netTermDays); - } - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.billingAddress != null) { - - // Single object - Map nestedData = this.billingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.subscriptionItems != null) { - - // List of objects - for (int i = 0; i < this.subscriptionItems.size(); i++) { - SubscriptionItemsParams item = this.subscriptionItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discounts != null) { - - // List of objects - for (int i = 0; i < this.discounts.size(); i++) { - DiscountsParams item = this.discounts.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.coupons != null) { - - // List of objects - for (int i = 0; i < this.coupons.size(); i++) { - CouponsParams item = this.coupons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(customFields); - - return formData; - } - - /** Create a new builder for CreateSubscriptionQuoteForItemsForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreateSubscriptionQuoteForItemsForCustomerBuilder builder() { - return new CreateSubscriptionQuoteForItemsForCustomerBuilder(); - } - - public static final class CreateSubscriptionQuoteForItemsForCustomerBuilder { - - private String name; - - private String notes; - - private Timestamp expiresAt; - - private Integer billingCycles; - - private List mandatoryItemsToRemove; - - private Integer termsToCharge; - - private BillingAlignmentMode billingAlignmentMode; - - private List couponIds; - - private BillingStartOption billingStartOption; - - private Integer netTermDays; - - private SubscriptionParams subscription; - - private ShippingAddressParams shippingAddress; - - private ContractTermParams contractTerm; - - private BillingAddressParams billingAddress; - - private List subscriptionItems; - - private List discounts; - - private List itemTiers; - - private List coupons; - - private Map customFields = new LinkedHashMap<>(); - - private CreateSubscriptionQuoteForItemsForCustomerBuilder() {} - - public CreateSubscriptionQuoteForItemsForCustomerBuilder name(String value) { - this.name = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder notes(String value) { - this.notes = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder expiresAt(Timestamp value) { - this.expiresAt = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder mandatoryItemsToRemove( - List value) { - this.mandatoryItemsToRemove = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder billingAlignmentMode( - BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder billingStartOption( - BillingStartOption value) { - this.billingStartOption = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder netTermDays(Integer value) { - this.netTermDays = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder subscription( - SubscriptionParams value) { - this.subscription = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder shippingAddress( - ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder contractTerm( - ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder billingAddress( - BillingAddressParams value) { - this.billingAddress = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder subscriptionItems( - List value) { - this.subscriptionItems = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder discounts( - List value) { - this.discounts = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder itemTiers( - List value) { - this.itemTiers = value; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerBuilder coupons(List value) { - this.coupons = value; - return this; - } - - /** - * Add a custom field to the request. Custom fields must start with "cf_". - * - * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") - * @param value the value of the custom field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cf_" - */ - public CreateSubscriptionQuoteForItemsForCustomerBuilder customField( - String fieldName, String value) { - if (fieldName == null || !fieldName.startsWith("cf_")) { - throw new IllegalArgumentException("Custom field name must start with 'cf_'"); - } - this.customFields.put(fieldName, value); - return this; - } - - /** - * Add multiple custom fields to the request. All field names must start with "cf_". - * - * @param customFields map of custom field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cf_" - */ - public CreateSubscriptionQuoteForItemsForCustomerBuilder customFields( - Map customFields) { - if (customFields != null) { - for (Map.Entry entry : customFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { - throw new IllegalArgumentException( - "Custom field name must start with 'cf_': " + entry.getKey()); - } - this.customFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerParams build() { - return new CreateSubscriptionQuoteForItemsForCustomerParams(this); - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum BillingStartOption { - IMMEDIATELY("immediately"), - - ON_SPECIFIC_DATE("on_specific_date"), - - /** An enum member indicating that BillingStartOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - BillingStartOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingStartOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingStartOption enumValue : BillingStartOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionParams { - - private final String id; - - private final String poNumber; - - private final Timestamp trialEnd; - - private final Long setupFee; - - private final Timestamp startDate; - - private final OfflinePaymentMethod offlinePaymentMethod; - - private final Integer contractTermBillingCycleOnRenewal; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.id = builder.id; - - this.poNumber = builder.poNumber; - - this.trialEnd = builder.trialEnd; - - this.setupFee = builder.setupFee; - - this.startDate = builder.startDate; - - this.offlinePaymentMethod = builder.offlinePaymentMethod; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - } - - public String getId() { - return id; - } - - public String getPoNumber() { - return poNumber; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Long getSetupFee() { - return setupFee; - } - - public Timestamp getStartDate() { - return startDate; - } - - public OfflinePaymentMethod getOfflinePaymentMethod() { - return offlinePaymentMethod; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.offlinePaymentMethod != null) { - - formData.put("offline_payment_method", this.offlinePaymentMethod); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private String id; - - private String poNumber; - - private Timestamp trialEnd; - - private Long setupFee; - - private Timestamp startDate; - - private OfflinePaymentMethod offlinePaymentMethod; - - private Integer contractTermBillingCycleOnRenewal; - - private SubscriptionBuilder() {} - - public SubscriptionBuilder id(String value) { - this.id = value; - return this; - } - - public SubscriptionBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public SubscriptionBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - @Deprecated - public SubscriptionBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public SubscriptionBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - this.offlinePaymentMethod = value; - return this; - } - - public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class BillingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private BillingAddressParams(BillingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for BillingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingAddressBuilder builder() { - return new BillingAddressBuilder(); - } - - public static final class BillingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private BillingAddressBuilder() {} - - public BillingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public BillingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public BillingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public BillingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public BillingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public BillingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public BillingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public BillingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public BillingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public BillingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public BillingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public BillingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public BillingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public BillingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public BillingAddressParams build() { - return new BillingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class SubscriptionItemsParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Timestamp trialEnd; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ItemType itemType; - - private final ChargeOnOption chargeOnOption; - - private final Timestamp startDate; - - private final Timestamp endDate; - - private final String rampTierId; - - private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.trialEnd = builder.trialEnd; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.itemType = builder.itemType; - - this.chargeOnOption = builder.chargeOnOption; - - this.startDate = builder.startDate; - - this.endDate = builder.endDate; - - this.rampTierId = builder.rampTierId; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ItemType getItemType() { - return itemType; - } - - public ChargeOnOption getChargeOnOption() { - return chargeOnOption; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getEndDate() { - return endDate; - } - - public String getRampTierId() { - return rampTierId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.itemType != null) { - - formData.put("item_type", this.itemType); - } - - if (this.chargeOnOption != null) { - - formData.put("charge_on_option", this.chargeOnOption); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - if (this.rampTierId != null) { - - formData.put("ramp_tier_id", this.rampTierId); - } - - return formData; - } - - /** Create a new builder for SubscriptionItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionItemsBuilder builder() { - return new SubscriptionItemsBuilder(); - } - - public static final class SubscriptionItemsBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Timestamp trialEnd; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ItemType itemType; - - private ChargeOnOption chargeOnOption; - - private Timestamp startDate; - - private Timestamp endDate; - - private String rampTierId; - - private SubscriptionItemsBuilder() {} - - public SubscriptionItemsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public SubscriptionItemsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public SubscriptionItemsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public SubscriptionItemsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public SubscriptionItemsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionItemsBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public SubscriptionItemsBuilder itemType(ItemType value) { - this.itemType = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { - this.chargeOnOption = value; - return this; - } - - public SubscriptionItemsBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public SubscriptionItemsBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public SubscriptionItemsBuilder rampTierId(String value) { - this.rampTierId = value; - return this; - } - - public SubscriptionItemsParams build() { - return new SubscriptionItemsParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ItemType { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemType enumValue : ItemType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnOption { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnOption enumValue : ChargeOnOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class DiscountsParams { - - private final ApplyOn applyOn; - - private final DurationType durationType; - - private final Number percentage; - - private final Long amount; - - private final Integer period; - - private final PeriodUnit periodUnit; - - private final Boolean includedInMrr; - - private final String itemPriceId; - - private final Integer quantity; - - private final Timestamp startDate; - - private final Timestamp endDate; - - private DiscountsParams(DiscountsBuilder builder) { - - this.applyOn = builder.applyOn; - - this.durationType = builder.durationType; - - this.percentage = builder.percentage; - - this.amount = builder.amount; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - - this.includedInMrr = builder.includedInMrr; - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.startDate = builder.startDate; - - this.endDate = builder.endDate; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public DurationType getDurationType() { - return durationType; - } - - public Number getPercentage() { - return percentage; - } - - public Long getAmount() { - return amount; - } - - public Integer getPeriod() { - return period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public Boolean getIncludedInMrr() { - return includedInMrr; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getEndDate() { - return endDate; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.durationType != null) { - - formData.put("duration_type", this.durationType); - } - - if (this.percentage != null) { - - formData.put("percentage", this.percentage); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.includedInMrr != null) { - - formData.put("included_in_mrr", this.includedInMrr); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - return formData; - } - - /** Create a new builder for DiscountsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsBuilder builder() { - return new DiscountsBuilder(); - } - - public static final class DiscountsBuilder { - - private ApplyOn applyOn; - - private DurationType durationType; - - private Number percentage; - - private Long amount; - - private Integer period; - - private PeriodUnit periodUnit; - - private Boolean includedInMrr; - - private String itemPriceId; - - private Integer quantity; - - private Timestamp startDate; - - private Timestamp endDate; - - private DiscountsBuilder() {} - - public DiscountsBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public DiscountsBuilder durationType(DurationType value) { - this.durationType = value; - return this; - } - - public DiscountsBuilder percentage(Number value) { - this.percentage = value; - return this; - } - - public DiscountsBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsBuilder period(Integer value) { - this.period = value; - return this; - } - - public DiscountsBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public DiscountsBuilder includedInMrr(Boolean value) { - this.includedInMrr = value; - return this; - } - - public DiscountsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DiscountsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public DiscountsBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public DiscountsBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public DiscountsParams build() { - return new DiscountsParams(this); - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIC_ITEM_PRICE("specific_item_price"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum DurationType { - ONE_TIME("one_time"), - - FOREVER("forever"), - - LIMITED_PERIOD("limited_period"), - - /** An enum member indicating that DurationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DurationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DurationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DurationType enumValue : DurationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemTiersParams { - - private final String itemPriceId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private final String rampTierId; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - - this.rampTierId = builder.rampTierId; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - public String getRampTierId() { - return rampTierId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - if (this.rampTierId != null) { - - formData.put("ramp_tier_id", this.rampTierId); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private String itemPriceId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private String rampTierId; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersBuilder rampTierId(String value) { - this.rampTierId = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CouponsParams { - - private final String id; - - private final Timestamp startDate; - - private final Timestamp endDate; - - private CouponsParams(CouponsBuilder builder) { - - this.id = builder.id; - - this.startDate = builder.startDate; - - this.endDate = builder.endDate; - } - - public String getId() { - return id; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getEndDate() { - return endDate; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - return formData; - } - - /** Create a new builder for CouponsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CouponsBuilder builder() { - return new CouponsBuilder(); - } - - public static final class CouponsBuilder { - - private String id; - - private Timestamp startDate; - - private Timestamp endDate; - - private CouponsBuilder() {} - - public CouponsBuilder id(String value) { - this.id = value; - return this; - } - - public CouponsBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public CouponsBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public CouponsParams build() { - return new CouponsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/DeleteQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/DeleteQuoteParams.java deleted file mode 100644 index 796e7992..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/DeleteQuoteParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteQuoteParams { - - private final String comment; - - private DeleteQuoteParams(DeleteQuoteBuilder builder) { - - this.comment = builder.comment; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for DeleteQuoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteQuoteBuilder builder() { - return new DeleteQuoteBuilder(); - } - - public static final class DeleteQuoteBuilder { - - private String comment; - - private DeleteQuoteBuilder() {} - - public DeleteQuoteBuilder comment(String value) { - this.comment = value; - return this; - } - - public DeleteQuoteParams build() { - return new DeleteQuoteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionCustomerQuoteForItemsParams.java b/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionCustomerQuoteForItemsParams.java new file mode 100644 index 00000000..26e467b5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionCustomerQuoteForItemsParams.java @@ -0,0 +1,2669 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class EditCreateSubscriptionCustomerQuoteForItemsParams { + + private final String notes; + + private final Timestamp expiresAt; + + private final Integer billingCycles; + + private final List mandatoryItemsToRemove; + + private final Integer termsToCharge; + + private final BillingAlignmentMode billingAlignmentMode; + + private final List couponIds; + + private final BillingStartOption billingStartOption; + + private final Integer netTermDays; + + private final SubscriptionParams subscription; + + private final ShippingAddressParams shippingAddress; + + private final ContractTermParams contractTerm; + + private final BillingAddressParams billingAddress; + + private final List subscriptionItems; + + private final List discounts; + + private final List itemTiers; + + private final List coupons; + + private final Map customFields; + + private EditCreateSubscriptionCustomerQuoteForItemsParams( + EditCreateSubscriptionCustomerQuoteForItemsBuilder builder) { + + this.notes = builder.notes; + + this.expiresAt = builder.expiresAt; + + this.billingCycles = builder.billingCycles; + + this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; + + this.termsToCharge = builder.termsToCharge; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.couponIds = builder.couponIds; + + this.billingStartOption = builder.billingStartOption; + + this.netTermDays = builder.netTermDays; + + this.subscription = builder.subscription; + + this.shippingAddress = builder.shippingAddress; + + this.contractTerm = builder.contractTerm; + + this.billingAddress = builder.billingAddress; + + this.subscriptionItems = builder.subscriptionItems; + + this.discounts = builder.discounts; + + this.itemTiers = builder.itemTiers; + + this.coupons = builder.coupons; + + this.customFields = + builder.customFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); + } + + public String getNotes() { + return notes; + } + + public Timestamp getExpiresAt() { + return expiresAt; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public List getMandatoryItemsToRemove() { + return mandatoryItemsToRemove; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public List getCouponIds() { + return couponIds; + } + + public BillingStartOption getBillingStartOption() { + return billingStartOption; + } + + public Integer getNetTermDays() { + return netTermDays; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public BillingAddressParams getBillingAddress() { + return billingAddress; + } + + public List getSubscriptionItems() { + return subscriptionItems; + } + + public List getDiscounts() { + return discounts; + } + + public List getItemTiers() { + return itemTiers; + } + + public List getCoupons() { + return coupons; + } + + public Map customFields() { + return customFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.notes != null) { + + formData.put("notes", this.notes); + } + + if (this.expiresAt != null) { + + formData.put("expires_at", this.expiresAt); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.mandatoryItemsToRemove != null) { + + formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.billingStartOption != null) { + + formData.put("billing_start_option", this.billingStartOption); + } + + if (this.netTermDays != null) { + + formData.put("net_term_days", this.netTermDays); + } + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.billingAddress != null) { + + // Single object + Map nestedData = this.billingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.subscriptionItems != null) { + + // List of objects + for (int i = 0; i < this.subscriptionItems.size(); i++) { + SubscriptionItemsParams item = this.subscriptionItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discounts != null) { + + // List of objects + for (int i = 0; i < this.discounts.size(); i++) { + DiscountsParams item = this.discounts.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.coupons != null) { + + // List of objects + for (int i = 0; i < this.coupons.size(); i++) { + CouponsParams item = this.coupons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(customFields); + + return formData; + } + + /** Create a new builder for EditCreateSubscriptionCustomerQuoteForItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EditCreateSubscriptionCustomerQuoteForItemsBuilder builder() { + return new EditCreateSubscriptionCustomerQuoteForItemsBuilder(); + } + + public static final class EditCreateSubscriptionCustomerQuoteForItemsBuilder { + + private String notes; + + private Timestamp expiresAt; + + private Integer billingCycles; + + private List mandatoryItemsToRemove; + + private Integer termsToCharge; + + private BillingAlignmentMode billingAlignmentMode; + + private List couponIds; + + private BillingStartOption billingStartOption; + + private Integer netTermDays; + + private SubscriptionParams subscription; + + private ShippingAddressParams shippingAddress; + + private ContractTermParams contractTerm; + + private BillingAddressParams billingAddress; + + private List subscriptionItems; + + private List discounts; + + private List itemTiers; + + private List coupons; + + private Map customFields = new LinkedHashMap<>(); + + private EditCreateSubscriptionCustomerQuoteForItemsBuilder() {} + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder notes(String value) { + this.notes = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder expiresAt(Timestamp value) { + this.expiresAt = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder mandatoryItemsToRemove( + List value) { + this.mandatoryItemsToRemove = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder billingAlignmentMode( + BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder billingStartOption( + BillingStartOption value) { + this.billingStartOption = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder netTermDays(Integer value) { + this.netTermDays = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder subscription( + SubscriptionParams value) { + this.subscription = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder shippingAddress( + ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder contractTerm( + ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder billingAddress( + BillingAddressParams value) { + this.billingAddress = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder subscriptionItems( + List value) { + this.subscriptionItems = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder discounts( + List value) { + this.discounts = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder itemTiers( + List value) { + this.itemTiers = value; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsBuilder coupons(List value) { + this.coupons = value; + return this; + } + + /** + * Add a custom field to the request. Custom fields must start with "cf_". + * + * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") + * @param value the value of the custom field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cf_" + */ + public EditCreateSubscriptionCustomerQuoteForItemsBuilder customField( + String fieldName, String value) { + if (fieldName == null || !fieldName.startsWith("cf_")) { + throw new IllegalArgumentException("Custom field name must start with 'cf_'"); + } + this.customFields.put(fieldName, value); + return this; + } + + /** + * Add multiple custom fields to the request. All field names must start with "cf_". + * + * @param customFields map of custom field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cf_" + */ + public EditCreateSubscriptionCustomerQuoteForItemsBuilder customFields( + Map customFields) { + if (customFields != null) { + for (Map.Entry entry : customFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { + throw new IllegalArgumentException( + "Custom field name must start with 'cf_': " + entry.getKey()); + } + this.customFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsParams build() { + return new EditCreateSubscriptionCustomerQuoteForItemsParams(this); + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum BillingStartOption { + IMMEDIATELY("immediately"), + + ON_SPECIFIC_DATE("on_specific_date"), + + /** An enum member indicating that BillingStartOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + BillingStartOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingStartOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingStartOption enumValue : BillingStartOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionParams { + + private final String id; + + private final String poNumber; + + private final Timestamp trialEnd; + + private final Long setupFee; + + private final Timestamp startDate; + + private final OfflinePaymentMethod offlinePaymentMethod; + + private final Integer contractTermBillingCycleOnRenewal; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.id = builder.id; + + this.poNumber = builder.poNumber; + + this.trialEnd = builder.trialEnd; + + this.setupFee = builder.setupFee; + + this.startDate = builder.startDate; + + this.offlinePaymentMethod = builder.offlinePaymentMethod; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + } + + public String getId() { + return id; + } + + public String getPoNumber() { + return poNumber; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Long getSetupFee() { + return setupFee; + } + + public Timestamp getStartDate() { + return startDate; + } + + public OfflinePaymentMethod getOfflinePaymentMethod() { + return offlinePaymentMethod; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.offlinePaymentMethod != null) { + + formData.put("offline_payment_method", this.offlinePaymentMethod); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private String id; + + private String poNumber; + + private Timestamp trialEnd; + + private Long setupFee; + + private Timestamp startDate; + + private OfflinePaymentMethod offlinePaymentMethod; + + private Integer contractTermBillingCycleOnRenewal; + + private SubscriptionBuilder() {} + + public SubscriptionBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public SubscriptionBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + @Deprecated + public SubscriptionBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + this.offlinePaymentMethod = value; + return this; + } + + public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class BillingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private BillingAddressParams(BillingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for BillingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingAddressBuilder builder() { + return new BillingAddressBuilder(); + } + + public static final class BillingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private BillingAddressBuilder() {} + + public BillingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public BillingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public BillingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public BillingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public BillingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public BillingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public BillingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public BillingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public BillingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public BillingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public BillingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public BillingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public BillingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public BillingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public BillingAddressParams build() { + return new BillingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class SubscriptionItemsParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Timestamp trialEnd; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ItemType itemType; + + private final ChargeOnOption chargeOnOption; + + private final Timestamp startDate; + + private final Timestamp endDate; + + private final String rampTierId; + + private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.trialEnd = builder.trialEnd; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.itemType = builder.itemType; + + this.chargeOnOption = builder.chargeOnOption; + + this.startDate = builder.startDate; + + this.endDate = builder.endDate; + + this.rampTierId = builder.rampTierId; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ItemType getItemType() { + return itemType; + } + + public ChargeOnOption getChargeOnOption() { + return chargeOnOption; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getEndDate() { + return endDate; + } + + public String getRampTierId() { + return rampTierId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.itemType != null) { + + formData.put("item_type", this.itemType); + } + + if (this.chargeOnOption != null) { + + formData.put("charge_on_option", this.chargeOnOption); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + if (this.rampTierId != null) { + + formData.put("ramp_tier_id", this.rampTierId); + } + + return formData; + } + + /** Create a new builder for SubscriptionItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionItemsBuilder builder() { + return new SubscriptionItemsBuilder(); + } + + public static final class SubscriptionItemsBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Timestamp trialEnd; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ItemType itemType; + + private ChargeOnOption chargeOnOption; + + private Timestamp startDate; + + private Timestamp endDate; + + private String rampTierId; + + private SubscriptionItemsBuilder() {} + + public SubscriptionItemsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public SubscriptionItemsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public SubscriptionItemsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public SubscriptionItemsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public SubscriptionItemsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionItemsBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public SubscriptionItemsBuilder itemType(ItemType value) { + this.itemType = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { + this.chargeOnOption = value; + return this; + } + + public SubscriptionItemsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionItemsBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public SubscriptionItemsBuilder rampTierId(String value) { + this.rampTierId = value; + return this; + } + + public SubscriptionItemsParams build() { + return new SubscriptionItemsParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ItemType { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemType enumValue : ItemType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnOption { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnOption enumValue : ChargeOnOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class DiscountsParams { + + private final ApplyOn applyOn; + + private final DurationType durationType; + + private final Number percentage; + + private final Long amount; + + private final Integer period; + + private final PeriodUnit periodUnit; + + private final Boolean includedInMrr; + + private final String itemPriceId; + + private final Integer quantity; + + private final Timestamp startDate; + + private final Timestamp endDate; + + private DiscountsParams(DiscountsBuilder builder) { + + this.applyOn = builder.applyOn; + + this.durationType = builder.durationType; + + this.percentage = builder.percentage; + + this.amount = builder.amount; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + + this.includedInMrr = builder.includedInMrr; + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.startDate = builder.startDate; + + this.endDate = builder.endDate; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public DurationType getDurationType() { + return durationType; + } + + public Number getPercentage() { + return percentage; + } + + public Long getAmount() { + return amount; + } + + public Integer getPeriod() { + return period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public Boolean getIncludedInMrr() { + return includedInMrr; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getEndDate() { + return endDate; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.durationType != null) { + + formData.put("duration_type", this.durationType); + } + + if (this.percentage != null) { + + formData.put("percentage", this.percentage); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.includedInMrr != null) { + + formData.put("included_in_mrr", this.includedInMrr); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + return formData; + } + + /** Create a new builder for DiscountsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsBuilder builder() { + return new DiscountsBuilder(); + } + + public static final class DiscountsBuilder { + + private ApplyOn applyOn; + + private DurationType durationType; + + private Number percentage; + + private Long amount; + + private Integer period; + + private PeriodUnit periodUnit; + + private Boolean includedInMrr; + + private String itemPriceId; + + private Integer quantity; + + private Timestamp startDate; + + private Timestamp endDate; + + private DiscountsBuilder() {} + + public DiscountsBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public DiscountsBuilder durationType(DurationType value) { + this.durationType = value; + return this; + } + + public DiscountsBuilder percentage(Number value) { + this.percentage = value; + return this; + } + + public DiscountsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsBuilder period(Integer value) { + this.period = value; + return this; + } + + public DiscountsBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public DiscountsBuilder includedInMrr(Boolean value) { + this.includedInMrr = value; + return this; + } + + public DiscountsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DiscountsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public DiscountsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public DiscountsBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public DiscountsParams build() { + return new DiscountsParams(this); + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIC_ITEM_PRICE("specific_item_price"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum DurationType { + ONE_TIME("one_time"), + + FOREVER("forever"), + + LIMITED_PERIOD("limited_period"), + + /** An enum member indicating that DurationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DurationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DurationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DurationType enumValue : DurationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemTiersParams { + + private final String itemPriceId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private final String rampTierId; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + + this.rampTierId = builder.rampTierId; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + public String getRampTierId() { + return rampTierId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + if (this.rampTierId != null) { + + formData.put("ramp_tier_id", this.rampTierId); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private String itemPriceId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private String rampTierId; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersBuilder rampTierId(String value) { + this.rampTierId = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CouponsParams { + + private final String id; + + private final Timestamp startDate; + + private final Timestamp endDate; + + private CouponsParams(CouponsBuilder builder) { + + this.id = builder.id; + + this.startDate = builder.startDate; + + this.endDate = builder.endDate; + } + + public String getId() { + return id; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getEndDate() { + return endDate; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + return formData; + } + + /** Create a new builder for CouponsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponsBuilder builder() { + return new CouponsBuilder(); + } + + public static final class CouponsBuilder { + + private String id; + + private Timestamp startDate; + + private Timestamp endDate; + + private CouponsBuilder() {} + + public CouponsBuilder id(String value) { + this.id = value; + return this; + } + + public CouponsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public CouponsBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public CouponsParams build() { + return new CouponsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionForCustomerQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionForCustomerQuoteParams.java new file mode 100644 index 00000000..d961d2bf --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionForCustomerQuoteParams.java @@ -0,0 +1,1549 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class EditCreateSubscriptionForCustomerQuoteParams { + + private final String notes; + + private final Timestamp expiresAt; + + private final Integer billingCycles; + + private final List mandatoryAddonsToRemove; + + private final Integer termsToCharge; + + private final BillingAlignmentMode billingAlignmentMode; + + private final List couponIds; + + private final SubscriptionParams subscription; + + private final ShippingAddressParams shippingAddress; + + private final ContractTermParams contractTerm; + + private final List addons; + + private final List eventBasedAddons; + + private EditCreateSubscriptionForCustomerQuoteParams( + EditCreateSubscriptionForCustomerQuoteBuilder builder) { + + this.notes = builder.notes; + + this.expiresAt = builder.expiresAt; + + this.billingCycles = builder.billingCycles; + + this.mandatoryAddonsToRemove = builder.mandatoryAddonsToRemove; + + this.termsToCharge = builder.termsToCharge; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.couponIds = builder.couponIds; + + this.subscription = builder.subscription; + + this.shippingAddress = builder.shippingAddress; + + this.contractTerm = builder.contractTerm; + + this.addons = builder.addons; + + this.eventBasedAddons = builder.eventBasedAddons; + } + + public String getNotes() { + return notes; + } + + public Timestamp getExpiresAt() { + return expiresAt; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public List getMandatoryAddonsToRemove() { + return mandatoryAddonsToRemove; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public List getCouponIds() { + return couponIds; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public List getAddons() { + return addons; + } + + public List getEventBasedAddons() { + return eventBasedAddons; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.notes != null) { + + formData.put("notes", this.notes); + } + + if (this.expiresAt != null) { + + formData.put("expires_at", this.expiresAt); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.mandatoryAddonsToRemove != null) { + + formData.put("mandatory_addons_to_remove", this.mandatoryAddonsToRemove); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.addons != null) { + + // List of objects + for (int i = 0; i < this.addons.size(); i++) { + AddonsParams item = this.addons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.eventBasedAddons != null) { + + // List of objects + for (int i = 0; i < this.eventBasedAddons.size(); i++) { + EventBasedAddonsParams item = this.eventBasedAddons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for EditCreateSubscriptionForCustomerQuoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EditCreateSubscriptionForCustomerQuoteBuilder builder() { + return new EditCreateSubscriptionForCustomerQuoteBuilder(); + } + + public static final class EditCreateSubscriptionForCustomerQuoteBuilder { + + private String notes; + + private Timestamp expiresAt; + + private Integer billingCycles; + + private List mandatoryAddonsToRemove; + + private Integer termsToCharge; + + private BillingAlignmentMode billingAlignmentMode; + + private List couponIds; + + private SubscriptionParams subscription; + + private ShippingAddressParams shippingAddress; + + private ContractTermParams contractTerm; + + private List addons; + + private List eventBasedAddons; + + private EditCreateSubscriptionForCustomerQuoteBuilder() {} + + public EditCreateSubscriptionForCustomerQuoteBuilder notes(String value) { + this.notes = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteBuilder expiresAt(Timestamp value) { + this.expiresAt = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteBuilder mandatoryAddonsToRemove( + List value) { + this.mandatoryAddonsToRemove = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteBuilder billingAlignmentMode( + BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteBuilder subscription(SubscriptionParams value) { + this.subscription = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteBuilder shippingAddress( + ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteBuilder addons(List value) { + this.addons = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteBuilder eventBasedAddons( + List value) { + this.eventBasedAddons = value; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteParams build() { + return new EditCreateSubscriptionForCustomerQuoteParams(this); + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionParams { + + private final String id; + + private final String poNumber; + + private final String planId; + + private final Integer planQuantity; + + private final String planQuantityInDecimal; + + private final Long planUnitPrice; + + private final String planUnitPriceInDecimal; + + private final Long setupFee; + + private final Timestamp trialEnd; + + private final Timestamp startDate; + + private final OfflinePaymentMethod offlinePaymentMethod; + + private final Integer contractTermBillingCycleOnRenewal; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.id = builder.id; + + this.poNumber = builder.poNumber; + + this.planId = builder.planId; + + this.planQuantity = builder.planQuantity; + + this.planQuantityInDecimal = builder.planQuantityInDecimal; + + this.planUnitPrice = builder.planUnitPrice; + + this.planUnitPriceInDecimal = builder.planUnitPriceInDecimal; + + this.setupFee = builder.setupFee; + + this.trialEnd = builder.trialEnd; + + this.startDate = builder.startDate; + + this.offlinePaymentMethod = builder.offlinePaymentMethod; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + } + + public String getId() { + return id; + } + + public String getPoNumber() { + return poNumber; + } + + public String getPlanId() { + return planId; + } + + public Integer getPlanQuantity() { + return planQuantity; + } + + public String getPlanQuantityInDecimal() { + return planQuantityInDecimal; + } + + public Long getPlanUnitPrice() { + return planUnitPrice; + } + + public String getPlanUnitPriceInDecimal() { + return planUnitPriceInDecimal; + } + + public Long getSetupFee() { + return setupFee; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Timestamp getStartDate() { + return startDate; + } + + public OfflinePaymentMethod getOfflinePaymentMethod() { + return offlinePaymentMethod; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.planId != null) { + + formData.put("plan_id", this.planId); + } + + if (this.planQuantity != null) { + + formData.put("plan_quantity", this.planQuantity); + } + + if (this.planQuantityInDecimal != null) { + + formData.put("plan_quantity_in_decimal", this.planQuantityInDecimal); + } + + if (this.planUnitPrice != null) { + + formData.put("plan_unit_price", this.planUnitPrice); + } + + if (this.planUnitPriceInDecimal != null) { + + formData.put("plan_unit_price_in_decimal", this.planUnitPriceInDecimal); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.offlinePaymentMethod != null) { + + formData.put("offline_payment_method", this.offlinePaymentMethod); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private String id; + + private String poNumber; + + private String planId; + + private Integer planQuantity; + + private String planQuantityInDecimal; + + private Long planUnitPrice; + + private String planUnitPriceInDecimal; + + private Long setupFee; + + private Timestamp trialEnd; + + private Timestamp startDate; + + private OfflinePaymentMethod offlinePaymentMethod; + + private Integer contractTermBillingCycleOnRenewal; + + private SubscriptionBuilder() {} + + public SubscriptionBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public SubscriptionBuilder planId(String value) { + this.planId = value; + return this; + } + + public SubscriptionBuilder planQuantity(Integer value) { + this.planQuantity = value; + return this; + } + + public SubscriptionBuilder planQuantityInDecimal(String value) { + this.planQuantityInDecimal = value; + return this; + } + + public SubscriptionBuilder planUnitPrice(Long value) { + this.planUnitPrice = value; + return this; + } + + public SubscriptionBuilder planUnitPriceInDecimal(String value) { + this.planUnitPriceInDecimal = value; + return this; + } + + public SubscriptionBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + this.offlinePaymentMethod = value; + return this; + } + + public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class AddonsParams { + + private final String id; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Timestamp trialEnd; + + private AddonsParams(AddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.trialEnd = builder.trialEnd; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + return formData; + } + + /** Create a new builder for AddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddonsBuilder builder() { + return new AddonsBuilder(); + } + + public static final class AddonsBuilder { + + private String id; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Timestamp trialEnd; + + private AddonsBuilder() {} + + public AddonsBuilder id(String value) { + this.id = value; + return this; + } + + public AddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public AddonsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public AddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public AddonsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public AddonsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public AddonsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public AddonsParams build() { + return new AddonsParams(this); + } + } + } + + public static final class EventBasedAddonsParams { + + private final String id; + + private final Integer quantity; + + private final Long unitPrice; + + private final String quantityInDecimal; + + private final String unitPriceInDecimal; + + private final Integer servicePeriodInDays; + + private final OnEvent onEvent; + + private final Boolean chargeOnce; + + private final ChargeOn chargeOn; + + private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.unitPrice = builder.unitPrice; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.servicePeriodInDays = builder.servicePeriodInDays; + + this.onEvent = builder.onEvent; + + this.chargeOnce = builder.chargeOnce; + + this.chargeOn = builder.chargeOn; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getServicePeriodInDays() { + return servicePeriodInDays; + } + + public OnEvent getOnEvent() { + return onEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ChargeOn getChargeOn() { + return chargeOn; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.servicePeriodInDays != null) { + + formData.put("service_period_in_days", this.servicePeriodInDays); + } + + if (this.onEvent != null) { + + formData.put("on_event", this.onEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.chargeOn != null) { + + formData.put("charge_on", this.chargeOn); + } + + return formData; + } + + /** Create a new builder for EventBasedAddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EventBasedAddonsBuilder builder() { + return new EventBasedAddonsBuilder(); + } + + public static final class EventBasedAddonsBuilder { + + private String id; + + private Integer quantity; + + private Long unitPrice; + + private String quantityInDecimal; + + private String unitPriceInDecimal; + + private Integer servicePeriodInDays; + + private OnEvent onEvent; + + private Boolean chargeOnce; + + private ChargeOn chargeOn; + + private EventBasedAddonsBuilder() {} + + public EventBasedAddonsBuilder id(String value) { + this.id = value; + return this; + } + + public EventBasedAddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public EventBasedAddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public EventBasedAddonsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public EventBasedAddonsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { + this.servicePeriodInDays = value; + return this; + } + + public EventBasedAddonsBuilder onEvent(OnEvent value) { + this.onEvent = value; + return this; + } + + public EventBasedAddonsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public EventBasedAddonsBuilder chargeOn(ChargeOn value) { + this.chargeOn = value; + return this; + } + + public EventBasedAddonsParams build() { + return new EventBasedAddonsParams(this); + } + } + + public enum OnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that OnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + OnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (OnEvent enumValue : OnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOn { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOn enumValue : ChargeOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionQuoteForItemsForQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionQuoteForItemsForQuoteParams.java deleted file mode 100644 index c8f95c22..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionQuoteForItemsForQuoteParams.java +++ /dev/null @@ -1,2669 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class EditCreateSubscriptionQuoteForItemsForQuoteParams { - - private final String notes; - - private final Timestamp expiresAt; - - private final Integer billingCycles; - - private final List mandatoryItemsToRemove; - - private final Integer termsToCharge; - - private final BillingAlignmentMode billingAlignmentMode; - - private final List couponIds; - - private final BillingStartOption billingStartOption; - - private final Integer netTermDays; - - private final SubscriptionParams subscription; - - private final ShippingAddressParams shippingAddress; - - private final ContractTermParams contractTerm; - - private final BillingAddressParams billingAddress; - - private final List subscriptionItems; - - private final List discounts; - - private final List itemTiers; - - private final List coupons; - - private final Map customFields; - - private EditCreateSubscriptionQuoteForItemsForQuoteParams( - EditCreateSubscriptionQuoteForItemsForQuoteBuilder builder) { - - this.notes = builder.notes; - - this.expiresAt = builder.expiresAt; - - this.billingCycles = builder.billingCycles; - - this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; - - this.termsToCharge = builder.termsToCharge; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.couponIds = builder.couponIds; - - this.billingStartOption = builder.billingStartOption; - - this.netTermDays = builder.netTermDays; - - this.subscription = builder.subscription; - - this.shippingAddress = builder.shippingAddress; - - this.contractTerm = builder.contractTerm; - - this.billingAddress = builder.billingAddress; - - this.subscriptionItems = builder.subscriptionItems; - - this.discounts = builder.discounts; - - this.itemTiers = builder.itemTiers; - - this.coupons = builder.coupons; - - this.customFields = - builder.customFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); - } - - public String getNotes() { - return notes; - } - - public Timestamp getExpiresAt() { - return expiresAt; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public List getMandatoryItemsToRemove() { - return mandatoryItemsToRemove; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public List getCouponIds() { - return couponIds; - } - - public BillingStartOption getBillingStartOption() { - return billingStartOption; - } - - public Integer getNetTermDays() { - return netTermDays; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public BillingAddressParams getBillingAddress() { - return billingAddress; - } - - public List getSubscriptionItems() { - return subscriptionItems; - } - - public List getDiscounts() { - return discounts; - } - - public List getItemTiers() { - return itemTiers; - } - - public List getCoupons() { - return coupons; - } - - public Map customFields() { - return customFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.notes != null) { - - formData.put("notes", this.notes); - } - - if (this.expiresAt != null) { - - formData.put("expires_at", this.expiresAt); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.mandatoryItemsToRemove != null) { - - formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.billingStartOption != null) { - - formData.put("billing_start_option", this.billingStartOption); - } - - if (this.netTermDays != null) { - - formData.put("net_term_days", this.netTermDays); - } - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.billingAddress != null) { - - // Single object - Map nestedData = this.billingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.subscriptionItems != null) { - - // List of objects - for (int i = 0; i < this.subscriptionItems.size(); i++) { - SubscriptionItemsParams item = this.subscriptionItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discounts != null) { - - // List of objects - for (int i = 0; i < this.discounts.size(); i++) { - DiscountsParams item = this.discounts.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.coupons != null) { - - // List of objects - for (int i = 0; i < this.coupons.size(); i++) { - CouponsParams item = this.coupons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(customFields); - - return formData; - } - - /** Create a new builder for EditCreateSubscriptionQuoteForItemsForQuoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EditCreateSubscriptionQuoteForItemsForQuoteBuilder builder() { - return new EditCreateSubscriptionQuoteForItemsForQuoteBuilder(); - } - - public static final class EditCreateSubscriptionQuoteForItemsForQuoteBuilder { - - private String notes; - - private Timestamp expiresAt; - - private Integer billingCycles; - - private List mandatoryItemsToRemove; - - private Integer termsToCharge; - - private BillingAlignmentMode billingAlignmentMode; - - private List couponIds; - - private BillingStartOption billingStartOption; - - private Integer netTermDays; - - private SubscriptionParams subscription; - - private ShippingAddressParams shippingAddress; - - private ContractTermParams contractTerm; - - private BillingAddressParams billingAddress; - - private List subscriptionItems; - - private List discounts; - - private List itemTiers; - - private List coupons; - - private Map customFields = new LinkedHashMap<>(); - - private EditCreateSubscriptionQuoteForItemsForQuoteBuilder() {} - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder notes(String value) { - this.notes = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder expiresAt(Timestamp value) { - this.expiresAt = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder mandatoryItemsToRemove( - List value) { - this.mandatoryItemsToRemove = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder billingAlignmentMode( - BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder billingStartOption( - BillingStartOption value) { - this.billingStartOption = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder netTermDays(Integer value) { - this.netTermDays = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder subscription( - SubscriptionParams value) { - this.subscription = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder shippingAddress( - ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder contractTerm( - ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder billingAddress( - BillingAddressParams value) { - this.billingAddress = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder subscriptionItems( - List value) { - this.subscriptionItems = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder discounts( - List value) { - this.discounts = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder itemTiers( - List value) { - this.itemTiers = value; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder coupons(List value) { - this.coupons = value; - return this; - } - - /** - * Add a custom field to the request. Custom fields must start with "cf_". - * - * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") - * @param value the value of the custom field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cf_" - */ - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder customField( - String fieldName, String value) { - if (fieldName == null || !fieldName.startsWith("cf_")) { - throw new IllegalArgumentException("Custom field name must start with 'cf_'"); - } - this.customFields.put(fieldName, value); - return this; - } - - /** - * Add multiple custom fields to the request. All field names must start with "cf_". - * - * @param customFields map of custom field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cf_" - */ - public EditCreateSubscriptionQuoteForItemsForQuoteBuilder customFields( - Map customFields) { - if (customFields != null) { - for (Map.Entry entry : customFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { - throw new IllegalArgumentException( - "Custom field name must start with 'cf_': " + entry.getKey()); - } - this.customFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteParams build() { - return new EditCreateSubscriptionQuoteForItemsForQuoteParams(this); - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum BillingStartOption { - IMMEDIATELY("immediately"), - - ON_SPECIFIC_DATE("on_specific_date"), - - /** An enum member indicating that BillingStartOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - BillingStartOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingStartOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingStartOption enumValue : BillingStartOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionParams { - - private final String id; - - private final String poNumber; - - private final Timestamp trialEnd; - - private final Long setupFee; - - private final Timestamp startDate; - - private final OfflinePaymentMethod offlinePaymentMethod; - - private final Integer contractTermBillingCycleOnRenewal; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.id = builder.id; - - this.poNumber = builder.poNumber; - - this.trialEnd = builder.trialEnd; - - this.setupFee = builder.setupFee; - - this.startDate = builder.startDate; - - this.offlinePaymentMethod = builder.offlinePaymentMethod; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - } - - public String getId() { - return id; - } - - public String getPoNumber() { - return poNumber; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Long getSetupFee() { - return setupFee; - } - - public Timestamp getStartDate() { - return startDate; - } - - public OfflinePaymentMethod getOfflinePaymentMethod() { - return offlinePaymentMethod; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.offlinePaymentMethod != null) { - - formData.put("offline_payment_method", this.offlinePaymentMethod); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private String id; - - private String poNumber; - - private Timestamp trialEnd; - - private Long setupFee; - - private Timestamp startDate; - - private OfflinePaymentMethod offlinePaymentMethod; - - private Integer contractTermBillingCycleOnRenewal; - - private SubscriptionBuilder() {} - - public SubscriptionBuilder id(String value) { - this.id = value; - return this; - } - - public SubscriptionBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public SubscriptionBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - @Deprecated - public SubscriptionBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public SubscriptionBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - this.offlinePaymentMethod = value; - return this; - } - - public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class BillingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private BillingAddressParams(BillingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for BillingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingAddressBuilder builder() { - return new BillingAddressBuilder(); - } - - public static final class BillingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private BillingAddressBuilder() {} - - public BillingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public BillingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public BillingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public BillingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public BillingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public BillingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public BillingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public BillingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public BillingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public BillingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public BillingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public BillingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public BillingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public BillingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public BillingAddressParams build() { - return new BillingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class SubscriptionItemsParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Timestamp trialEnd; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ItemType itemType; - - private final ChargeOnOption chargeOnOption; - - private final Timestamp startDate; - - private final Timestamp endDate; - - private final String rampTierId; - - private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.trialEnd = builder.trialEnd; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.itemType = builder.itemType; - - this.chargeOnOption = builder.chargeOnOption; - - this.startDate = builder.startDate; - - this.endDate = builder.endDate; - - this.rampTierId = builder.rampTierId; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ItemType getItemType() { - return itemType; - } - - public ChargeOnOption getChargeOnOption() { - return chargeOnOption; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getEndDate() { - return endDate; - } - - public String getRampTierId() { - return rampTierId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.itemType != null) { - - formData.put("item_type", this.itemType); - } - - if (this.chargeOnOption != null) { - - formData.put("charge_on_option", this.chargeOnOption); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - if (this.rampTierId != null) { - - formData.put("ramp_tier_id", this.rampTierId); - } - - return formData; - } - - /** Create a new builder for SubscriptionItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionItemsBuilder builder() { - return new SubscriptionItemsBuilder(); - } - - public static final class SubscriptionItemsBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Timestamp trialEnd; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ItemType itemType; - - private ChargeOnOption chargeOnOption; - - private Timestamp startDate; - - private Timestamp endDate; - - private String rampTierId; - - private SubscriptionItemsBuilder() {} - - public SubscriptionItemsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public SubscriptionItemsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public SubscriptionItemsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public SubscriptionItemsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public SubscriptionItemsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionItemsBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public SubscriptionItemsBuilder itemType(ItemType value) { - this.itemType = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { - this.chargeOnOption = value; - return this; - } - - public SubscriptionItemsBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public SubscriptionItemsBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public SubscriptionItemsBuilder rampTierId(String value) { - this.rampTierId = value; - return this; - } - - public SubscriptionItemsParams build() { - return new SubscriptionItemsParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ItemType { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemType enumValue : ItemType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnOption { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnOption enumValue : ChargeOnOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class DiscountsParams { - - private final ApplyOn applyOn; - - private final DurationType durationType; - - private final Number percentage; - - private final Long amount; - - private final Integer period; - - private final PeriodUnit periodUnit; - - private final Boolean includedInMrr; - - private final String itemPriceId; - - private final Integer quantity; - - private final Timestamp startDate; - - private final Timestamp endDate; - - private DiscountsParams(DiscountsBuilder builder) { - - this.applyOn = builder.applyOn; - - this.durationType = builder.durationType; - - this.percentage = builder.percentage; - - this.amount = builder.amount; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - - this.includedInMrr = builder.includedInMrr; - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.startDate = builder.startDate; - - this.endDate = builder.endDate; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public DurationType getDurationType() { - return durationType; - } - - public Number getPercentage() { - return percentage; - } - - public Long getAmount() { - return amount; - } - - public Integer getPeriod() { - return period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public Boolean getIncludedInMrr() { - return includedInMrr; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getEndDate() { - return endDate; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.durationType != null) { - - formData.put("duration_type", this.durationType); - } - - if (this.percentage != null) { - - formData.put("percentage", this.percentage); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.includedInMrr != null) { - - formData.put("included_in_mrr", this.includedInMrr); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - return formData; - } - - /** Create a new builder for DiscountsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsBuilder builder() { - return new DiscountsBuilder(); - } - - public static final class DiscountsBuilder { - - private ApplyOn applyOn; - - private DurationType durationType; - - private Number percentage; - - private Long amount; - - private Integer period; - - private PeriodUnit periodUnit; - - private Boolean includedInMrr; - - private String itemPriceId; - - private Integer quantity; - - private Timestamp startDate; - - private Timestamp endDate; - - private DiscountsBuilder() {} - - public DiscountsBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public DiscountsBuilder durationType(DurationType value) { - this.durationType = value; - return this; - } - - public DiscountsBuilder percentage(Number value) { - this.percentage = value; - return this; - } - - public DiscountsBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsBuilder period(Integer value) { - this.period = value; - return this; - } - - public DiscountsBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public DiscountsBuilder includedInMrr(Boolean value) { - this.includedInMrr = value; - return this; - } - - public DiscountsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DiscountsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public DiscountsBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public DiscountsBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public DiscountsParams build() { - return new DiscountsParams(this); - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIC_ITEM_PRICE("specific_item_price"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum DurationType { - ONE_TIME("one_time"), - - FOREVER("forever"), - - LIMITED_PERIOD("limited_period"), - - /** An enum member indicating that DurationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DurationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DurationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DurationType enumValue : DurationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemTiersParams { - - private final String itemPriceId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private final String rampTierId; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - - this.rampTierId = builder.rampTierId; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - public String getRampTierId() { - return rampTierId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - if (this.rampTierId != null) { - - formData.put("ramp_tier_id", this.rampTierId); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private String itemPriceId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private String rampTierId; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersBuilder rampTierId(String value) { - this.rampTierId = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CouponsParams { - - private final String id; - - private final Timestamp startDate; - - private final Timestamp endDate; - - private CouponsParams(CouponsBuilder builder) { - - this.id = builder.id; - - this.startDate = builder.startDate; - - this.endDate = builder.endDate; - } - - public String getId() { - return id; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getEndDate() { - return endDate; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - return formData; - } - - /** Create a new builder for CouponsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CouponsBuilder builder() { - return new CouponsBuilder(); - } - - public static final class CouponsBuilder { - - private String id; - - private Timestamp startDate; - - private Timestamp endDate; - - private CouponsBuilder() {} - - public CouponsBuilder id(String value) { - this.id = value; - return this; - } - - public CouponsBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public CouponsBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public CouponsParams build() { - return new CouponsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionQuoteForQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionQuoteForQuoteParams.java deleted file mode 100644 index abbf3588..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/EditCreateSubscriptionQuoteForQuoteParams.java +++ /dev/null @@ -1,1547 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class EditCreateSubscriptionQuoteForQuoteParams { - - private final String notes; - - private final Timestamp expiresAt; - - private final Integer billingCycles; - - private final List mandatoryAddonsToRemove; - - private final Integer termsToCharge; - - private final BillingAlignmentMode billingAlignmentMode; - - private final List couponIds; - - private final SubscriptionParams subscription; - - private final ShippingAddressParams shippingAddress; - - private final ContractTermParams contractTerm; - - private final List addons; - - private final List eventBasedAddons; - - private EditCreateSubscriptionQuoteForQuoteParams( - EditCreateSubscriptionQuoteForQuoteBuilder builder) { - - this.notes = builder.notes; - - this.expiresAt = builder.expiresAt; - - this.billingCycles = builder.billingCycles; - - this.mandatoryAddonsToRemove = builder.mandatoryAddonsToRemove; - - this.termsToCharge = builder.termsToCharge; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.couponIds = builder.couponIds; - - this.subscription = builder.subscription; - - this.shippingAddress = builder.shippingAddress; - - this.contractTerm = builder.contractTerm; - - this.addons = builder.addons; - - this.eventBasedAddons = builder.eventBasedAddons; - } - - public String getNotes() { - return notes; - } - - public Timestamp getExpiresAt() { - return expiresAt; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public List getMandatoryAddonsToRemove() { - return mandatoryAddonsToRemove; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public List getCouponIds() { - return couponIds; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public List getAddons() { - return addons; - } - - public List getEventBasedAddons() { - return eventBasedAddons; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.notes != null) { - - formData.put("notes", this.notes); - } - - if (this.expiresAt != null) { - - formData.put("expires_at", this.expiresAt); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.mandatoryAddonsToRemove != null) { - - formData.put("mandatory_addons_to_remove", this.mandatoryAddonsToRemove); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.addons != null) { - - // List of objects - for (int i = 0; i < this.addons.size(); i++) { - AddonsParams item = this.addons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.eventBasedAddons != null) { - - // List of objects - for (int i = 0; i < this.eventBasedAddons.size(); i++) { - EventBasedAddonsParams item = this.eventBasedAddons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for EditCreateSubscriptionQuoteForQuoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EditCreateSubscriptionQuoteForQuoteBuilder builder() { - return new EditCreateSubscriptionQuoteForQuoteBuilder(); - } - - public static final class EditCreateSubscriptionQuoteForQuoteBuilder { - - private String notes; - - private Timestamp expiresAt; - - private Integer billingCycles; - - private List mandatoryAddonsToRemove; - - private Integer termsToCharge; - - private BillingAlignmentMode billingAlignmentMode; - - private List couponIds; - - private SubscriptionParams subscription; - - private ShippingAddressParams shippingAddress; - - private ContractTermParams contractTerm; - - private List addons; - - private List eventBasedAddons; - - private EditCreateSubscriptionQuoteForQuoteBuilder() {} - - public EditCreateSubscriptionQuoteForQuoteBuilder notes(String value) { - this.notes = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteBuilder expiresAt(Timestamp value) { - this.expiresAt = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteBuilder mandatoryAddonsToRemove(List value) { - this.mandatoryAddonsToRemove = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteBuilder billingAlignmentMode( - BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteBuilder subscription(SubscriptionParams value) { - this.subscription = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteBuilder shippingAddress(ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteBuilder addons(List value) { - this.addons = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteBuilder eventBasedAddons( - List value) { - this.eventBasedAddons = value; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteParams build() { - return new EditCreateSubscriptionQuoteForQuoteParams(this); - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionParams { - - private final String id; - - private final String poNumber; - - private final String planId; - - private final Integer planQuantity; - - private final String planQuantityInDecimal; - - private final Long planUnitPrice; - - private final String planUnitPriceInDecimal; - - private final Long setupFee; - - private final Timestamp trialEnd; - - private final Timestamp startDate; - - private final OfflinePaymentMethod offlinePaymentMethod; - - private final Integer contractTermBillingCycleOnRenewal; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.id = builder.id; - - this.poNumber = builder.poNumber; - - this.planId = builder.planId; - - this.planQuantity = builder.planQuantity; - - this.planQuantityInDecimal = builder.planQuantityInDecimal; - - this.planUnitPrice = builder.planUnitPrice; - - this.planUnitPriceInDecimal = builder.planUnitPriceInDecimal; - - this.setupFee = builder.setupFee; - - this.trialEnd = builder.trialEnd; - - this.startDate = builder.startDate; - - this.offlinePaymentMethod = builder.offlinePaymentMethod; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - } - - public String getId() { - return id; - } - - public String getPoNumber() { - return poNumber; - } - - public String getPlanId() { - return planId; - } - - public Integer getPlanQuantity() { - return planQuantity; - } - - public String getPlanQuantityInDecimal() { - return planQuantityInDecimal; - } - - public Long getPlanUnitPrice() { - return planUnitPrice; - } - - public String getPlanUnitPriceInDecimal() { - return planUnitPriceInDecimal; - } - - public Long getSetupFee() { - return setupFee; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Timestamp getStartDate() { - return startDate; - } - - public OfflinePaymentMethod getOfflinePaymentMethod() { - return offlinePaymentMethod; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.planId != null) { - - formData.put("plan_id", this.planId); - } - - if (this.planQuantity != null) { - - formData.put("plan_quantity", this.planQuantity); - } - - if (this.planQuantityInDecimal != null) { - - formData.put("plan_quantity_in_decimal", this.planQuantityInDecimal); - } - - if (this.planUnitPrice != null) { - - formData.put("plan_unit_price", this.planUnitPrice); - } - - if (this.planUnitPriceInDecimal != null) { - - formData.put("plan_unit_price_in_decimal", this.planUnitPriceInDecimal); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.offlinePaymentMethod != null) { - - formData.put("offline_payment_method", this.offlinePaymentMethod); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private String id; - - private String poNumber; - - private String planId; - - private Integer planQuantity; - - private String planQuantityInDecimal; - - private Long planUnitPrice; - - private String planUnitPriceInDecimal; - - private Long setupFee; - - private Timestamp trialEnd; - - private Timestamp startDate; - - private OfflinePaymentMethod offlinePaymentMethod; - - private Integer contractTermBillingCycleOnRenewal; - - private SubscriptionBuilder() {} - - public SubscriptionBuilder id(String value) { - this.id = value; - return this; - } - - public SubscriptionBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public SubscriptionBuilder planId(String value) { - this.planId = value; - return this; - } - - public SubscriptionBuilder planQuantity(Integer value) { - this.planQuantity = value; - return this; - } - - public SubscriptionBuilder planQuantityInDecimal(String value) { - this.planQuantityInDecimal = value; - return this; - } - - public SubscriptionBuilder planUnitPrice(Long value) { - this.planUnitPrice = value; - return this; - } - - public SubscriptionBuilder planUnitPriceInDecimal(String value) { - this.planUnitPriceInDecimal = value; - return this; - } - - public SubscriptionBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public SubscriptionBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - this.offlinePaymentMethod = value; - return this; - } - - public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class AddonsParams { - - private final String id; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Timestamp trialEnd; - - private AddonsParams(AddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.trialEnd = builder.trialEnd; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - return formData; - } - - /** Create a new builder for AddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddonsBuilder builder() { - return new AddonsBuilder(); - } - - public static final class AddonsBuilder { - - private String id; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Timestamp trialEnd; - - private AddonsBuilder() {} - - public AddonsBuilder id(String value) { - this.id = value; - return this; - } - - public AddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public AddonsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public AddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public AddonsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public AddonsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public AddonsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public AddonsParams build() { - return new AddonsParams(this); - } - } - } - - public static final class EventBasedAddonsParams { - - private final String id; - - private final Integer quantity; - - private final Long unitPrice; - - private final String quantityInDecimal; - - private final String unitPriceInDecimal; - - private final Integer servicePeriodInDays; - - private final OnEvent onEvent; - - private final Boolean chargeOnce; - - private final ChargeOn chargeOn; - - private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.unitPrice = builder.unitPrice; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.servicePeriodInDays = builder.servicePeriodInDays; - - this.onEvent = builder.onEvent; - - this.chargeOnce = builder.chargeOnce; - - this.chargeOn = builder.chargeOn; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getServicePeriodInDays() { - return servicePeriodInDays; - } - - public OnEvent getOnEvent() { - return onEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ChargeOn getChargeOn() { - return chargeOn; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.servicePeriodInDays != null) { - - formData.put("service_period_in_days", this.servicePeriodInDays); - } - - if (this.onEvent != null) { - - formData.put("on_event", this.onEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.chargeOn != null) { - - formData.put("charge_on", this.chargeOn); - } - - return formData; - } - - /** Create a new builder for EventBasedAddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EventBasedAddonsBuilder builder() { - return new EventBasedAddonsBuilder(); - } - - public static final class EventBasedAddonsBuilder { - - private String id; - - private Integer quantity; - - private Long unitPrice; - - private String quantityInDecimal; - - private String unitPriceInDecimal; - - private Integer servicePeriodInDays; - - private OnEvent onEvent; - - private Boolean chargeOnce; - - private ChargeOn chargeOn; - - private EventBasedAddonsBuilder() {} - - public EventBasedAddonsBuilder id(String value) { - this.id = value; - return this; - } - - public EventBasedAddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public EventBasedAddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public EventBasedAddonsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public EventBasedAddonsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { - this.servicePeriodInDays = value; - return this; - } - - public EventBasedAddonsBuilder onEvent(OnEvent value) { - this.onEvent = value; - return this; - } - - public EventBasedAddonsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public EventBasedAddonsBuilder chargeOn(ChargeOn value) { - this.chargeOn = value; - return this; - } - - public EventBasedAddonsParams build() { - return new EventBasedAddonsParams(this); - } - } - - public enum OnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that OnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - OnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (OnEvent enumValue : OnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOn { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOn enumValue : ChargeOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/EditForChargeItemsAndChargesForQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/EditForChargeItemsAndChargesForQuoteParams.java deleted file mode 100644 index b49cd018..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/EditForChargeItemsAndChargesForQuoteParams.java +++ /dev/null @@ -1,1875 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class EditForChargeItemsAndChargesForQuoteParams { - - private final String poNumber; - - private final String notes; - - private final Timestamp expiresAt; - - private final String currencyCode; - - private final String coupon; - - private final List couponIds; - - private final BillingAddressParams billingAddress; - - private final ShippingAddressParams shippingAddress; - - private final List itemPrices; - - private final List itemTiers; - - private final List charges; - - private final List discounts; - - private final List taxProvidersFields; - - private EditForChargeItemsAndChargesForQuoteParams( - EditForChargeItemsAndChargesForQuoteBuilder builder) { - - this.poNumber = builder.poNumber; - - this.notes = builder.notes; - - this.expiresAt = builder.expiresAt; - - this.currencyCode = builder.currencyCode; - - this.coupon = builder.coupon; - - this.couponIds = builder.couponIds; - - this.billingAddress = builder.billingAddress; - - this.shippingAddress = builder.shippingAddress; - - this.itemPrices = builder.itemPrices; - - this.itemTiers = builder.itemTiers; - - this.charges = builder.charges; - - this.discounts = builder.discounts; - - this.taxProvidersFields = builder.taxProvidersFields; - } - - public String getPoNumber() { - return poNumber; - } - - public String getNotes() { - return notes; - } - - public Timestamp getExpiresAt() { - return expiresAt; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public String getCoupon() { - return coupon; - } - - public List getCouponIds() { - return couponIds; - } - - public BillingAddressParams getBillingAddress() { - return billingAddress; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public List getItemPrices() { - return itemPrices; - } - - public List getItemTiers() { - return itemTiers; - } - - public List getCharges() { - return charges; - } - - public List getDiscounts() { - return discounts; - } - - public List getTaxProvidersFields() { - return taxProvidersFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.notes != null) { - - formData.put("notes", this.notes); - } - - if (this.expiresAt != null) { - - formData.put("expires_at", this.expiresAt); - } - - if (this.currencyCode != null) { - - formData.put("currency_code", this.currencyCode); - } - - if (this.coupon != null) { - - formData.put("coupon", this.coupon); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.billingAddress != null) { - - // Single object - Map nestedData = this.billingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.itemPrices != null) { - - // List of objects - for (int i = 0; i < this.itemPrices.size(); i++) { - ItemPricesParams item = this.itemPrices.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_prices[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.charges != null) { - - // List of objects - for (int i = 0; i < this.charges.size(); i++) { - ChargesParams item = this.charges.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "charges[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discounts != null) { - - // List of objects - for (int i = 0; i < this.discounts.size(); i++) { - DiscountsParams item = this.discounts.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.taxProvidersFields != null) { - - // List of objects - for (int i = 0; i < this.taxProvidersFields.size(); i++) { - TaxProvidersFieldsParams item = this.taxProvidersFields.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "tax_providers_fields[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for EditForChargeItemsAndChargesForQuoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EditForChargeItemsAndChargesForQuoteBuilder builder() { - return new EditForChargeItemsAndChargesForQuoteBuilder(); - } - - public static final class EditForChargeItemsAndChargesForQuoteBuilder { - - private String poNumber; - - private String notes; - - private Timestamp expiresAt; - - private String currencyCode; - - private String coupon; - - private List couponIds; - - private BillingAddressParams billingAddress; - - private ShippingAddressParams shippingAddress; - - private List itemPrices; - - private List itemTiers; - - private List charges; - - private List discounts; - - private List taxProvidersFields; - - private EditForChargeItemsAndChargesForQuoteBuilder() {} - - public EditForChargeItemsAndChargesForQuoteBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder notes(String value) { - this.notes = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder expiresAt(Timestamp value) { - this.expiresAt = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder currencyCode(String value) { - this.currencyCode = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder coupon(String value) { - this.coupon = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder billingAddress(BillingAddressParams value) { - this.billingAddress = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder shippingAddress( - ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder itemPrices(List value) { - this.itemPrices = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder itemTiers(List value) { - this.itemTiers = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder charges(List value) { - this.charges = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder discounts(List value) { - this.discounts = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteBuilder taxProvidersFields( - List value) { - this.taxProvidersFields = value; - return this; - } - - public EditForChargeItemsAndChargesForQuoteParams build() { - return new EditForChargeItemsAndChargesForQuoteParams(this); - } - } - - public static final class BillingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private BillingAddressParams(BillingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for BillingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingAddressBuilder builder() { - return new BillingAddressBuilder(); - } - - public static final class BillingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private BillingAddressBuilder() {} - - public BillingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public BillingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public BillingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public BillingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public BillingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public BillingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public BillingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public BillingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public BillingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public BillingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public BillingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public BillingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public BillingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public BillingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public BillingAddressParams build() { - return new BillingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemPricesParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer servicePeriodDays; - - private ItemPricesParams(ItemPricesBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.servicePeriodDays = builder.servicePeriodDays; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - return formData; - } - - /** Create a new builder for ItemPricesParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemPricesBuilder builder() { - return new ItemPricesBuilder(); - } - - public static final class ItemPricesBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer servicePeriodDays; - - private ItemPricesBuilder() {} - - public ItemPricesBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemPricesBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public ItemPricesBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public ItemPricesBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public ItemPricesBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public ItemPricesBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public ItemPricesParams build() { - return new ItemPricesParams(this); - } - } - } - - public static final class ItemTiersParams { - - private final String itemPriceId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private String itemPriceId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ChargesParams { - - private final Long amount; - - private final String amountInDecimal; - - private final String description; - - private final AvalaraSaleType avalaraSaleType; - - private final Integer avalaraTransactionType; - - private final Integer avalaraServiceType; - - private final Integer servicePeriod; - - private ChargesParams(ChargesBuilder builder) { - - this.amount = builder.amount; - - this.amountInDecimal = builder.amountInDecimal; - - this.description = builder.description; - - this.avalaraSaleType = builder.avalaraSaleType; - - this.avalaraTransactionType = builder.avalaraTransactionType; - - this.avalaraServiceType = builder.avalaraServiceType; - - this.servicePeriod = builder.servicePeriod; - } - - public Long getAmount() { - return amount; - } - - public String getAmountInDecimal() { - return amountInDecimal; - } - - public String getDescription() { - return description; - } - - public AvalaraSaleType getAvalaraSaleType() { - return avalaraSaleType; - } - - public Integer getAvalaraTransactionType() { - return avalaraTransactionType; - } - - public Integer getAvalaraServiceType() { - return avalaraServiceType; - } - - public Integer getServicePeriod() { - return servicePeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.amountInDecimal != null) { - - formData.put("amount_in_decimal", this.amountInDecimal); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.avalaraSaleType != null) { - - formData.put("avalara_sale_type", this.avalaraSaleType); - } - - if (this.avalaraTransactionType != null) { - - formData.put("avalara_transaction_type", this.avalaraTransactionType); - } - - if (this.avalaraServiceType != null) { - - formData.put("avalara_service_type", this.avalaraServiceType); - } - - if (this.servicePeriod != null) { - - formData.put("service_period", this.servicePeriod); - } - - return formData; - } - - /** Create a new builder for ChargesParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ChargesBuilder builder() { - return new ChargesBuilder(); - } - - public static final class ChargesBuilder { - - private Long amount; - - private String amountInDecimal; - - private String description; - - private AvalaraSaleType avalaraSaleType; - - private Integer avalaraTransactionType; - - private Integer avalaraServiceType; - - private Integer servicePeriod; - - private ChargesBuilder() {} - - public ChargesBuilder amount(Long value) { - this.amount = value; - return this; - } - - public ChargesBuilder amountInDecimal(String value) { - this.amountInDecimal = value; - return this; - } - - public ChargesBuilder description(String value) { - this.description = value; - return this; - } - - public ChargesBuilder avalaraSaleType(AvalaraSaleType value) { - this.avalaraSaleType = value; - return this; - } - - public ChargesBuilder avalaraTransactionType(Integer value) { - this.avalaraTransactionType = value; - return this; - } - - public ChargesBuilder avalaraServiceType(Integer value) { - this.avalaraServiceType = value; - return this; - } - - public ChargesBuilder servicePeriod(Integer value) { - this.servicePeriod = value; - return this; - } - - public ChargesParams build() { - return new ChargesParams(this); - } - } - - public enum AvalaraSaleType { - WHOLESALE("wholesale"), - - RETAIL("retail"), - - CONSUMED("consumed"), - - VENDOR_USE("vendor_use"), - - /** An enum member indicating that AvalaraSaleType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AvalaraSaleType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AvalaraSaleType fromString(String value) { - if (value == null) return _UNKNOWN; - for (AvalaraSaleType enumValue : AvalaraSaleType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class DiscountsParams { - - private final Number percentage; - - private final Integer quantity; - - private final Long amount; - - private final ApplyOn applyOn; - - private final String itemPriceId; - - private DiscountsParams(DiscountsBuilder builder) { - - this.percentage = builder.percentage; - - this.quantity = builder.quantity; - - this.amount = builder.amount; - - this.applyOn = builder.applyOn; - - this.itemPriceId = builder.itemPriceId; - } - - public Number getPercentage() { - return percentage; - } - - public Integer getQuantity() { - return quantity; - } - - public Long getAmount() { - return amount; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public String getItemPriceId() { - return itemPriceId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.percentage != null) { - - formData.put("percentage", this.percentage); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - return formData; - } - - /** Create a new builder for DiscountsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsBuilder builder() { - return new DiscountsBuilder(); - } - - public static final class DiscountsBuilder { - - private Number percentage; - - private Integer quantity; - - private Long amount; - - private ApplyOn applyOn; - - private String itemPriceId; - - private DiscountsBuilder() {} - - public DiscountsBuilder percentage(Number value) { - this.percentage = value; - return this; - } - - public DiscountsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public DiscountsBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public DiscountsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DiscountsParams build() { - return new DiscountsParams(this); - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIC_ITEM_PRICE("specific_item_price"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class TaxProvidersFieldsParams { - - private final String providerName; - - private final String fieldId; - - private final String fieldValue; - - private TaxProvidersFieldsParams(TaxProvidersFieldsBuilder builder) { - - this.providerName = builder.providerName; - - this.fieldId = builder.fieldId; - - this.fieldValue = builder.fieldValue; - } - - public String getProviderName() { - return providerName; - } - - public String getFieldId() { - return fieldId; - } - - public String getFieldValue() { - return fieldValue; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.providerName != null) { - - formData.put("provider_name", this.providerName); - } - - if (this.fieldId != null) { - - formData.put("field_id", this.fieldId); - } - - if (this.fieldValue != null) { - - formData.put("field_value", this.fieldValue); - } - - return formData; - } - - /** Create a new builder for TaxProvidersFieldsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TaxProvidersFieldsBuilder builder() { - return new TaxProvidersFieldsBuilder(); - } - - public static final class TaxProvidersFieldsBuilder { - - private String providerName; - - private String fieldId; - - private String fieldValue; - - private TaxProvidersFieldsBuilder() {} - - public TaxProvidersFieldsBuilder providerName(String value) { - this.providerName = value; - return this; - } - - public TaxProvidersFieldsBuilder fieldId(String value) { - this.fieldId = value; - return this; - } - - public TaxProvidersFieldsBuilder fieldValue(String value) { - this.fieldValue = value; - return this; - } - - public TaxProvidersFieldsParams build() { - return new TaxProvidersFieldsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/EditOneTimeQuoteForQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/EditOneTimeQuoteForQuoteParams.java deleted file mode 100644 index 5ddd4684..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/EditOneTimeQuoteForQuoteParams.java +++ /dev/null @@ -1,1054 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class EditOneTimeQuoteForQuoteParams { - - private final String poNumber; - - private final String notes; - - private final Timestamp expiresAt; - - private final String currencyCode; - - private final String coupon; - - private final List couponIds; - - private final ShippingAddressParams shippingAddress; - - private final List addons; - - private final List charges; - - private final List taxProvidersFields; - - private EditOneTimeQuoteForQuoteParams(EditOneTimeQuoteForQuoteBuilder builder) { - - this.poNumber = builder.poNumber; - - this.notes = builder.notes; - - this.expiresAt = builder.expiresAt; - - this.currencyCode = builder.currencyCode; - - this.coupon = builder.coupon; - - this.couponIds = builder.couponIds; - - this.shippingAddress = builder.shippingAddress; - - this.addons = builder.addons; - - this.charges = builder.charges; - - this.taxProvidersFields = builder.taxProvidersFields; - } - - public String getPoNumber() { - return poNumber; - } - - public String getNotes() { - return notes; - } - - public Timestamp getExpiresAt() { - return expiresAt; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public String getCoupon() { - return coupon; - } - - public List getCouponIds() { - return couponIds; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public List getAddons() { - return addons; - } - - public List getCharges() { - return charges; - } - - public List getTaxProvidersFields() { - return taxProvidersFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.notes != null) { - - formData.put("notes", this.notes); - } - - if (this.expiresAt != null) { - - formData.put("expires_at", this.expiresAt); - } - - if (this.currencyCode != null) { - - formData.put("currency_code", this.currencyCode); - } - - if (this.coupon != null) { - - formData.put("coupon", this.coupon); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.addons != null) { - - // List of objects - for (int i = 0; i < this.addons.size(); i++) { - AddonsParams item = this.addons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.charges != null) { - - // List of objects - for (int i = 0; i < this.charges.size(); i++) { - ChargesParams item = this.charges.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "charges[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.taxProvidersFields != null) { - - // List of objects - for (int i = 0; i < this.taxProvidersFields.size(); i++) { - TaxProvidersFieldsParams item = this.taxProvidersFields.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "tax_providers_fields[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for EditOneTimeQuoteForQuoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EditOneTimeQuoteForQuoteBuilder builder() { - return new EditOneTimeQuoteForQuoteBuilder(); - } - - public static final class EditOneTimeQuoteForQuoteBuilder { - - private String poNumber; - - private String notes; - - private Timestamp expiresAt; - - private String currencyCode; - - private String coupon; - - private List couponIds; - - private ShippingAddressParams shippingAddress; - - private List addons; - - private List charges; - - private List taxProvidersFields; - - private EditOneTimeQuoteForQuoteBuilder() {} - - public EditOneTimeQuoteForQuoteBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public EditOneTimeQuoteForQuoteBuilder notes(String value) { - this.notes = value; - return this; - } - - public EditOneTimeQuoteForQuoteBuilder expiresAt(Timestamp value) { - this.expiresAt = value; - return this; - } - - public EditOneTimeQuoteForQuoteBuilder currencyCode(String value) { - this.currencyCode = value; - return this; - } - - public EditOneTimeQuoteForQuoteBuilder coupon(String value) { - this.coupon = value; - return this; - } - - public EditOneTimeQuoteForQuoteBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public EditOneTimeQuoteForQuoteBuilder shippingAddress(ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public EditOneTimeQuoteForQuoteBuilder addons(List value) { - this.addons = value; - return this; - } - - public EditOneTimeQuoteForQuoteBuilder charges(List value) { - this.charges = value; - return this; - } - - public EditOneTimeQuoteForQuoteBuilder taxProvidersFields( - List value) { - this.taxProvidersFields = value; - return this; - } - - public EditOneTimeQuoteForQuoteParams build() { - return new EditOneTimeQuoteForQuoteParams(this); - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class AddonsParams { - - private final String id; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer servicePeriod; - - private AddonsParams(AddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.servicePeriod = builder.servicePeriod; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getServicePeriod() { - return servicePeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.servicePeriod != null) { - - formData.put("service_period", this.servicePeriod); - } - - return formData; - } - - /** Create a new builder for AddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddonsBuilder builder() { - return new AddonsBuilder(); - } - - public static final class AddonsBuilder { - - private String id; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer servicePeriod; - - private AddonsBuilder() {} - - public AddonsBuilder id(String value) { - this.id = value; - return this; - } - - public AddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public AddonsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public AddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public AddonsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public AddonsBuilder servicePeriod(Integer value) { - this.servicePeriod = value; - return this; - } - - public AddonsParams build() { - return new AddonsParams(this); - } - } - } - - public static final class ChargesParams { - - private final Long amount; - - private final String amountInDecimal; - - private final String description; - - private final AvalaraSaleType avalaraSaleType; - - private final Integer avalaraTransactionType; - - private final Integer avalaraServiceType; - - private final Integer servicePeriod; - - private ChargesParams(ChargesBuilder builder) { - - this.amount = builder.amount; - - this.amountInDecimal = builder.amountInDecimal; - - this.description = builder.description; - - this.avalaraSaleType = builder.avalaraSaleType; - - this.avalaraTransactionType = builder.avalaraTransactionType; - - this.avalaraServiceType = builder.avalaraServiceType; - - this.servicePeriod = builder.servicePeriod; - } - - public Long getAmount() { - return amount; - } - - public String getAmountInDecimal() { - return amountInDecimal; - } - - public String getDescription() { - return description; - } - - public AvalaraSaleType getAvalaraSaleType() { - return avalaraSaleType; - } - - public Integer getAvalaraTransactionType() { - return avalaraTransactionType; - } - - public Integer getAvalaraServiceType() { - return avalaraServiceType; - } - - public Integer getServicePeriod() { - return servicePeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.amountInDecimal != null) { - - formData.put("amount_in_decimal", this.amountInDecimal); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.avalaraSaleType != null) { - - formData.put("avalara_sale_type", this.avalaraSaleType); - } - - if (this.avalaraTransactionType != null) { - - formData.put("avalara_transaction_type", this.avalaraTransactionType); - } - - if (this.avalaraServiceType != null) { - - formData.put("avalara_service_type", this.avalaraServiceType); - } - - if (this.servicePeriod != null) { - - formData.put("service_period", this.servicePeriod); - } - - return formData; - } - - /** Create a new builder for ChargesParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ChargesBuilder builder() { - return new ChargesBuilder(); - } - - public static final class ChargesBuilder { - - private Long amount; - - private String amountInDecimal; - - private String description; - - private AvalaraSaleType avalaraSaleType; - - private Integer avalaraTransactionType; - - private Integer avalaraServiceType; - - private Integer servicePeriod; - - private ChargesBuilder() {} - - public ChargesBuilder amount(Long value) { - this.amount = value; - return this; - } - - public ChargesBuilder amountInDecimal(String value) { - this.amountInDecimal = value; - return this; - } - - public ChargesBuilder description(String value) { - this.description = value; - return this; - } - - public ChargesBuilder avalaraSaleType(AvalaraSaleType value) { - this.avalaraSaleType = value; - return this; - } - - public ChargesBuilder avalaraTransactionType(Integer value) { - this.avalaraTransactionType = value; - return this; - } - - public ChargesBuilder avalaraServiceType(Integer value) { - this.avalaraServiceType = value; - return this; - } - - public ChargesBuilder servicePeriod(Integer value) { - this.servicePeriod = value; - return this; - } - - public ChargesParams build() { - return new ChargesParams(this); - } - } - - public enum AvalaraSaleType { - WHOLESALE("wholesale"), - - RETAIL("retail"), - - CONSUMED("consumed"), - - VENDOR_USE("vendor_use"), - - /** An enum member indicating that AvalaraSaleType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AvalaraSaleType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AvalaraSaleType fromString(String value) { - if (value == null) return _UNKNOWN; - for (AvalaraSaleType enumValue : AvalaraSaleType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class TaxProvidersFieldsParams { - - private final String providerName; - - private final String fieldId; - - private final String fieldValue; - - private TaxProvidersFieldsParams(TaxProvidersFieldsBuilder builder) { - - this.providerName = builder.providerName; - - this.fieldId = builder.fieldId; - - this.fieldValue = builder.fieldValue; - } - - public String getProviderName() { - return providerName; - } - - public String getFieldId() { - return fieldId; - } - - public String getFieldValue() { - return fieldValue; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.providerName != null) { - - formData.put("provider_name", this.providerName); - } - - if (this.fieldId != null) { - - formData.put("field_id", this.fieldId); - } - - if (this.fieldValue != null) { - - formData.put("field_value", this.fieldValue); - } - - return formData; - } - - /** Create a new builder for TaxProvidersFieldsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TaxProvidersFieldsBuilder builder() { - return new TaxProvidersFieldsBuilder(); - } - - public static final class TaxProvidersFieldsBuilder { - - private String providerName; - - private String fieldId; - - private String fieldValue; - - private TaxProvidersFieldsBuilder() {} - - public TaxProvidersFieldsBuilder providerName(String value) { - this.providerName = value; - return this; - } - - public TaxProvidersFieldsBuilder fieldId(String value) { - this.fieldId = value; - return this; - } - - public TaxProvidersFieldsBuilder fieldValue(String value) { - this.fieldValue = value; - return this; - } - - public TaxProvidersFieldsParams build() { - return new TaxProvidersFieldsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/EditOneTimeQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/EditOneTimeQuoteParams.java new file mode 100644 index 00000000..6052be7a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/EditOneTimeQuoteParams.java @@ -0,0 +1,1053 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class EditOneTimeQuoteParams { + + private final String poNumber; + + private final String notes; + + private final Timestamp expiresAt; + + private final String currencyCode; + + private final String coupon; + + private final List couponIds; + + private final ShippingAddressParams shippingAddress; + + private final List addons; + + private final List charges; + + private final List taxProvidersFields; + + private EditOneTimeQuoteParams(EditOneTimeQuoteBuilder builder) { + + this.poNumber = builder.poNumber; + + this.notes = builder.notes; + + this.expiresAt = builder.expiresAt; + + this.currencyCode = builder.currencyCode; + + this.coupon = builder.coupon; + + this.couponIds = builder.couponIds; + + this.shippingAddress = builder.shippingAddress; + + this.addons = builder.addons; + + this.charges = builder.charges; + + this.taxProvidersFields = builder.taxProvidersFields; + } + + public String getPoNumber() { + return poNumber; + } + + public String getNotes() { + return notes; + } + + public Timestamp getExpiresAt() { + return expiresAt; + } + + public String getCurrencyCode() { + return currencyCode; + } + + public String getCoupon() { + return coupon; + } + + public List getCouponIds() { + return couponIds; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public List getAddons() { + return addons; + } + + public List getCharges() { + return charges; + } + + public List getTaxProvidersFields() { + return taxProvidersFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.notes != null) { + + formData.put("notes", this.notes); + } + + if (this.expiresAt != null) { + + formData.put("expires_at", this.expiresAt); + } + + if (this.currencyCode != null) { + + formData.put("currency_code", this.currencyCode); + } + + if (this.coupon != null) { + + formData.put("coupon", this.coupon); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.addons != null) { + + // List of objects + for (int i = 0; i < this.addons.size(); i++) { + AddonsParams item = this.addons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.charges != null) { + + // List of objects + for (int i = 0; i < this.charges.size(); i++) { + ChargesParams item = this.charges.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "charges[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.taxProvidersFields != null) { + + // List of objects + for (int i = 0; i < this.taxProvidersFields.size(); i++) { + TaxProvidersFieldsParams item = this.taxProvidersFields.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "tax_providers_fields[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for EditOneTimeQuoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EditOneTimeQuoteBuilder builder() { + return new EditOneTimeQuoteBuilder(); + } + + public static final class EditOneTimeQuoteBuilder { + + private String poNumber; + + private String notes; + + private Timestamp expiresAt; + + private String currencyCode; + + private String coupon; + + private List couponIds; + + private ShippingAddressParams shippingAddress; + + private List addons; + + private List charges; + + private List taxProvidersFields; + + private EditOneTimeQuoteBuilder() {} + + public EditOneTimeQuoteBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public EditOneTimeQuoteBuilder notes(String value) { + this.notes = value; + return this; + } + + public EditOneTimeQuoteBuilder expiresAt(Timestamp value) { + this.expiresAt = value; + return this; + } + + public EditOneTimeQuoteBuilder currencyCode(String value) { + this.currencyCode = value; + return this; + } + + public EditOneTimeQuoteBuilder coupon(String value) { + this.coupon = value; + return this; + } + + public EditOneTimeQuoteBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public EditOneTimeQuoteBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public EditOneTimeQuoteBuilder addons(List value) { + this.addons = value; + return this; + } + + public EditOneTimeQuoteBuilder charges(List value) { + this.charges = value; + return this; + } + + public EditOneTimeQuoteBuilder taxProvidersFields(List value) { + this.taxProvidersFields = value; + return this; + } + + public EditOneTimeQuoteParams build() { + return new EditOneTimeQuoteParams(this); + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class AddonsParams { + + private final String id; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer servicePeriod; + + private AddonsParams(AddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.servicePeriod = builder.servicePeriod; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getServicePeriod() { + return servicePeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.servicePeriod != null) { + + formData.put("service_period", this.servicePeriod); + } + + return formData; + } + + /** Create a new builder for AddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddonsBuilder builder() { + return new AddonsBuilder(); + } + + public static final class AddonsBuilder { + + private String id; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer servicePeriod; + + private AddonsBuilder() {} + + public AddonsBuilder id(String value) { + this.id = value; + return this; + } + + public AddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public AddonsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public AddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public AddonsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public AddonsBuilder servicePeriod(Integer value) { + this.servicePeriod = value; + return this; + } + + public AddonsParams build() { + return new AddonsParams(this); + } + } + } + + public static final class ChargesParams { + + private final Long amount; + + private final String amountInDecimal; + + private final String description; + + private final AvalaraSaleType avalaraSaleType; + + private final Integer avalaraTransactionType; + + private final Integer avalaraServiceType; + + private final Integer servicePeriod; + + private ChargesParams(ChargesBuilder builder) { + + this.amount = builder.amount; + + this.amountInDecimal = builder.amountInDecimal; + + this.description = builder.description; + + this.avalaraSaleType = builder.avalaraSaleType; + + this.avalaraTransactionType = builder.avalaraTransactionType; + + this.avalaraServiceType = builder.avalaraServiceType; + + this.servicePeriod = builder.servicePeriod; + } + + public Long getAmount() { + return amount; + } + + public String getAmountInDecimal() { + return amountInDecimal; + } + + public String getDescription() { + return description; + } + + public AvalaraSaleType getAvalaraSaleType() { + return avalaraSaleType; + } + + public Integer getAvalaraTransactionType() { + return avalaraTransactionType; + } + + public Integer getAvalaraServiceType() { + return avalaraServiceType; + } + + public Integer getServicePeriod() { + return servicePeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.amountInDecimal != null) { + + formData.put("amount_in_decimal", this.amountInDecimal); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.avalaraSaleType != null) { + + formData.put("avalara_sale_type", this.avalaraSaleType); + } + + if (this.avalaraTransactionType != null) { + + formData.put("avalara_transaction_type", this.avalaraTransactionType); + } + + if (this.avalaraServiceType != null) { + + formData.put("avalara_service_type", this.avalaraServiceType); + } + + if (this.servicePeriod != null) { + + formData.put("service_period", this.servicePeriod); + } + + return formData; + } + + /** Create a new builder for ChargesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ChargesBuilder builder() { + return new ChargesBuilder(); + } + + public static final class ChargesBuilder { + + private Long amount; + + private String amountInDecimal; + + private String description; + + private AvalaraSaleType avalaraSaleType; + + private Integer avalaraTransactionType; + + private Integer avalaraServiceType; + + private Integer servicePeriod; + + private ChargesBuilder() {} + + public ChargesBuilder amount(Long value) { + this.amount = value; + return this; + } + + public ChargesBuilder amountInDecimal(String value) { + this.amountInDecimal = value; + return this; + } + + public ChargesBuilder description(String value) { + this.description = value; + return this; + } + + public ChargesBuilder avalaraSaleType(AvalaraSaleType value) { + this.avalaraSaleType = value; + return this; + } + + public ChargesBuilder avalaraTransactionType(Integer value) { + this.avalaraTransactionType = value; + return this; + } + + public ChargesBuilder avalaraServiceType(Integer value) { + this.avalaraServiceType = value; + return this; + } + + public ChargesBuilder servicePeriod(Integer value) { + this.servicePeriod = value; + return this; + } + + public ChargesParams build() { + return new ChargesParams(this); + } + } + + public enum AvalaraSaleType { + WHOLESALE("wholesale"), + + RETAIL("retail"), + + CONSUMED("consumed"), + + VENDOR_USE("vendor_use"), + + /** An enum member indicating that AvalaraSaleType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AvalaraSaleType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AvalaraSaleType fromString(String value) { + if (value == null) return _UNKNOWN; + for (AvalaraSaleType enumValue : AvalaraSaleType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class TaxProvidersFieldsParams { + + private final String providerName; + + private final String fieldId; + + private final String fieldValue; + + private TaxProvidersFieldsParams(TaxProvidersFieldsBuilder builder) { + + this.providerName = builder.providerName; + + this.fieldId = builder.fieldId; + + this.fieldValue = builder.fieldValue; + } + + public String getProviderName() { + return providerName; + } + + public String getFieldId() { + return fieldId; + } + + public String getFieldValue() { + return fieldValue; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.providerName != null) { + + formData.put("provider_name", this.providerName); + } + + if (this.fieldId != null) { + + formData.put("field_id", this.fieldId); + } + + if (this.fieldValue != null) { + + formData.put("field_value", this.fieldValue); + } + + return formData; + } + + /** Create a new builder for TaxProvidersFieldsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TaxProvidersFieldsBuilder builder() { + return new TaxProvidersFieldsBuilder(); + } + + public static final class TaxProvidersFieldsBuilder { + + private String providerName; + + private String fieldId; + + private String fieldValue; + + private TaxProvidersFieldsBuilder() {} + + public TaxProvidersFieldsBuilder providerName(String value) { + this.providerName = value; + return this; + } + + public TaxProvidersFieldsBuilder fieldId(String value) { + this.fieldId = value; + return this; + } + + public TaxProvidersFieldsBuilder fieldValue(String value) { + this.fieldValue = value; + return this; + } + + public TaxProvidersFieldsParams build() { + return new TaxProvidersFieldsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteForItemsForQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteForItemsForQuoteParams.java deleted file mode 100644 index 58c203b9..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteForItemsForQuoteParams.java +++ /dev/null @@ -1,3000 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class EditUpdateSubscriptionQuoteForItemsForQuoteParams { - - private final String notes; - - private final Timestamp expiresAt; - - private final List mandatoryItemsToRemove; - - private final Boolean replaceItemsList; - - private final Integer billingCycles; - - private final Integer termsToCharge; - - private final Timestamp reactivateFrom; - - private final BillingAlignmentMode billingAlignmentMode; - - private final List couponIds; - - private final Boolean replaceCouponList; - - private final ChangeOption changeOption; - - private final Timestamp changesScheduledAt; - - private final Boolean forceTermReset; - - private final Boolean reactivate; - - private final Integer netTermDays; - - private final SubscriptionParams subscription; - - private final BillingAddressParams billingAddress; - - private final ShippingAddressParams shippingAddress; - - private final CustomerParams customer; - - private final ContractTermParams contractTerm; - - private final List subscriptionItems; - - private final List discounts; - - private final List itemTiers; - - private final List coupons; - - private final Map customFields; - - private EditUpdateSubscriptionQuoteForItemsForQuoteParams( - EditUpdateSubscriptionQuoteForItemsForQuoteBuilder builder) { - - this.notes = builder.notes; - - this.expiresAt = builder.expiresAt; - - this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; - - this.replaceItemsList = builder.replaceItemsList; - - this.billingCycles = builder.billingCycles; - - this.termsToCharge = builder.termsToCharge; - - this.reactivateFrom = builder.reactivateFrom; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.couponIds = builder.couponIds; - - this.replaceCouponList = builder.replaceCouponList; - - this.changeOption = builder.changeOption; - - this.changesScheduledAt = builder.changesScheduledAt; - - this.forceTermReset = builder.forceTermReset; - - this.reactivate = builder.reactivate; - - this.netTermDays = builder.netTermDays; - - this.subscription = builder.subscription; - - this.billingAddress = builder.billingAddress; - - this.shippingAddress = builder.shippingAddress; - - this.customer = builder.customer; - - this.contractTerm = builder.contractTerm; - - this.subscriptionItems = builder.subscriptionItems; - - this.discounts = builder.discounts; - - this.itemTiers = builder.itemTiers; - - this.coupons = builder.coupons; - - this.customFields = - builder.customFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); - } - - public String getNotes() { - return notes; - } - - public Timestamp getExpiresAt() { - return expiresAt; - } - - public List getMandatoryItemsToRemove() { - return mandatoryItemsToRemove; - } - - public Boolean getReplaceItemsList() { - return replaceItemsList; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public Timestamp getReactivateFrom() { - return reactivateFrom; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public List getCouponIds() { - return couponIds; - } - - public Boolean getReplaceCouponList() { - return replaceCouponList; - } - - public ChangeOption getChangeOption() { - return changeOption; - } - - public Timestamp getChangesScheduledAt() { - return changesScheduledAt; - } - - public Boolean getForceTermReset() { - return forceTermReset; - } - - public Boolean getReactivate() { - return reactivate; - } - - public Integer getNetTermDays() { - return netTermDays; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - public BillingAddressParams getBillingAddress() { - return billingAddress; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public CustomerParams getCustomer() { - return customer; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public List getSubscriptionItems() { - return subscriptionItems; - } - - public List getDiscounts() { - return discounts; - } - - public List getItemTiers() { - return itemTiers; - } - - public List getCoupons() { - return coupons; - } - - public Map customFields() { - return customFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.notes != null) { - - formData.put("notes", this.notes); - } - - if (this.expiresAt != null) { - - formData.put("expires_at", this.expiresAt); - } - - if (this.mandatoryItemsToRemove != null) { - - formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); - } - - if (this.replaceItemsList != null) { - - formData.put("replace_items_list", this.replaceItemsList); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.reactivateFrom != null) { - - formData.put("reactivate_from", this.reactivateFrom); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.replaceCouponList != null) { - - formData.put("replace_coupon_list", this.replaceCouponList); - } - - if (this.changeOption != null) { - - formData.put("change_option", this.changeOption); - } - - if (this.changesScheduledAt != null) { - - formData.put("changes_scheduled_at", this.changesScheduledAt); - } - - if (this.forceTermReset != null) { - - formData.put("force_term_reset", this.forceTermReset); - } - - if (this.reactivate != null) { - - formData.put("reactivate", this.reactivate); - } - - if (this.netTermDays != null) { - - formData.put("net_term_days", this.netTermDays); - } - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.billingAddress != null) { - - // Single object - Map nestedData = this.billingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.customer != null) { - - // Single object - Map nestedData = this.customer.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "customer[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.subscriptionItems != null) { - - // List of objects - for (int i = 0; i < this.subscriptionItems.size(); i++) { - SubscriptionItemsParams item = this.subscriptionItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discounts != null) { - - // List of objects - for (int i = 0; i < this.discounts.size(); i++) { - DiscountsParams item = this.discounts.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.coupons != null) { - - // List of objects - for (int i = 0; i < this.coupons.size(); i++) { - CouponsParams item = this.coupons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(customFields); - - return formData; - } - - /** Create a new builder for EditUpdateSubscriptionQuoteForItemsForQuoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EditUpdateSubscriptionQuoteForItemsForQuoteBuilder builder() { - return new EditUpdateSubscriptionQuoteForItemsForQuoteBuilder(); - } - - public static final class EditUpdateSubscriptionQuoteForItemsForQuoteBuilder { - - private String notes; - - private Timestamp expiresAt; - - private List mandatoryItemsToRemove; - - private Boolean replaceItemsList; - - private Integer billingCycles; - - private Integer termsToCharge; - - private Timestamp reactivateFrom; - - private BillingAlignmentMode billingAlignmentMode; - - private List couponIds; - - private Boolean replaceCouponList; - - private ChangeOption changeOption; - - private Timestamp changesScheduledAt; - - private Boolean forceTermReset; - - private Boolean reactivate; - - private Integer netTermDays; - - private SubscriptionParams subscription; - - private BillingAddressParams billingAddress; - - private ShippingAddressParams shippingAddress; - - private CustomerParams customer; - - private ContractTermParams contractTerm; - - private List subscriptionItems; - - private List discounts; - - private List itemTiers; - - private List coupons; - - private Map customFields = new LinkedHashMap<>(); - - private EditUpdateSubscriptionQuoteForItemsForQuoteBuilder() {} - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder notes(String value) { - this.notes = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder expiresAt(Timestamp value) { - this.expiresAt = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder mandatoryItemsToRemove( - List value) { - this.mandatoryItemsToRemove = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder replaceItemsList(Boolean value) { - this.replaceItemsList = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder reactivateFrom(Timestamp value) { - this.reactivateFrom = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder billingAlignmentMode( - BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder replaceCouponList(Boolean value) { - this.replaceCouponList = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder changeOption(ChangeOption value) { - this.changeOption = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder changesScheduledAt(Timestamp value) { - this.changesScheduledAt = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder forceTermReset(Boolean value) { - this.forceTermReset = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder reactivate(Boolean value) { - this.reactivate = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder netTermDays(Integer value) { - this.netTermDays = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder subscription( - SubscriptionParams value) { - this.subscription = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder billingAddress( - BillingAddressParams value) { - this.billingAddress = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder shippingAddress( - ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder customer(CustomerParams value) { - this.customer = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder contractTerm( - ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder subscriptionItems( - List value) { - this.subscriptionItems = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder discounts( - List value) { - this.discounts = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder itemTiers( - List value) { - this.itemTiers = value; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder coupons(List value) { - this.coupons = value; - return this; - } - - /** - * Add a custom field to the request. Custom fields must start with "cf_". - * - * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") - * @param value the value of the custom field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cf_" - */ - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder customField( - String fieldName, String value) { - if (fieldName == null || !fieldName.startsWith("cf_")) { - throw new IllegalArgumentException("Custom field name must start with 'cf_'"); - } - this.customFields.put(fieldName, value); - return this; - } - - /** - * Add multiple custom fields to the request. All field names must start with "cf_". - * - * @param customFields map of custom field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cf_" - */ - public EditUpdateSubscriptionQuoteForItemsForQuoteBuilder customFields( - Map customFields) { - if (customFields != null) { - for (Map.Entry entry : customFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { - throw new IllegalArgumentException( - "Custom field name must start with 'cf_': " + entry.getKey()); - } - this.customFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteParams build() { - return new EditUpdateSubscriptionQuoteForItemsForQuoteParams(this); - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChangeOption { - IMMEDIATELY("immediately"), - - SPECIFIC_DATE("specific_date"), - - /** An enum member indicating that ChangeOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChangeOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChangeOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChangeOption enumValue : ChangeOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionParams { - - private final Long setupFee; - - private final Timestamp startDate; - - private final Timestamp trialEnd; - - private final String coupon; - - private final AutoCollection autoCollection; - - private final OfflinePaymentMethod offlinePaymentMethod; - - private final Integer contractTermBillingCycleOnRenewal; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.setupFee = builder.setupFee; - - this.startDate = builder.startDate; - - this.trialEnd = builder.trialEnd; - - this.coupon = builder.coupon; - - this.autoCollection = builder.autoCollection; - - this.offlinePaymentMethod = builder.offlinePaymentMethod; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - } - - public Long getSetupFee() { - return setupFee; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public String getCoupon() { - return coupon; - } - - public AutoCollection getAutoCollection() { - return autoCollection; - } - - public OfflinePaymentMethod getOfflinePaymentMethod() { - return offlinePaymentMethod; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.coupon != null) { - - formData.put("coupon", this.coupon); - } - - if (this.autoCollection != null) { - - formData.put("auto_collection", this.autoCollection); - } - - if (this.offlinePaymentMethod != null) { - - formData.put("offline_payment_method", this.offlinePaymentMethod); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private Long setupFee; - - private Timestamp startDate; - - private Timestamp trialEnd; - - private String coupon; - - private AutoCollection autoCollection; - - private OfflinePaymentMethod offlinePaymentMethod; - - private Integer contractTermBillingCycleOnRenewal; - - private SubscriptionBuilder() {} - - @Deprecated - public SubscriptionBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public SubscriptionBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public SubscriptionBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - @Deprecated - public SubscriptionBuilder coupon(String value) { - this.coupon = value; - return this; - } - - public SubscriptionBuilder autoCollection(AutoCollection value) { - this.autoCollection = value; - return this; - } - - public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - this.offlinePaymentMethod = value; - return this; - } - - public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - - public enum AutoCollection { - ON("on"), - - OFF("off"), - - /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AutoCollection(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AutoCollection fromString(String value) { - if (value == null) return _UNKNOWN; - for (AutoCollection enumValue : AutoCollection.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class BillingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private BillingAddressParams(BillingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for BillingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingAddressBuilder builder() { - return new BillingAddressBuilder(); - } - - public static final class BillingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private BillingAddressBuilder() {} - - public BillingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public BillingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public BillingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public BillingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public BillingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public BillingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public BillingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public BillingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public BillingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public BillingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public BillingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public BillingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public BillingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public BillingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public BillingAddressParams build() { - return new BillingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CustomerParams { - - private final String vatNumber; - - private final String vatNumberPrefix; - - private final Boolean registeredForGst; - - private CustomerParams(CustomerBuilder builder) { - - this.vatNumber = builder.vatNumber; - - this.vatNumberPrefix = builder.vatNumberPrefix; - - this.registeredForGst = builder.registeredForGst; - } - - public String getVatNumber() { - return vatNumber; - } - - public String getVatNumberPrefix() { - return vatNumberPrefix; - } - - public Boolean getRegisteredForGst() { - return registeredForGst; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.vatNumber != null) { - - formData.put("vat_number", this.vatNumber); - } - - if (this.vatNumberPrefix != null) { - - formData.put("vat_number_prefix", this.vatNumberPrefix); - } - - if (this.registeredForGst != null) { - - formData.put("registered_for_gst", this.registeredForGst); - } - - return formData; - } - - /** Create a new builder for CustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CustomerBuilder builder() { - return new CustomerBuilder(); - } - - public static final class CustomerBuilder { - - private String vatNumber; - - private String vatNumberPrefix; - - private Boolean registeredForGst; - - private CustomerBuilder() {} - - public CustomerBuilder vatNumber(String value) { - this.vatNumber = value; - return this; - } - - public CustomerBuilder vatNumberPrefix(String value) { - this.vatNumberPrefix = value; - return this; - } - - public CustomerBuilder registeredForGst(Boolean value) { - this.registeredForGst = value; - return this; - } - - public CustomerParams build() { - return new CustomerParams(this); - } - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - RENEW_ONCE("renew_once"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class SubscriptionItemsParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Timestamp trialEnd; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ChargeOnOption chargeOnOption; - - private final ItemType itemType; - - private final Timestamp startDate; - - private final Timestamp endDate; - - private final String rampTierId; - - private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.trialEnd = builder.trialEnd; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.chargeOnOption = builder.chargeOnOption; - - this.itemType = builder.itemType; - - this.startDate = builder.startDate; - - this.endDate = builder.endDate; - - this.rampTierId = builder.rampTierId; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ChargeOnOption getChargeOnOption() { - return chargeOnOption; - } - - public ItemType getItemType() { - return itemType; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getEndDate() { - return endDate; - } - - public String getRampTierId() { - return rampTierId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.chargeOnOption != null) { - - formData.put("charge_on_option", this.chargeOnOption); - } - - if (this.itemType != null) { - - formData.put("item_type", this.itemType); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - if (this.rampTierId != null) { - - formData.put("ramp_tier_id", this.rampTierId); - } - - return formData; - } - - /** Create a new builder for SubscriptionItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionItemsBuilder builder() { - return new SubscriptionItemsBuilder(); - } - - public static final class SubscriptionItemsBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Timestamp trialEnd; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ChargeOnOption chargeOnOption; - - private ItemType itemType; - - private Timestamp startDate; - - private Timestamp endDate; - - private String rampTierId; - - private SubscriptionItemsBuilder() {} - - public SubscriptionItemsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public SubscriptionItemsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public SubscriptionItemsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public SubscriptionItemsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public SubscriptionItemsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionItemsBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { - this.chargeOnOption = value; - return this; - } - - public SubscriptionItemsBuilder itemType(ItemType value) { - this.itemType = value; - return this; - } - - public SubscriptionItemsBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public SubscriptionItemsBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public SubscriptionItemsBuilder rampTierId(String value) { - this.rampTierId = value; - return this; - } - - public SubscriptionItemsParams build() { - return new SubscriptionItemsParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnOption { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnOption enumValue : ChargeOnOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ItemType { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemType enumValue : ItemType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class DiscountsParams { - - private final ApplyOn applyOn; - - private final DurationType durationType; - - private final Number percentage; - - private final Long amount; - - private final Integer period; - - private final PeriodUnit periodUnit; - - private final Boolean includedInMrr; - - private final String itemPriceId; - - private final Integer quantity; - - private final OperationType operationType; - - private final String id; - - private final Timestamp startDate; - - private final Timestamp endDate; - - private DiscountsParams(DiscountsBuilder builder) { - - this.applyOn = builder.applyOn; - - this.durationType = builder.durationType; - - this.percentage = builder.percentage; - - this.amount = builder.amount; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - - this.includedInMrr = builder.includedInMrr; - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.operationType = builder.operationType; - - this.id = builder.id; - - this.startDate = builder.startDate; - - this.endDate = builder.endDate; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public DurationType getDurationType() { - return durationType; - } - - public Number getPercentage() { - return percentage; - } - - public Long getAmount() { - return amount; - } - - public Integer getPeriod() { - return period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public Boolean getIncludedInMrr() { - return includedInMrr; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public OperationType getOperationType() { - return operationType; - } - - public String getId() { - return id; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getEndDate() { - return endDate; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.durationType != null) { - - formData.put("duration_type", this.durationType); - } - - if (this.percentage != null) { - - formData.put("percentage", this.percentage); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.includedInMrr != null) { - - formData.put("included_in_mrr", this.includedInMrr); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.operationType != null) { - - formData.put("operation_type", this.operationType); - } - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - return formData; - } - - /** Create a new builder for DiscountsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsBuilder builder() { - return new DiscountsBuilder(); - } - - public static final class DiscountsBuilder { - - private ApplyOn applyOn; - - private DurationType durationType; - - private Number percentage; - - private Long amount; - - private Integer period; - - private PeriodUnit periodUnit; - - private Boolean includedInMrr; - - private String itemPriceId; - - private Integer quantity; - - private OperationType operationType; - - private String id; - - private Timestamp startDate; - - private Timestamp endDate; - - private DiscountsBuilder() {} - - public DiscountsBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public DiscountsBuilder durationType(DurationType value) { - this.durationType = value; - return this; - } - - public DiscountsBuilder percentage(Number value) { - this.percentage = value; - return this; - } - - public DiscountsBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsBuilder period(Integer value) { - this.period = value; - return this; - } - - public DiscountsBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public DiscountsBuilder includedInMrr(Boolean value) { - this.includedInMrr = value; - return this; - } - - public DiscountsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DiscountsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public DiscountsBuilder operationType(OperationType value) { - this.operationType = value; - return this; - } - - public DiscountsBuilder id(String value) { - this.id = value; - return this; - } - - public DiscountsBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public DiscountsBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public DiscountsParams build() { - return new DiscountsParams(this); - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIC_ITEM_PRICE("specific_item_price"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum DurationType { - ONE_TIME("one_time"), - - FOREVER("forever"), - - LIMITED_PERIOD("limited_period"), - - /** An enum member indicating that DurationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DurationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DurationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DurationType enumValue : DurationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum OperationType { - ADD("add"), - - REMOVE("remove"), - - /** An enum member indicating that OperationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - OperationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OperationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (OperationType enumValue : OperationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemTiersParams { - - private final String itemPriceId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private final String rampTierId; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - - this.rampTierId = builder.rampTierId; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - public String getRampTierId() { - return rampTierId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - if (this.rampTierId != null) { - - formData.put("ramp_tier_id", this.rampTierId); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private String itemPriceId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private String rampTierId; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersBuilder rampTierId(String value) { - this.rampTierId = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CouponsParams { - - private final String id; - - private final Timestamp startDate; - - private final Timestamp endDate; - - private CouponsParams(CouponsBuilder builder) { - - this.id = builder.id; - - this.startDate = builder.startDate; - - this.endDate = builder.endDate; - } - - public String getId() { - return id; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getEndDate() { - return endDate; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - return formData; - } - - /** Create a new builder for CouponsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CouponsBuilder builder() { - return new CouponsBuilder(); - } - - public static final class CouponsBuilder { - - private String id; - - private Timestamp startDate; - - private Timestamp endDate; - - private CouponsBuilder() {} - - public CouponsBuilder id(String value) { - this.id = value; - return this; - } - - public CouponsBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public CouponsBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public CouponsParams build() { - return new CouponsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteForItemsParams.java b/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteForItemsParams.java new file mode 100644 index 00000000..f9937815 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteForItemsParams.java @@ -0,0 +1,2992 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class EditUpdateSubscriptionQuoteForItemsParams { + + private final String notes; + + private final Timestamp expiresAt; + + private final List mandatoryItemsToRemove; + + private final Boolean replaceItemsList; + + private final Integer billingCycles; + + private final Integer termsToCharge; + + private final Timestamp reactivateFrom; + + private final BillingAlignmentMode billingAlignmentMode; + + private final List couponIds; + + private final Boolean replaceCouponList; + + private final ChangeOption changeOption; + + private final Timestamp changesScheduledAt; + + private final Boolean forceTermReset; + + private final Boolean reactivate; + + private final Integer netTermDays; + + private final SubscriptionParams subscription; + + private final BillingAddressParams billingAddress; + + private final ShippingAddressParams shippingAddress; + + private final CustomerParams customer; + + private final ContractTermParams contractTerm; + + private final List subscriptionItems; + + private final List discounts; + + private final List itemTiers; + + private final List coupons; + + private final Map customFields; + + private EditUpdateSubscriptionQuoteForItemsParams( + EditUpdateSubscriptionQuoteForItemsBuilder builder) { + + this.notes = builder.notes; + + this.expiresAt = builder.expiresAt; + + this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; + + this.replaceItemsList = builder.replaceItemsList; + + this.billingCycles = builder.billingCycles; + + this.termsToCharge = builder.termsToCharge; + + this.reactivateFrom = builder.reactivateFrom; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.couponIds = builder.couponIds; + + this.replaceCouponList = builder.replaceCouponList; + + this.changeOption = builder.changeOption; + + this.changesScheduledAt = builder.changesScheduledAt; + + this.forceTermReset = builder.forceTermReset; + + this.reactivate = builder.reactivate; + + this.netTermDays = builder.netTermDays; + + this.subscription = builder.subscription; + + this.billingAddress = builder.billingAddress; + + this.shippingAddress = builder.shippingAddress; + + this.customer = builder.customer; + + this.contractTerm = builder.contractTerm; + + this.subscriptionItems = builder.subscriptionItems; + + this.discounts = builder.discounts; + + this.itemTiers = builder.itemTiers; + + this.coupons = builder.coupons; + + this.customFields = + builder.customFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); + } + + public String getNotes() { + return notes; + } + + public Timestamp getExpiresAt() { + return expiresAt; + } + + public List getMandatoryItemsToRemove() { + return mandatoryItemsToRemove; + } + + public Boolean getReplaceItemsList() { + return replaceItemsList; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public Timestamp getReactivateFrom() { + return reactivateFrom; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public List getCouponIds() { + return couponIds; + } + + public Boolean getReplaceCouponList() { + return replaceCouponList; + } + + public ChangeOption getChangeOption() { + return changeOption; + } + + public Timestamp getChangesScheduledAt() { + return changesScheduledAt; + } + + public Boolean getForceTermReset() { + return forceTermReset; + } + + public Boolean getReactivate() { + return reactivate; + } + + public Integer getNetTermDays() { + return netTermDays; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + public BillingAddressParams getBillingAddress() { + return billingAddress; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public CustomerParams getCustomer() { + return customer; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public List getSubscriptionItems() { + return subscriptionItems; + } + + public List getDiscounts() { + return discounts; + } + + public List getItemTiers() { + return itemTiers; + } + + public List getCoupons() { + return coupons; + } + + public Map customFields() { + return customFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.notes != null) { + + formData.put("notes", this.notes); + } + + if (this.expiresAt != null) { + + formData.put("expires_at", this.expiresAt); + } + + if (this.mandatoryItemsToRemove != null) { + + formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); + } + + if (this.replaceItemsList != null) { + + formData.put("replace_items_list", this.replaceItemsList); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.reactivateFrom != null) { + + formData.put("reactivate_from", this.reactivateFrom); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.replaceCouponList != null) { + + formData.put("replace_coupon_list", this.replaceCouponList); + } + + if (this.changeOption != null) { + + formData.put("change_option", this.changeOption); + } + + if (this.changesScheduledAt != null) { + + formData.put("changes_scheduled_at", this.changesScheduledAt); + } + + if (this.forceTermReset != null) { + + formData.put("force_term_reset", this.forceTermReset); + } + + if (this.reactivate != null) { + + formData.put("reactivate", this.reactivate); + } + + if (this.netTermDays != null) { + + formData.put("net_term_days", this.netTermDays); + } + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.billingAddress != null) { + + // Single object + Map nestedData = this.billingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.customer != null) { + + // Single object + Map nestedData = this.customer.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "customer[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.subscriptionItems != null) { + + // List of objects + for (int i = 0; i < this.subscriptionItems.size(); i++) { + SubscriptionItemsParams item = this.subscriptionItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discounts != null) { + + // List of objects + for (int i = 0; i < this.discounts.size(); i++) { + DiscountsParams item = this.discounts.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.coupons != null) { + + // List of objects + for (int i = 0; i < this.coupons.size(); i++) { + CouponsParams item = this.coupons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(customFields); + + return formData; + } + + /** Create a new builder for EditUpdateSubscriptionQuoteForItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EditUpdateSubscriptionQuoteForItemsBuilder builder() { + return new EditUpdateSubscriptionQuoteForItemsBuilder(); + } + + public static final class EditUpdateSubscriptionQuoteForItemsBuilder { + + private String notes; + + private Timestamp expiresAt; + + private List mandatoryItemsToRemove; + + private Boolean replaceItemsList; + + private Integer billingCycles; + + private Integer termsToCharge; + + private Timestamp reactivateFrom; + + private BillingAlignmentMode billingAlignmentMode; + + private List couponIds; + + private Boolean replaceCouponList; + + private ChangeOption changeOption; + + private Timestamp changesScheduledAt; + + private Boolean forceTermReset; + + private Boolean reactivate; + + private Integer netTermDays; + + private SubscriptionParams subscription; + + private BillingAddressParams billingAddress; + + private ShippingAddressParams shippingAddress; + + private CustomerParams customer; + + private ContractTermParams contractTerm; + + private List subscriptionItems; + + private List discounts; + + private List itemTiers; + + private List coupons; + + private Map customFields = new LinkedHashMap<>(); + + private EditUpdateSubscriptionQuoteForItemsBuilder() {} + + public EditUpdateSubscriptionQuoteForItemsBuilder notes(String value) { + this.notes = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder expiresAt(Timestamp value) { + this.expiresAt = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder mandatoryItemsToRemove(List value) { + this.mandatoryItemsToRemove = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder replaceItemsList(Boolean value) { + this.replaceItemsList = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder reactivateFrom(Timestamp value) { + this.reactivateFrom = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder billingAlignmentMode( + BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder replaceCouponList(Boolean value) { + this.replaceCouponList = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder changeOption(ChangeOption value) { + this.changeOption = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder changesScheduledAt(Timestamp value) { + this.changesScheduledAt = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder forceTermReset(Boolean value) { + this.forceTermReset = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder reactivate(Boolean value) { + this.reactivate = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder netTermDays(Integer value) { + this.netTermDays = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder subscription(SubscriptionParams value) { + this.subscription = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder billingAddress(BillingAddressParams value) { + this.billingAddress = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder customer(CustomerParams value) { + this.customer = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder subscriptionItems( + List value) { + this.subscriptionItems = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder discounts(List value) { + this.discounts = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder itemTiers(List value) { + this.itemTiers = value; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsBuilder coupons(List value) { + this.coupons = value; + return this; + } + + /** + * Add a custom field to the request. Custom fields must start with "cf_". + * + * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") + * @param value the value of the custom field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cf_" + */ + public EditUpdateSubscriptionQuoteForItemsBuilder customField(String fieldName, String value) { + if (fieldName == null || !fieldName.startsWith("cf_")) { + throw new IllegalArgumentException("Custom field name must start with 'cf_'"); + } + this.customFields.put(fieldName, value); + return this; + } + + /** + * Add multiple custom fields to the request. All field names must start with "cf_". + * + * @param customFields map of custom field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cf_" + */ + public EditUpdateSubscriptionQuoteForItemsBuilder customFields( + Map customFields) { + if (customFields != null) { + for (Map.Entry entry : customFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { + throw new IllegalArgumentException( + "Custom field name must start with 'cf_': " + entry.getKey()); + } + this.customFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public EditUpdateSubscriptionQuoteForItemsParams build() { + return new EditUpdateSubscriptionQuoteForItemsParams(this); + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChangeOption { + IMMEDIATELY("immediately"), + + SPECIFIC_DATE("specific_date"), + + /** An enum member indicating that ChangeOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChangeOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChangeOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChangeOption enumValue : ChangeOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionParams { + + private final Long setupFee; + + private final Timestamp startDate; + + private final Timestamp trialEnd; + + private final String coupon; + + private final AutoCollection autoCollection; + + private final OfflinePaymentMethod offlinePaymentMethod; + + private final Integer contractTermBillingCycleOnRenewal; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.setupFee = builder.setupFee; + + this.startDate = builder.startDate; + + this.trialEnd = builder.trialEnd; + + this.coupon = builder.coupon; + + this.autoCollection = builder.autoCollection; + + this.offlinePaymentMethod = builder.offlinePaymentMethod; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + } + + public Long getSetupFee() { + return setupFee; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public String getCoupon() { + return coupon; + } + + public AutoCollection getAutoCollection() { + return autoCollection; + } + + public OfflinePaymentMethod getOfflinePaymentMethod() { + return offlinePaymentMethod; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.coupon != null) { + + formData.put("coupon", this.coupon); + } + + if (this.autoCollection != null) { + + formData.put("auto_collection", this.autoCollection); + } + + if (this.offlinePaymentMethod != null) { + + formData.put("offline_payment_method", this.offlinePaymentMethod); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private Long setupFee; + + private Timestamp startDate; + + private Timestamp trialEnd; + + private String coupon; + + private AutoCollection autoCollection; + + private OfflinePaymentMethod offlinePaymentMethod; + + private Integer contractTermBillingCycleOnRenewal; + + private SubscriptionBuilder() {} + + @Deprecated + public SubscriptionBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + @Deprecated + public SubscriptionBuilder coupon(String value) { + this.coupon = value; + return this; + } + + public SubscriptionBuilder autoCollection(AutoCollection value) { + this.autoCollection = value; + return this; + } + + public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + this.offlinePaymentMethod = value; + return this; + } + + public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + + public enum AutoCollection { + ON("on"), + + OFF("off"), + + /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AutoCollection(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AutoCollection fromString(String value) { + if (value == null) return _UNKNOWN; + for (AutoCollection enumValue : AutoCollection.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class BillingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private BillingAddressParams(BillingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for BillingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingAddressBuilder builder() { + return new BillingAddressBuilder(); + } + + public static final class BillingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private BillingAddressBuilder() {} + + public BillingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public BillingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public BillingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public BillingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public BillingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public BillingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public BillingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public BillingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public BillingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public BillingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public BillingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public BillingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public BillingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public BillingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public BillingAddressParams build() { + return new BillingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CustomerParams { + + private final String vatNumber; + + private final String vatNumberPrefix; + + private final Boolean registeredForGst; + + private CustomerParams(CustomerBuilder builder) { + + this.vatNumber = builder.vatNumber; + + this.vatNumberPrefix = builder.vatNumberPrefix; + + this.registeredForGst = builder.registeredForGst; + } + + public String getVatNumber() { + return vatNumber; + } + + public String getVatNumberPrefix() { + return vatNumberPrefix; + } + + public Boolean getRegisteredForGst() { + return registeredForGst; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.vatNumber != null) { + + formData.put("vat_number", this.vatNumber); + } + + if (this.vatNumberPrefix != null) { + + formData.put("vat_number_prefix", this.vatNumberPrefix); + } + + if (this.registeredForGst != null) { + + formData.put("registered_for_gst", this.registeredForGst); + } + + return formData; + } + + /** Create a new builder for CustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerBuilder builder() { + return new CustomerBuilder(); + } + + public static final class CustomerBuilder { + + private String vatNumber; + + private String vatNumberPrefix; + + private Boolean registeredForGst; + + private CustomerBuilder() {} + + public CustomerBuilder vatNumber(String value) { + this.vatNumber = value; + return this; + } + + public CustomerBuilder vatNumberPrefix(String value) { + this.vatNumberPrefix = value; + return this; + } + + public CustomerBuilder registeredForGst(Boolean value) { + this.registeredForGst = value; + return this; + } + + public CustomerParams build() { + return new CustomerParams(this); + } + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + RENEW_ONCE("renew_once"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class SubscriptionItemsParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Timestamp trialEnd; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ChargeOnOption chargeOnOption; + + private final ItemType itemType; + + private final Timestamp startDate; + + private final Timestamp endDate; + + private final String rampTierId; + + private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.trialEnd = builder.trialEnd; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.chargeOnOption = builder.chargeOnOption; + + this.itemType = builder.itemType; + + this.startDate = builder.startDate; + + this.endDate = builder.endDate; + + this.rampTierId = builder.rampTierId; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ChargeOnOption getChargeOnOption() { + return chargeOnOption; + } + + public ItemType getItemType() { + return itemType; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getEndDate() { + return endDate; + } + + public String getRampTierId() { + return rampTierId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.chargeOnOption != null) { + + formData.put("charge_on_option", this.chargeOnOption); + } + + if (this.itemType != null) { + + formData.put("item_type", this.itemType); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + if (this.rampTierId != null) { + + formData.put("ramp_tier_id", this.rampTierId); + } + + return formData; + } + + /** Create a new builder for SubscriptionItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionItemsBuilder builder() { + return new SubscriptionItemsBuilder(); + } + + public static final class SubscriptionItemsBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Timestamp trialEnd; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ChargeOnOption chargeOnOption; + + private ItemType itemType; + + private Timestamp startDate; + + private Timestamp endDate; + + private String rampTierId; + + private SubscriptionItemsBuilder() {} + + public SubscriptionItemsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public SubscriptionItemsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public SubscriptionItemsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public SubscriptionItemsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public SubscriptionItemsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionItemsBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { + this.chargeOnOption = value; + return this; + } + + public SubscriptionItemsBuilder itemType(ItemType value) { + this.itemType = value; + return this; + } + + public SubscriptionItemsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionItemsBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public SubscriptionItemsBuilder rampTierId(String value) { + this.rampTierId = value; + return this; + } + + public SubscriptionItemsParams build() { + return new SubscriptionItemsParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnOption { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnOption enumValue : ChargeOnOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ItemType { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemType enumValue : ItemType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class DiscountsParams { + + private final ApplyOn applyOn; + + private final DurationType durationType; + + private final Number percentage; + + private final Long amount; + + private final Integer period; + + private final PeriodUnit periodUnit; + + private final Boolean includedInMrr; + + private final String itemPriceId; + + private final Integer quantity; + + private final OperationType operationType; + + private final String id; + + private final Timestamp startDate; + + private final Timestamp endDate; + + private DiscountsParams(DiscountsBuilder builder) { + + this.applyOn = builder.applyOn; + + this.durationType = builder.durationType; + + this.percentage = builder.percentage; + + this.amount = builder.amount; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + + this.includedInMrr = builder.includedInMrr; + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.operationType = builder.operationType; + + this.id = builder.id; + + this.startDate = builder.startDate; + + this.endDate = builder.endDate; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public DurationType getDurationType() { + return durationType; + } + + public Number getPercentage() { + return percentage; + } + + public Long getAmount() { + return amount; + } + + public Integer getPeriod() { + return period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public Boolean getIncludedInMrr() { + return includedInMrr; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public OperationType getOperationType() { + return operationType; + } + + public String getId() { + return id; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getEndDate() { + return endDate; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.durationType != null) { + + formData.put("duration_type", this.durationType); + } + + if (this.percentage != null) { + + formData.put("percentage", this.percentage); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.includedInMrr != null) { + + formData.put("included_in_mrr", this.includedInMrr); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.operationType != null) { + + formData.put("operation_type", this.operationType); + } + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + return formData; + } + + /** Create a new builder for DiscountsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsBuilder builder() { + return new DiscountsBuilder(); + } + + public static final class DiscountsBuilder { + + private ApplyOn applyOn; + + private DurationType durationType; + + private Number percentage; + + private Long amount; + + private Integer period; + + private PeriodUnit periodUnit; + + private Boolean includedInMrr; + + private String itemPriceId; + + private Integer quantity; + + private OperationType operationType; + + private String id; + + private Timestamp startDate; + + private Timestamp endDate; + + private DiscountsBuilder() {} + + public DiscountsBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public DiscountsBuilder durationType(DurationType value) { + this.durationType = value; + return this; + } + + public DiscountsBuilder percentage(Number value) { + this.percentage = value; + return this; + } + + public DiscountsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsBuilder period(Integer value) { + this.period = value; + return this; + } + + public DiscountsBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public DiscountsBuilder includedInMrr(Boolean value) { + this.includedInMrr = value; + return this; + } + + public DiscountsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DiscountsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public DiscountsBuilder operationType(OperationType value) { + this.operationType = value; + return this; + } + + public DiscountsBuilder id(String value) { + this.id = value; + return this; + } + + public DiscountsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public DiscountsBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public DiscountsParams build() { + return new DiscountsParams(this); + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIC_ITEM_PRICE("specific_item_price"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum DurationType { + ONE_TIME("one_time"), + + FOREVER("forever"), + + LIMITED_PERIOD("limited_period"), + + /** An enum member indicating that DurationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DurationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DurationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DurationType enumValue : DurationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum OperationType { + ADD("add"), + + REMOVE("remove"), + + /** An enum member indicating that OperationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + OperationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OperationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (OperationType enumValue : OperationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemTiersParams { + + private final String itemPriceId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private final String rampTierId; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + + this.rampTierId = builder.rampTierId; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + public String getRampTierId() { + return rampTierId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + if (this.rampTierId != null) { + + formData.put("ramp_tier_id", this.rampTierId); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private String itemPriceId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private String rampTierId; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersBuilder rampTierId(String value) { + this.rampTierId = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CouponsParams { + + private final String id; + + private final Timestamp startDate; + + private final Timestamp endDate; + + private CouponsParams(CouponsBuilder builder) { + + this.id = builder.id; + + this.startDate = builder.startDate; + + this.endDate = builder.endDate; + } + + public String getId() { + return id; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getEndDate() { + return endDate; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + return formData; + } + + /** Create a new builder for CouponsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponsBuilder builder() { + return new CouponsBuilder(); + } + + public static final class CouponsBuilder { + + private String id; + + private Timestamp startDate; + + private Timestamp endDate; + + private CouponsBuilder() {} + + public CouponsBuilder id(String value) { + this.id = value; + return this; + } + + public CouponsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public CouponsBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public CouponsParams build() { + return new CouponsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteForQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteForQuoteParams.java deleted file mode 100644 index a567836a..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteForQuoteParams.java +++ /dev/null @@ -1,2224 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class EditUpdateSubscriptionQuoteForQuoteParams { - - private final String notes; - - private final Timestamp expiresAt; - - private final Boolean replaceAddonList; - - private final List mandatoryAddonsToRemove; - - private final Integer billingCycles; - - private final Integer termsToCharge; - - private final Timestamp reactivateFrom; - - private final BillingAlignmentMode billingAlignmentMode; - - private final List couponIds; - - private final Boolean replaceCouponList; - - private final ChangeOption changeOption; - - private final Timestamp changesScheduledAt; - - private final Boolean forceTermReset; - - private final Boolean reactivate; - - private final SubscriptionParams subscription; - - private final BillingAddressParams billingAddress; - - private final ShippingAddressParams shippingAddress; - - private final CustomerParams customer; - - private final ContractTermParams contractTerm; - - private final List addons; - - private final List eventBasedAddons; - - private EditUpdateSubscriptionQuoteForQuoteParams( - EditUpdateSubscriptionQuoteForQuoteBuilder builder) { - - this.notes = builder.notes; - - this.expiresAt = builder.expiresAt; - - this.replaceAddonList = builder.replaceAddonList; - - this.mandatoryAddonsToRemove = builder.mandatoryAddonsToRemove; - - this.billingCycles = builder.billingCycles; - - this.termsToCharge = builder.termsToCharge; - - this.reactivateFrom = builder.reactivateFrom; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.couponIds = builder.couponIds; - - this.replaceCouponList = builder.replaceCouponList; - - this.changeOption = builder.changeOption; - - this.changesScheduledAt = builder.changesScheduledAt; - - this.forceTermReset = builder.forceTermReset; - - this.reactivate = builder.reactivate; - - this.subscription = builder.subscription; - - this.billingAddress = builder.billingAddress; - - this.shippingAddress = builder.shippingAddress; - - this.customer = builder.customer; - - this.contractTerm = builder.contractTerm; - - this.addons = builder.addons; - - this.eventBasedAddons = builder.eventBasedAddons; - } - - public String getNotes() { - return notes; - } - - public Timestamp getExpiresAt() { - return expiresAt; - } - - public Boolean getReplaceAddonList() { - return replaceAddonList; - } - - public List getMandatoryAddonsToRemove() { - return mandatoryAddonsToRemove; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public Timestamp getReactivateFrom() { - return reactivateFrom; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public List getCouponIds() { - return couponIds; - } - - public Boolean getReplaceCouponList() { - return replaceCouponList; - } - - public ChangeOption getChangeOption() { - return changeOption; - } - - public Timestamp getChangesScheduledAt() { - return changesScheduledAt; - } - - public Boolean getForceTermReset() { - return forceTermReset; - } - - public Boolean getReactivate() { - return reactivate; - } - - public SubscriptionParams getSubscription() { - return subscription; - } - - public BillingAddressParams getBillingAddress() { - return billingAddress; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public CustomerParams getCustomer() { - return customer; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public List getAddons() { - return addons; - } - - public List getEventBasedAddons() { - return eventBasedAddons; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.notes != null) { - - formData.put("notes", this.notes); - } - - if (this.expiresAt != null) { - - formData.put("expires_at", this.expiresAt); - } - - if (this.replaceAddonList != null) { - - formData.put("replace_addon_list", this.replaceAddonList); - } - - if (this.mandatoryAddonsToRemove != null) { - - formData.put("mandatory_addons_to_remove", this.mandatoryAddonsToRemove); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.reactivateFrom != null) { - - formData.put("reactivate_from", this.reactivateFrom); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.replaceCouponList != null) { - - formData.put("replace_coupon_list", this.replaceCouponList); - } - - if (this.changeOption != null) { - - formData.put("change_option", this.changeOption); - } - - if (this.changesScheduledAt != null) { - - formData.put("changes_scheduled_at", this.changesScheduledAt); - } - - if (this.forceTermReset != null) { - - formData.put("force_term_reset", this.forceTermReset); - } - - if (this.reactivate != null) { - - formData.put("reactivate", this.reactivate); - } - - if (this.subscription != null) { - - // Single object - Map nestedData = this.subscription.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "subscription[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.billingAddress != null) { - - // Single object - Map nestedData = this.billingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.customer != null) { - - // Single object - Map nestedData = this.customer.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "customer[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.addons != null) { - - // List of objects - for (int i = 0; i < this.addons.size(); i++) { - AddonsParams item = this.addons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.eventBasedAddons != null) { - - // List of objects - for (int i = 0; i < this.eventBasedAddons.size(); i++) { - EventBasedAddonsParams item = this.eventBasedAddons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for EditUpdateSubscriptionQuoteForQuoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EditUpdateSubscriptionQuoteForQuoteBuilder builder() { - return new EditUpdateSubscriptionQuoteForQuoteBuilder(); - } - - public static final class EditUpdateSubscriptionQuoteForQuoteBuilder { - - private String notes; - - private Timestamp expiresAt; - - private Boolean replaceAddonList; - - private List mandatoryAddonsToRemove; - - private Integer billingCycles; - - private Integer termsToCharge; - - private Timestamp reactivateFrom; - - private BillingAlignmentMode billingAlignmentMode; - - private List couponIds; - - private Boolean replaceCouponList; - - private ChangeOption changeOption; - - private Timestamp changesScheduledAt; - - private Boolean forceTermReset; - - private Boolean reactivate; - - private SubscriptionParams subscription; - - private BillingAddressParams billingAddress; - - private ShippingAddressParams shippingAddress; - - private CustomerParams customer; - - private ContractTermParams contractTerm; - - private List addons; - - private List eventBasedAddons; - - private EditUpdateSubscriptionQuoteForQuoteBuilder() {} - - public EditUpdateSubscriptionQuoteForQuoteBuilder notes(String value) { - this.notes = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder expiresAt(Timestamp value) { - this.expiresAt = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder replaceAddonList(Boolean value) { - this.replaceAddonList = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder mandatoryAddonsToRemove(List value) { - this.mandatoryAddonsToRemove = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder reactivateFrom(Timestamp value) { - this.reactivateFrom = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder billingAlignmentMode( - BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder replaceCouponList(Boolean value) { - this.replaceCouponList = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder changeOption(ChangeOption value) { - this.changeOption = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder changesScheduledAt(Timestamp value) { - this.changesScheduledAt = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder forceTermReset(Boolean value) { - this.forceTermReset = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder reactivate(Boolean value) { - this.reactivate = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder subscription(SubscriptionParams value) { - this.subscription = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder billingAddress(BillingAddressParams value) { - this.billingAddress = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder shippingAddress(ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder customer(CustomerParams value) { - this.customer = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder addons(List value) { - this.addons = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteBuilder eventBasedAddons( - List value) { - this.eventBasedAddons = value; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteParams build() { - return new EditUpdateSubscriptionQuoteForQuoteParams(this); - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChangeOption { - IMMEDIATELY("immediately"), - - SPECIFIC_DATE("specific_date"), - - /** An enum member indicating that ChangeOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChangeOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChangeOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChangeOption enumValue : ChangeOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionParams { - - private final String planId; - - private final Integer planQuantity; - - private final Long planUnitPrice; - - private final Long setupFee; - - private final String planQuantityInDecimal; - - private final String planUnitPriceInDecimal; - - private final Timestamp startDate; - - private final Timestamp trialEnd; - - private final String coupon; - - private final AutoCollection autoCollection; - - private final OfflinePaymentMethod offlinePaymentMethod; - - private final Integer contractTermBillingCycleOnRenewal; - - private SubscriptionParams(SubscriptionBuilder builder) { - - this.planId = builder.planId; - - this.planQuantity = builder.planQuantity; - - this.planUnitPrice = builder.planUnitPrice; - - this.setupFee = builder.setupFee; - - this.planQuantityInDecimal = builder.planQuantityInDecimal; - - this.planUnitPriceInDecimal = builder.planUnitPriceInDecimal; - - this.startDate = builder.startDate; - - this.trialEnd = builder.trialEnd; - - this.coupon = builder.coupon; - - this.autoCollection = builder.autoCollection; - - this.offlinePaymentMethod = builder.offlinePaymentMethod; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - } - - public String getPlanId() { - return planId; - } - - public Integer getPlanQuantity() { - return planQuantity; - } - - public Long getPlanUnitPrice() { - return planUnitPrice; - } - - public Long getSetupFee() { - return setupFee; - } - - public String getPlanQuantityInDecimal() { - return planQuantityInDecimal; - } - - public String getPlanUnitPriceInDecimal() { - return planUnitPriceInDecimal; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public String getCoupon() { - return coupon; - } - - public AutoCollection getAutoCollection() { - return autoCollection; - } - - public OfflinePaymentMethod getOfflinePaymentMethod() { - return offlinePaymentMethod; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.planId != null) { - - formData.put("plan_id", this.planId); - } - - if (this.planQuantity != null) { - - formData.put("plan_quantity", this.planQuantity); - } - - if (this.planUnitPrice != null) { - - formData.put("plan_unit_price", this.planUnitPrice); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.planQuantityInDecimal != null) { - - formData.put("plan_quantity_in_decimal", this.planQuantityInDecimal); - } - - if (this.planUnitPriceInDecimal != null) { - - formData.put("plan_unit_price_in_decimal", this.planUnitPriceInDecimal); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.coupon != null) { - - formData.put("coupon", this.coupon); - } - - if (this.autoCollection != null) { - - formData.put("auto_collection", this.autoCollection); - } - - if (this.offlinePaymentMethod != null) { - - formData.put("offline_payment_method", this.offlinePaymentMethod); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - return formData; - } - - /** Create a new builder for SubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionBuilder builder() { - return new SubscriptionBuilder(); - } - - public static final class SubscriptionBuilder { - - private String planId; - - private Integer planQuantity; - - private Long planUnitPrice; - - private Long setupFee; - - private String planQuantityInDecimal; - - private String planUnitPriceInDecimal; - - private Timestamp startDate; - - private Timestamp trialEnd; - - private String coupon; - - private AutoCollection autoCollection; - - private OfflinePaymentMethod offlinePaymentMethod; - - private Integer contractTermBillingCycleOnRenewal; - - private SubscriptionBuilder() {} - - public SubscriptionBuilder planId(String value) { - this.planId = value; - return this; - } - - public SubscriptionBuilder planQuantity(Integer value) { - this.planQuantity = value; - return this; - } - - public SubscriptionBuilder planUnitPrice(Long value) { - this.planUnitPrice = value; - return this; - } - - public SubscriptionBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public SubscriptionBuilder planQuantityInDecimal(String value) { - this.planQuantityInDecimal = value; - return this; - } - - public SubscriptionBuilder planUnitPriceInDecimal(String value) { - this.planUnitPriceInDecimal = value; - return this; - } - - public SubscriptionBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public SubscriptionBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - @Deprecated - public SubscriptionBuilder coupon(String value) { - this.coupon = value; - return this; - } - - public SubscriptionBuilder autoCollection(AutoCollection value) { - this.autoCollection = value; - return this; - } - - public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - this.offlinePaymentMethod = value; - return this; - } - - public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public SubscriptionParams build() { - return new SubscriptionParams(this); - } - } - - public enum AutoCollection { - ON("on"), - - OFF("off"), - - /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AutoCollection(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AutoCollection fromString(String value) { - if (value == null) return _UNKNOWN; - for (AutoCollection enumValue : AutoCollection.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class BillingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private BillingAddressParams(BillingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for BillingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingAddressBuilder builder() { - return new BillingAddressBuilder(); - } - - public static final class BillingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private BillingAddressBuilder() {} - - public BillingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public BillingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public BillingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public BillingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public BillingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public BillingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public BillingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public BillingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public BillingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public BillingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public BillingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public BillingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public BillingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public BillingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public BillingAddressParams build() { - return new BillingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CustomerParams { - - private final String vatNumber; - - private final String vatNumberPrefix; - - private final Boolean registeredForGst; - - private CustomerParams(CustomerBuilder builder) { - - this.vatNumber = builder.vatNumber; - - this.vatNumberPrefix = builder.vatNumberPrefix; - - this.registeredForGst = builder.registeredForGst; - } - - public String getVatNumber() { - return vatNumber; - } - - public String getVatNumberPrefix() { - return vatNumberPrefix; - } - - public Boolean getRegisteredForGst() { - return registeredForGst; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.vatNumber != null) { - - formData.put("vat_number", this.vatNumber); - } - - if (this.vatNumberPrefix != null) { - - formData.put("vat_number_prefix", this.vatNumberPrefix); - } - - if (this.registeredForGst != null) { - - formData.put("registered_for_gst", this.registeredForGst); - } - - return formData; - } - - /** Create a new builder for CustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CustomerBuilder builder() { - return new CustomerBuilder(); - } - - public static final class CustomerBuilder { - - private String vatNumber; - - private String vatNumberPrefix; - - private Boolean registeredForGst; - - private CustomerBuilder() {} - - public CustomerBuilder vatNumber(String value) { - this.vatNumber = value; - return this; - } - - public CustomerBuilder vatNumberPrefix(String value) { - this.vatNumberPrefix = value; - return this; - } - - public CustomerBuilder registeredForGst(Boolean value) { - this.registeredForGst = value; - return this; - } - - public CustomerParams build() { - return new CustomerParams(this); - } - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - RENEW_ONCE("renew_once"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class AddonsParams { - - private final String id; - - private final Integer quantity; - - private final Long unitPrice; - - private final Integer billingCycles; - - private final String quantityInDecimal; - - private final String unitPriceInDecimal; - - private final Timestamp trialEnd; - - private AddonsParams(AddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.unitPrice = builder.unitPrice; - - this.billingCycles = builder.billingCycles; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.trialEnd = builder.trialEnd; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - return formData; - } - - /** Create a new builder for AddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddonsBuilder builder() { - return new AddonsBuilder(); - } - - public static final class AddonsBuilder { - - private String id; - - private Integer quantity; - - private Long unitPrice; - - private Integer billingCycles; - - private String quantityInDecimal; - - private String unitPriceInDecimal; - - private Timestamp trialEnd; - - private AddonsBuilder() {} - - public AddonsBuilder id(String value) { - this.id = value; - return this; - } - - public AddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public AddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public AddonsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public AddonsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public AddonsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public AddonsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public AddonsParams build() { - return new AddonsParams(this); - } - } - } - - public static final class EventBasedAddonsParams { - - private final String id; - - private final Integer quantity; - - private final Long unitPrice; - - private final Integer servicePeriodInDays; - - private final ChargeOn chargeOn; - - private final OnEvent onEvent; - - private final Boolean chargeOnce; - - private final String quantityInDecimal; - - private final String unitPriceInDecimal; - - private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.unitPrice = builder.unitPrice; - - this.servicePeriodInDays = builder.servicePeriodInDays; - - this.chargeOn = builder.chargeOn; - - this.onEvent = builder.onEvent; - - this.chargeOnce = builder.chargeOnce; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public Integer getServicePeriodInDays() { - return servicePeriodInDays; - } - - public ChargeOn getChargeOn() { - return chargeOn; - } - - public OnEvent getOnEvent() { - return onEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.servicePeriodInDays != null) { - - formData.put("service_period_in_days", this.servicePeriodInDays); - } - - if (this.chargeOn != null) { - - formData.put("charge_on", this.chargeOn); - } - - if (this.onEvent != null) { - - formData.put("on_event", this.onEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - return formData; - } - - /** Create a new builder for EventBasedAddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EventBasedAddonsBuilder builder() { - return new EventBasedAddonsBuilder(); - } - - public static final class EventBasedAddonsBuilder { - - private String id; - - private Integer quantity; - - private Long unitPrice; - - private Integer servicePeriodInDays; - - private ChargeOn chargeOn; - - private OnEvent onEvent; - - private Boolean chargeOnce; - - private String quantityInDecimal; - - private String unitPriceInDecimal; - - private EventBasedAddonsBuilder() {} - - public EventBasedAddonsBuilder id(String value) { - this.id = value; - return this; - } - - public EventBasedAddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public EventBasedAddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { - this.servicePeriodInDays = value; - return this; - } - - public EventBasedAddonsBuilder chargeOn(ChargeOn value) { - this.chargeOn = value; - return this; - } - - public EventBasedAddonsBuilder onEvent(OnEvent value) { - this.onEvent = value; - return this; - } - - public EventBasedAddonsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public EventBasedAddonsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public EventBasedAddonsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public EventBasedAddonsParams build() { - return new EventBasedAddonsParams(this); - } - } - - public enum ChargeOn { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOn enumValue : ChargeOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum OnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that OnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - OnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (OnEvent enumValue : OnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteParams.java new file mode 100644 index 00000000..6a2298d5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/EditUpdateSubscriptionQuoteParams.java @@ -0,0 +1,2221 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class EditUpdateSubscriptionQuoteParams { + + private final String notes; + + private final Timestamp expiresAt; + + private final Boolean replaceAddonList; + + private final List mandatoryAddonsToRemove; + + private final Integer billingCycles; + + private final Integer termsToCharge; + + private final Timestamp reactivateFrom; + + private final BillingAlignmentMode billingAlignmentMode; + + private final List couponIds; + + private final Boolean replaceCouponList; + + private final ChangeOption changeOption; + + private final Timestamp changesScheduledAt; + + private final Boolean forceTermReset; + + private final Boolean reactivate; + + private final SubscriptionParams subscription; + + private final BillingAddressParams billingAddress; + + private final ShippingAddressParams shippingAddress; + + private final CustomerParams customer; + + private final ContractTermParams contractTerm; + + private final List addons; + + private final List eventBasedAddons; + + private EditUpdateSubscriptionQuoteParams(EditUpdateSubscriptionQuoteBuilder builder) { + + this.notes = builder.notes; + + this.expiresAt = builder.expiresAt; + + this.replaceAddonList = builder.replaceAddonList; + + this.mandatoryAddonsToRemove = builder.mandatoryAddonsToRemove; + + this.billingCycles = builder.billingCycles; + + this.termsToCharge = builder.termsToCharge; + + this.reactivateFrom = builder.reactivateFrom; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.couponIds = builder.couponIds; + + this.replaceCouponList = builder.replaceCouponList; + + this.changeOption = builder.changeOption; + + this.changesScheduledAt = builder.changesScheduledAt; + + this.forceTermReset = builder.forceTermReset; + + this.reactivate = builder.reactivate; + + this.subscription = builder.subscription; + + this.billingAddress = builder.billingAddress; + + this.shippingAddress = builder.shippingAddress; + + this.customer = builder.customer; + + this.contractTerm = builder.contractTerm; + + this.addons = builder.addons; + + this.eventBasedAddons = builder.eventBasedAddons; + } + + public String getNotes() { + return notes; + } + + public Timestamp getExpiresAt() { + return expiresAt; + } + + public Boolean getReplaceAddonList() { + return replaceAddonList; + } + + public List getMandatoryAddonsToRemove() { + return mandatoryAddonsToRemove; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public Timestamp getReactivateFrom() { + return reactivateFrom; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public List getCouponIds() { + return couponIds; + } + + public Boolean getReplaceCouponList() { + return replaceCouponList; + } + + public ChangeOption getChangeOption() { + return changeOption; + } + + public Timestamp getChangesScheduledAt() { + return changesScheduledAt; + } + + public Boolean getForceTermReset() { + return forceTermReset; + } + + public Boolean getReactivate() { + return reactivate; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + public BillingAddressParams getBillingAddress() { + return billingAddress; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public CustomerParams getCustomer() { + return customer; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public List getAddons() { + return addons; + } + + public List getEventBasedAddons() { + return eventBasedAddons; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.notes != null) { + + formData.put("notes", this.notes); + } + + if (this.expiresAt != null) { + + formData.put("expires_at", this.expiresAt); + } + + if (this.replaceAddonList != null) { + + formData.put("replace_addon_list", this.replaceAddonList); + } + + if (this.mandatoryAddonsToRemove != null) { + + formData.put("mandatory_addons_to_remove", this.mandatoryAddonsToRemove); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.reactivateFrom != null) { + + formData.put("reactivate_from", this.reactivateFrom); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.replaceCouponList != null) { + + formData.put("replace_coupon_list", this.replaceCouponList); + } + + if (this.changeOption != null) { + + formData.put("change_option", this.changeOption); + } + + if (this.changesScheduledAt != null) { + + formData.put("changes_scheduled_at", this.changesScheduledAt); + } + + if (this.forceTermReset != null) { + + formData.put("force_term_reset", this.forceTermReset); + } + + if (this.reactivate != null) { + + formData.put("reactivate", this.reactivate); + } + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.billingAddress != null) { + + // Single object + Map nestedData = this.billingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.customer != null) { + + // Single object + Map nestedData = this.customer.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "customer[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.addons != null) { + + // List of objects + for (int i = 0; i < this.addons.size(); i++) { + AddonsParams item = this.addons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.eventBasedAddons != null) { + + // List of objects + for (int i = 0; i < this.eventBasedAddons.size(); i++) { + EventBasedAddonsParams item = this.eventBasedAddons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for EditUpdateSubscriptionQuoteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EditUpdateSubscriptionQuoteBuilder builder() { + return new EditUpdateSubscriptionQuoteBuilder(); + } + + public static final class EditUpdateSubscriptionQuoteBuilder { + + private String notes; + + private Timestamp expiresAt; + + private Boolean replaceAddonList; + + private List mandatoryAddonsToRemove; + + private Integer billingCycles; + + private Integer termsToCharge; + + private Timestamp reactivateFrom; + + private BillingAlignmentMode billingAlignmentMode; + + private List couponIds; + + private Boolean replaceCouponList; + + private ChangeOption changeOption; + + private Timestamp changesScheduledAt; + + private Boolean forceTermReset; + + private Boolean reactivate; + + private SubscriptionParams subscription; + + private BillingAddressParams billingAddress; + + private ShippingAddressParams shippingAddress; + + private CustomerParams customer; + + private ContractTermParams contractTerm; + + private List addons; + + private List eventBasedAddons; + + private EditUpdateSubscriptionQuoteBuilder() {} + + public EditUpdateSubscriptionQuoteBuilder notes(String value) { + this.notes = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder expiresAt(Timestamp value) { + this.expiresAt = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder replaceAddonList(Boolean value) { + this.replaceAddonList = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder mandatoryAddonsToRemove(List value) { + this.mandatoryAddonsToRemove = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder reactivateFrom(Timestamp value) { + this.reactivateFrom = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder billingAlignmentMode(BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder replaceCouponList(Boolean value) { + this.replaceCouponList = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder changeOption(ChangeOption value) { + this.changeOption = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder changesScheduledAt(Timestamp value) { + this.changesScheduledAt = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder forceTermReset(Boolean value) { + this.forceTermReset = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder reactivate(Boolean value) { + this.reactivate = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder subscription(SubscriptionParams value) { + this.subscription = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder billingAddress(BillingAddressParams value) { + this.billingAddress = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder customer(CustomerParams value) { + this.customer = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder addons(List value) { + this.addons = value; + return this; + } + + public EditUpdateSubscriptionQuoteBuilder eventBasedAddons(List value) { + this.eventBasedAddons = value; + return this; + } + + public EditUpdateSubscriptionQuoteParams build() { + return new EditUpdateSubscriptionQuoteParams(this); + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChangeOption { + IMMEDIATELY("immediately"), + + SPECIFIC_DATE("specific_date"), + + /** An enum member indicating that ChangeOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChangeOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChangeOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChangeOption enumValue : ChangeOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionParams { + + private final String planId; + + private final Integer planQuantity; + + private final Long planUnitPrice; + + private final Long setupFee; + + private final String planQuantityInDecimal; + + private final String planUnitPriceInDecimal; + + private final Timestamp startDate; + + private final Timestamp trialEnd; + + private final String coupon; + + private final AutoCollection autoCollection; + + private final OfflinePaymentMethod offlinePaymentMethod; + + private final Integer contractTermBillingCycleOnRenewal; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.planId = builder.planId; + + this.planQuantity = builder.planQuantity; + + this.planUnitPrice = builder.planUnitPrice; + + this.setupFee = builder.setupFee; + + this.planQuantityInDecimal = builder.planQuantityInDecimal; + + this.planUnitPriceInDecimal = builder.planUnitPriceInDecimal; + + this.startDate = builder.startDate; + + this.trialEnd = builder.trialEnd; + + this.coupon = builder.coupon; + + this.autoCollection = builder.autoCollection; + + this.offlinePaymentMethod = builder.offlinePaymentMethod; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + } + + public String getPlanId() { + return planId; + } + + public Integer getPlanQuantity() { + return planQuantity; + } + + public Long getPlanUnitPrice() { + return planUnitPrice; + } + + public Long getSetupFee() { + return setupFee; + } + + public String getPlanQuantityInDecimal() { + return planQuantityInDecimal; + } + + public String getPlanUnitPriceInDecimal() { + return planUnitPriceInDecimal; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public String getCoupon() { + return coupon; + } + + public AutoCollection getAutoCollection() { + return autoCollection; + } + + public OfflinePaymentMethod getOfflinePaymentMethod() { + return offlinePaymentMethod; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.planId != null) { + + formData.put("plan_id", this.planId); + } + + if (this.planQuantity != null) { + + formData.put("plan_quantity", this.planQuantity); + } + + if (this.planUnitPrice != null) { + + formData.put("plan_unit_price", this.planUnitPrice); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.planQuantityInDecimal != null) { + + formData.put("plan_quantity_in_decimal", this.planQuantityInDecimal); + } + + if (this.planUnitPriceInDecimal != null) { + + formData.put("plan_unit_price_in_decimal", this.planUnitPriceInDecimal); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.coupon != null) { + + formData.put("coupon", this.coupon); + } + + if (this.autoCollection != null) { + + formData.put("auto_collection", this.autoCollection); + } + + if (this.offlinePaymentMethod != null) { + + formData.put("offline_payment_method", this.offlinePaymentMethod); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private String planId; + + private Integer planQuantity; + + private Long planUnitPrice; + + private Long setupFee; + + private String planQuantityInDecimal; + + private String planUnitPriceInDecimal; + + private Timestamp startDate; + + private Timestamp trialEnd; + + private String coupon; + + private AutoCollection autoCollection; + + private OfflinePaymentMethod offlinePaymentMethod; + + private Integer contractTermBillingCycleOnRenewal; + + private SubscriptionBuilder() {} + + public SubscriptionBuilder planId(String value) { + this.planId = value; + return this; + } + + public SubscriptionBuilder planQuantity(Integer value) { + this.planQuantity = value; + return this; + } + + public SubscriptionBuilder planUnitPrice(Long value) { + this.planUnitPrice = value; + return this; + } + + public SubscriptionBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionBuilder planQuantityInDecimal(String value) { + this.planQuantityInDecimal = value; + return this; + } + + public SubscriptionBuilder planUnitPriceInDecimal(String value) { + this.planUnitPriceInDecimal = value; + return this; + } + + public SubscriptionBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + @Deprecated + public SubscriptionBuilder coupon(String value) { + this.coupon = value; + return this; + } + + public SubscriptionBuilder autoCollection(AutoCollection value) { + this.autoCollection = value; + return this; + } + + public SubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + this.offlinePaymentMethod = value; + return this; + } + + public SubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + + public enum AutoCollection { + ON("on"), + + OFF("off"), + + /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AutoCollection(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AutoCollection fromString(String value) { + if (value == null) return _UNKNOWN; + for (AutoCollection enumValue : AutoCollection.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class BillingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private BillingAddressParams(BillingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for BillingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingAddressBuilder builder() { + return new BillingAddressBuilder(); + } + + public static final class BillingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private BillingAddressBuilder() {} + + public BillingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public BillingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public BillingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public BillingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public BillingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public BillingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public BillingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public BillingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public BillingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public BillingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public BillingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public BillingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public BillingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public BillingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public BillingAddressParams build() { + return new BillingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CustomerParams { + + private final String vatNumber; + + private final String vatNumberPrefix; + + private final Boolean registeredForGst; + + private CustomerParams(CustomerBuilder builder) { + + this.vatNumber = builder.vatNumber; + + this.vatNumberPrefix = builder.vatNumberPrefix; + + this.registeredForGst = builder.registeredForGst; + } + + public String getVatNumber() { + return vatNumber; + } + + public String getVatNumberPrefix() { + return vatNumberPrefix; + } + + public Boolean getRegisteredForGst() { + return registeredForGst; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.vatNumber != null) { + + formData.put("vat_number", this.vatNumber); + } + + if (this.vatNumberPrefix != null) { + + formData.put("vat_number_prefix", this.vatNumberPrefix); + } + + if (this.registeredForGst != null) { + + formData.put("registered_for_gst", this.registeredForGst); + } + + return formData; + } + + /** Create a new builder for CustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerBuilder builder() { + return new CustomerBuilder(); + } + + public static final class CustomerBuilder { + + private String vatNumber; + + private String vatNumberPrefix; + + private Boolean registeredForGst; + + private CustomerBuilder() {} + + public CustomerBuilder vatNumber(String value) { + this.vatNumber = value; + return this; + } + + public CustomerBuilder vatNumberPrefix(String value) { + this.vatNumberPrefix = value; + return this; + } + + public CustomerBuilder registeredForGst(Boolean value) { + this.registeredForGst = value; + return this; + } + + public CustomerParams build() { + return new CustomerParams(this); + } + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + RENEW_ONCE("renew_once"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class AddonsParams { + + private final String id; + + private final Integer quantity; + + private final Long unitPrice; + + private final Integer billingCycles; + + private final String quantityInDecimal; + + private final String unitPriceInDecimal; + + private final Timestamp trialEnd; + + private AddonsParams(AddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.unitPrice = builder.unitPrice; + + this.billingCycles = builder.billingCycles; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.trialEnd = builder.trialEnd; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + return formData; + } + + /** Create a new builder for AddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddonsBuilder builder() { + return new AddonsBuilder(); + } + + public static final class AddonsBuilder { + + private String id; + + private Integer quantity; + + private Long unitPrice; + + private Integer billingCycles; + + private String quantityInDecimal; + + private String unitPriceInDecimal; + + private Timestamp trialEnd; + + private AddonsBuilder() {} + + public AddonsBuilder id(String value) { + this.id = value; + return this; + } + + public AddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public AddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public AddonsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public AddonsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public AddonsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public AddonsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public AddonsParams build() { + return new AddonsParams(this); + } + } + } + + public static final class EventBasedAddonsParams { + + private final String id; + + private final Integer quantity; + + private final Long unitPrice; + + private final Integer servicePeriodInDays; + + private final ChargeOn chargeOn; + + private final OnEvent onEvent; + + private final Boolean chargeOnce; + + private final String quantityInDecimal; + + private final String unitPriceInDecimal; + + private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.unitPrice = builder.unitPrice; + + this.servicePeriodInDays = builder.servicePeriodInDays; + + this.chargeOn = builder.chargeOn; + + this.onEvent = builder.onEvent; + + this.chargeOnce = builder.chargeOnce; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public Integer getServicePeriodInDays() { + return servicePeriodInDays; + } + + public ChargeOn getChargeOn() { + return chargeOn; + } + + public OnEvent getOnEvent() { + return onEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.servicePeriodInDays != null) { + + formData.put("service_period_in_days", this.servicePeriodInDays); + } + + if (this.chargeOn != null) { + + formData.put("charge_on", this.chargeOn); + } + + if (this.onEvent != null) { + + formData.put("on_event", this.onEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + return formData; + } + + /** Create a new builder for EventBasedAddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EventBasedAddonsBuilder builder() { + return new EventBasedAddonsBuilder(); + } + + public static final class EventBasedAddonsBuilder { + + private String id; + + private Integer quantity; + + private Long unitPrice; + + private Integer servicePeriodInDays; + + private ChargeOn chargeOn; + + private OnEvent onEvent; + + private Boolean chargeOnce; + + private String quantityInDecimal; + + private String unitPriceInDecimal; + + private EventBasedAddonsBuilder() {} + + public EventBasedAddonsBuilder id(String value) { + this.id = value; + return this; + } + + public EventBasedAddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public EventBasedAddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { + this.servicePeriodInDays = value; + return this; + } + + public EventBasedAddonsBuilder chargeOn(ChargeOn value) { + this.chargeOn = value; + return this; + } + + public EventBasedAddonsBuilder onEvent(OnEvent value) { + this.onEvent = value; + return this; + } + + public EventBasedAddonsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public EventBasedAddonsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public EventBasedAddonsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public EventBasedAddonsParams build() { + return new EventBasedAddonsParams(this); + } + } + + public enum ChargeOn { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOn enumValue : ChargeOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum OnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that OnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + OnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (OnEvent enumValue : OnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/ExtendExpiryDateForQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/ExtendExpiryDateForQuoteParams.java deleted file mode 100644 index 86aeeaf6..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/ExtendExpiryDateForQuoteParams.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class ExtendExpiryDateForQuoteParams { - - private final Timestamp validTill; - - private ExtendExpiryDateForQuoteParams(ExtendExpiryDateForQuoteBuilder builder) { - - this.validTill = builder.validTill; - } - - public Timestamp getValidTill() { - return validTill; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.validTill != null) { - - formData.put("valid_till", this.validTill); - } - - return formData; - } - - /** Create a new builder for ExtendExpiryDateForQuoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ExtendExpiryDateForQuoteBuilder builder() { - return new ExtendExpiryDateForQuoteBuilder(); - } - - public static final class ExtendExpiryDateForQuoteBuilder { - - private Timestamp validTill; - - private ExtendExpiryDateForQuoteBuilder() {} - - public ExtendExpiryDateForQuoteBuilder validTill(Timestamp value) { - this.validTill = value; - return this; - } - - public ExtendExpiryDateForQuoteParams build() { - return new ExtendExpiryDateForQuoteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/PdfForQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/PdfForQuoteParams.java deleted file mode 100644 index f93d3e0a..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/PdfForQuoteParams.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class PdfForQuoteParams { - - private final Boolean consolidatedView; - - private final DispositionType dispositionType; - - private PdfForQuoteParams(PdfForQuoteBuilder builder) { - - this.consolidatedView = builder.consolidatedView; - - this.dispositionType = builder.dispositionType; - } - - public Boolean getConsolidatedView() { - return consolidatedView; - } - - public DispositionType getDispositionType() { - return dispositionType; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.consolidatedView != null) { - - formData.put("consolidated_view", this.consolidatedView); - } - - if (this.dispositionType != null) { - - formData.put("disposition_type", this.dispositionType); - } - - return formData; - } - - /** Create a new builder for PdfForQuoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PdfForQuoteBuilder builder() { - return new PdfForQuoteBuilder(); - } - - public static final class PdfForQuoteBuilder { - - private Boolean consolidatedView; - - private DispositionType dispositionType; - - private PdfForQuoteBuilder() {} - - public PdfForQuoteBuilder consolidatedView(Boolean value) { - this.consolidatedView = value; - return this; - } - - public PdfForQuoteBuilder dispositionType(DispositionType value) { - this.dispositionType = value; - return this; - } - - public PdfForQuoteParams build() { - return new PdfForQuoteParams(this); - } - } - - public enum DispositionType { - ATTACHMENT("attachment"), - - INLINE("inline"), - - /** An enum member indicating that DispositionType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DispositionType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DispositionType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DispositionType enumValue : DispositionType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/QuoteConvertParams.java b/src/main/java/com/chargebee/v4/models/quote/params/QuoteConvertParams.java new file mode 100644 index 00000000..2855df84 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/QuoteConvertParams.java @@ -0,0 +1,282 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class QuoteConvertParams { + + private final Timestamp invoiceDate; + + private final Boolean invoiceImmediately; + + private final Boolean createPendingInvoices; + + private final Boolean firstInvoicePending; + + private final SubscriptionParams subscription; + + private QuoteConvertParams(QuoteConvertBuilder builder) { + + this.invoiceDate = builder.invoiceDate; + + this.invoiceImmediately = builder.invoiceImmediately; + + this.createPendingInvoices = builder.createPendingInvoices; + + this.firstInvoicePending = builder.firstInvoicePending; + + this.subscription = builder.subscription; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + public Boolean getCreatePendingInvoices() { + return createPendingInvoices; + } + + public Boolean getFirstInvoicePending() { + return firstInvoicePending; + } + + public SubscriptionParams getSubscription() { + return subscription; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + if (this.createPendingInvoices != null) { + + formData.put("create_pending_invoices", this.createPendingInvoices); + } + + if (this.firstInvoicePending != null) { + + formData.put("first_invoice_pending", this.firstInvoicePending); + } + + if (this.subscription != null) { + + // Single object + Map nestedData = this.subscription.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "subscription[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for QuoteConvertParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static QuoteConvertBuilder builder() { + return new QuoteConvertBuilder(); + } + + public static final class QuoteConvertBuilder { + + private Timestamp invoiceDate; + + private Boolean invoiceImmediately; + + private Boolean createPendingInvoices; + + private Boolean firstInvoicePending; + + private SubscriptionParams subscription; + + private QuoteConvertBuilder() {} + + public QuoteConvertBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public QuoteConvertBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public QuoteConvertBuilder createPendingInvoices(Boolean value) { + this.createPendingInvoices = value; + return this; + } + + public QuoteConvertBuilder firstInvoicePending(Boolean value) { + this.firstInvoicePending = value; + return this; + } + + public QuoteConvertBuilder subscription(SubscriptionParams value) { + this.subscription = value; + return this; + } + + public QuoteConvertParams build() { + return new QuoteConvertParams(this); + } + } + + public static final class SubscriptionParams { + + private final String id; + + private final AutoCollection autoCollection; + + private final String poNumber; + + private final Boolean autoCloseInvoices; + + private SubscriptionParams(SubscriptionBuilder builder) { + + this.id = builder.id; + + this.autoCollection = builder.autoCollection; + + this.poNumber = builder.poNumber; + + this.autoCloseInvoices = builder.autoCloseInvoices; + } + + public String getId() { + return id; + } + + public AutoCollection getAutoCollection() { + return autoCollection; + } + + public String getPoNumber() { + return poNumber; + } + + public Boolean getAutoCloseInvoices() { + return autoCloseInvoices; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.autoCollection != null) { + + formData.put("auto_collection", this.autoCollection); + } + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.autoCloseInvoices != null) { + + formData.put("auto_close_invoices", this.autoCloseInvoices); + } + + return formData; + } + + /** Create a new builder for SubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionBuilder builder() { + return new SubscriptionBuilder(); + } + + public static final class SubscriptionBuilder { + + private String id; + + private AutoCollection autoCollection; + + private String poNumber; + + private Boolean autoCloseInvoices; + + private SubscriptionBuilder() {} + + public SubscriptionBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionBuilder autoCollection(AutoCollection value) { + this.autoCollection = value; + return this; + } + + public SubscriptionBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public SubscriptionBuilder autoCloseInvoices(Boolean value) { + this.autoCloseInvoices = value; + return this; + } + + public SubscriptionParams build() { + return new SubscriptionParams(this); + } + } + + public enum AutoCollection { + ON("on"), + + OFF("off"), + + /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AutoCollection(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AutoCollection fromString(String value) { + if (value == null) return _UNKNOWN; + for (AutoCollection enumValue : AutoCollection.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/QuoteDeleteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/QuoteDeleteParams.java new file mode 100644 index 00000000..ab86bfc3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/QuoteDeleteParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class QuoteDeleteParams { + + private final String comment; + + private QuoteDeleteParams(QuoteDeleteBuilder builder) { + + this.comment = builder.comment; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for QuoteDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static QuoteDeleteBuilder builder() { + return new QuoteDeleteBuilder(); + } + + public static final class QuoteDeleteBuilder { + + private String comment; + + private QuoteDeleteBuilder() {} + + public QuoteDeleteBuilder comment(String value) { + this.comment = value; + return this; + } + + public QuoteDeleteParams build() { + return new QuoteDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/QuoteEditForChargeItemsAndChargesParams.java b/src/main/java/com/chargebee/v4/models/quote/params/QuoteEditForChargeItemsAndChargesParams.java new file mode 100644 index 00000000..3f2475c2 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/QuoteEditForChargeItemsAndChargesParams.java @@ -0,0 +1,1874 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class QuoteEditForChargeItemsAndChargesParams { + + private final String poNumber; + + private final String notes; + + private final Timestamp expiresAt; + + private final String currencyCode; + + private final String coupon; + + private final List couponIds; + + private final BillingAddressParams billingAddress; + + private final ShippingAddressParams shippingAddress; + + private final List itemPrices; + + private final List itemTiers; + + private final List charges; + + private final List discounts; + + private final List taxProvidersFields; + + private QuoteEditForChargeItemsAndChargesParams( + QuoteEditForChargeItemsAndChargesBuilder builder) { + + this.poNumber = builder.poNumber; + + this.notes = builder.notes; + + this.expiresAt = builder.expiresAt; + + this.currencyCode = builder.currencyCode; + + this.coupon = builder.coupon; + + this.couponIds = builder.couponIds; + + this.billingAddress = builder.billingAddress; + + this.shippingAddress = builder.shippingAddress; + + this.itemPrices = builder.itemPrices; + + this.itemTiers = builder.itemTiers; + + this.charges = builder.charges; + + this.discounts = builder.discounts; + + this.taxProvidersFields = builder.taxProvidersFields; + } + + public String getPoNumber() { + return poNumber; + } + + public String getNotes() { + return notes; + } + + public Timestamp getExpiresAt() { + return expiresAt; + } + + public String getCurrencyCode() { + return currencyCode; + } + + public String getCoupon() { + return coupon; + } + + public List getCouponIds() { + return couponIds; + } + + public BillingAddressParams getBillingAddress() { + return billingAddress; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public List getItemPrices() { + return itemPrices; + } + + public List getItemTiers() { + return itemTiers; + } + + public List getCharges() { + return charges; + } + + public List getDiscounts() { + return discounts; + } + + public List getTaxProvidersFields() { + return taxProvidersFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.notes != null) { + + formData.put("notes", this.notes); + } + + if (this.expiresAt != null) { + + formData.put("expires_at", this.expiresAt); + } + + if (this.currencyCode != null) { + + formData.put("currency_code", this.currencyCode); + } + + if (this.coupon != null) { + + formData.put("coupon", this.coupon); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.billingAddress != null) { + + // Single object + Map nestedData = this.billingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.itemPrices != null) { + + // List of objects + for (int i = 0; i < this.itemPrices.size(); i++) { + ItemPricesParams item = this.itemPrices.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_prices[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.charges != null) { + + // List of objects + for (int i = 0; i < this.charges.size(); i++) { + ChargesParams item = this.charges.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "charges[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discounts != null) { + + // List of objects + for (int i = 0; i < this.discounts.size(); i++) { + DiscountsParams item = this.discounts.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.taxProvidersFields != null) { + + // List of objects + for (int i = 0; i < this.taxProvidersFields.size(); i++) { + TaxProvidersFieldsParams item = this.taxProvidersFields.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "tax_providers_fields[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for QuoteEditForChargeItemsAndChargesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static QuoteEditForChargeItemsAndChargesBuilder builder() { + return new QuoteEditForChargeItemsAndChargesBuilder(); + } + + public static final class QuoteEditForChargeItemsAndChargesBuilder { + + private String poNumber; + + private String notes; + + private Timestamp expiresAt; + + private String currencyCode; + + private String coupon; + + private List couponIds; + + private BillingAddressParams billingAddress; + + private ShippingAddressParams shippingAddress; + + private List itemPrices; + + private List itemTiers; + + private List charges; + + private List discounts; + + private List taxProvidersFields; + + private QuoteEditForChargeItemsAndChargesBuilder() {} + + public QuoteEditForChargeItemsAndChargesBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder notes(String value) { + this.notes = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder expiresAt(Timestamp value) { + this.expiresAt = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder currencyCode(String value) { + this.currencyCode = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder coupon(String value) { + this.coupon = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder billingAddress(BillingAddressParams value) { + this.billingAddress = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder itemPrices(List value) { + this.itemPrices = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder itemTiers(List value) { + this.itemTiers = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder charges(List value) { + this.charges = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder discounts(List value) { + this.discounts = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesBuilder taxProvidersFields( + List value) { + this.taxProvidersFields = value; + return this; + } + + public QuoteEditForChargeItemsAndChargesParams build() { + return new QuoteEditForChargeItemsAndChargesParams(this); + } + } + + public static final class BillingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private BillingAddressParams(BillingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for BillingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingAddressBuilder builder() { + return new BillingAddressBuilder(); + } + + public static final class BillingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private BillingAddressBuilder() {} + + public BillingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public BillingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public BillingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public BillingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public BillingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public BillingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public BillingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public BillingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public BillingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public BillingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public BillingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public BillingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public BillingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public BillingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public BillingAddressParams build() { + return new BillingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemPricesParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer servicePeriodDays; + + private ItemPricesParams(ItemPricesBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.servicePeriodDays = builder.servicePeriodDays; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + return formData; + } + + /** Create a new builder for ItemPricesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemPricesBuilder builder() { + return new ItemPricesBuilder(); + } + + public static final class ItemPricesBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer servicePeriodDays; + + private ItemPricesBuilder() {} + + public ItemPricesBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemPricesBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public ItemPricesBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public ItemPricesBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public ItemPricesBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public ItemPricesBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public ItemPricesParams build() { + return new ItemPricesParams(this); + } + } + } + + public static final class ItemTiersParams { + + private final String itemPriceId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private String itemPriceId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ChargesParams { + + private final Long amount; + + private final String amountInDecimal; + + private final String description; + + private final AvalaraSaleType avalaraSaleType; + + private final Integer avalaraTransactionType; + + private final Integer avalaraServiceType; + + private final Integer servicePeriod; + + private ChargesParams(ChargesBuilder builder) { + + this.amount = builder.amount; + + this.amountInDecimal = builder.amountInDecimal; + + this.description = builder.description; + + this.avalaraSaleType = builder.avalaraSaleType; + + this.avalaraTransactionType = builder.avalaraTransactionType; + + this.avalaraServiceType = builder.avalaraServiceType; + + this.servicePeriod = builder.servicePeriod; + } + + public Long getAmount() { + return amount; + } + + public String getAmountInDecimal() { + return amountInDecimal; + } + + public String getDescription() { + return description; + } + + public AvalaraSaleType getAvalaraSaleType() { + return avalaraSaleType; + } + + public Integer getAvalaraTransactionType() { + return avalaraTransactionType; + } + + public Integer getAvalaraServiceType() { + return avalaraServiceType; + } + + public Integer getServicePeriod() { + return servicePeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.amountInDecimal != null) { + + formData.put("amount_in_decimal", this.amountInDecimal); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.avalaraSaleType != null) { + + formData.put("avalara_sale_type", this.avalaraSaleType); + } + + if (this.avalaraTransactionType != null) { + + formData.put("avalara_transaction_type", this.avalaraTransactionType); + } + + if (this.avalaraServiceType != null) { + + formData.put("avalara_service_type", this.avalaraServiceType); + } + + if (this.servicePeriod != null) { + + formData.put("service_period", this.servicePeriod); + } + + return formData; + } + + /** Create a new builder for ChargesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ChargesBuilder builder() { + return new ChargesBuilder(); + } + + public static final class ChargesBuilder { + + private Long amount; + + private String amountInDecimal; + + private String description; + + private AvalaraSaleType avalaraSaleType; + + private Integer avalaraTransactionType; + + private Integer avalaraServiceType; + + private Integer servicePeriod; + + private ChargesBuilder() {} + + public ChargesBuilder amount(Long value) { + this.amount = value; + return this; + } + + public ChargesBuilder amountInDecimal(String value) { + this.amountInDecimal = value; + return this; + } + + public ChargesBuilder description(String value) { + this.description = value; + return this; + } + + public ChargesBuilder avalaraSaleType(AvalaraSaleType value) { + this.avalaraSaleType = value; + return this; + } + + public ChargesBuilder avalaraTransactionType(Integer value) { + this.avalaraTransactionType = value; + return this; + } + + public ChargesBuilder avalaraServiceType(Integer value) { + this.avalaraServiceType = value; + return this; + } + + public ChargesBuilder servicePeriod(Integer value) { + this.servicePeriod = value; + return this; + } + + public ChargesParams build() { + return new ChargesParams(this); + } + } + + public enum AvalaraSaleType { + WHOLESALE("wholesale"), + + RETAIL("retail"), + + CONSUMED("consumed"), + + VENDOR_USE("vendor_use"), + + /** An enum member indicating that AvalaraSaleType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AvalaraSaleType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AvalaraSaleType fromString(String value) { + if (value == null) return _UNKNOWN; + for (AvalaraSaleType enumValue : AvalaraSaleType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class DiscountsParams { + + private final Number percentage; + + private final Integer quantity; + + private final Long amount; + + private final ApplyOn applyOn; + + private final String itemPriceId; + + private DiscountsParams(DiscountsBuilder builder) { + + this.percentage = builder.percentage; + + this.quantity = builder.quantity; + + this.amount = builder.amount; + + this.applyOn = builder.applyOn; + + this.itemPriceId = builder.itemPriceId; + } + + public Number getPercentage() { + return percentage; + } + + public Integer getQuantity() { + return quantity; + } + + public Long getAmount() { + return amount; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public String getItemPriceId() { + return itemPriceId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.percentage != null) { + + formData.put("percentage", this.percentage); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + return formData; + } + + /** Create a new builder for DiscountsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsBuilder builder() { + return new DiscountsBuilder(); + } + + public static final class DiscountsBuilder { + + private Number percentage; + + private Integer quantity; + + private Long amount; + + private ApplyOn applyOn; + + private String itemPriceId; + + private DiscountsBuilder() {} + + public DiscountsBuilder percentage(Number value) { + this.percentage = value; + return this; + } + + public DiscountsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public DiscountsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public DiscountsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DiscountsParams build() { + return new DiscountsParams(this); + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIC_ITEM_PRICE("specific_item_price"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class TaxProvidersFieldsParams { + + private final String providerName; + + private final String fieldId; + + private final String fieldValue; + + private TaxProvidersFieldsParams(TaxProvidersFieldsBuilder builder) { + + this.providerName = builder.providerName; + + this.fieldId = builder.fieldId; + + this.fieldValue = builder.fieldValue; + } + + public String getProviderName() { + return providerName; + } + + public String getFieldId() { + return fieldId; + } + + public String getFieldValue() { + return fieldValue; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.providerName != null) { + + formData.put("provider_name", this.providerName); + } + + if (this.fieldId != null) { + + formData.put("field_id", this.fieldId); + } + + if (this.fieldValue != null) { + + formData.put("field_value", this.fieldValue); + } + + return formData; + } + + /** Create a new builder for TaxProvidersFieldsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TaxProvidersFieldsBuilder builder() { + return new TaxProvidersFieldsBuilder(); + } + + public static final class TaxProvidersFieldsBuilder { + + private String providerName; + + private String fieldId; + + private String fieldValue; + + private TaxProvidersFieldsBuilder() {} + + public TaxProvidersFieldsBuilder providerName(String value) { + this.providerName = value; + return this; + } + + public TaxProvidersFieldsBuilder fieldId(String value) { + this.fieldId = value; + return this; + } + + public TaxProvidersFieldsBuilder fieldValue(String value) { + this.fieldValue = value; + return this; + } + + public TaxProvidersFieldsParams build() { + return new TaxProvidersFieldsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/QuoteExtendExpiryDateParams.java b/src/main/java/com/chargebee/v4/models/quote/params/QuoteExtendExpiryDateParams.java new file mode 100644 index 00000000..2b3d4b54 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/QuoteExtendExpiryDateParams.java @@ -0,0 +1,61 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class QuoteExtendExpiryDateParams { + + private final Timestamp validTill; + + private QuoteExtendExpiryDateParams(QuoteExtendExpiryDateBuilder builder) { + + this.validTill = builder.validTill; + } + + public Timestamp getValidTill() { + return validTill; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.validTill != null) { + + formData.put("valid_till", this.validTill); + } + + return formData; + } + + /** Create a new builder for QuoteExtendExpiryDateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static QuoteExtendExpiryDateBuilder builder() { + return new QuoteExtendExpiryDateBuilder(); + } + + public static final class QuoteExtendExpiryDateBuilder { + + private Timestamp validTill; + + private QuoteExtendExpiryDateBuilder() {} + + public QuoteExtendExpiryDateBuilder validTill(Timestamp value) { + this.validTill = value; + return this; + } + + public QuoteExtendExpiryDateParams build() { + return new QuoteExtendExpiryDateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/QuotePdfParams.java b/src/main/java/com/chargebee/v4/models/quote/params/QuotePdfParams.java new file mode 100644 index 00000000..e3cc6816 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/QuotePdfParams.java @@ -0,0 +1,108 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class QuotePdfParams { + + private final Boolean consolidatedView; + + private final DispositionType dispositionType; + + private QuotePdfParams(QuotePdfBuilder builder) { + + this.consolidatedView = builder.consolidatedView; + + this.dispositionType = builder.dispositionType; + } + + public Boolean getConsolidatedView() { + return consolidatedView; + } + + public DispositionType getDispositionType() { + return dispositionType; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.consolidatedView != null) { + + formData.put("consolidated_view", this.consolidatedView); + } + + if (this.dispositionType != null) { + + formData.put("disposition_type", this.dispositionType); + } + + return formData; + } + + /** Create a new builder for QuotePdfParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static QuotePdfBuilder builder() { + return new QuotePdfBuilder(); + } + + public static final class QuotePdfBuilder { + + private Boolean consolidatedView; + + private DispositionType dispositionType; + + private QuotePdfBuilder() {} + + public QuotePdfBuilder consolidatedView(Boolean value) { + this.consolidatedView = value; + return this; + } + + public QuotePdfBuilder dispositionType(DispositionType value) { + this.dispositionType = value; + return this; + } + + public QuotePdfParams build() { + return new QuotePdfParams(this); + } + } + + public enum DispositionType { + ATTACHMENT("attachment"), + + INLINE("inline"), + + /** An enum member indicating that DispositionType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DispositionType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DispositionType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DispositionType enumValue : DispositionType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/QuoteUpdateStatusParams.java b/src/main/java/com/chargebee/v4/models/quote/params/QuoteUpdateStatusParams.java new file mode 100644 index 00000000..e4b48999 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/params/QuoteUpdateStatusParams.java @@ -0,0 +1,116 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.quote.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class QuoteUpdateStatusParams { + + private final Status status; + + private final String comment; + + private QuoteUpdateStatusParams(QuoteUpdateStatusBuilder builder) { + + this.status = builder.status; + + this.comment = builder.comment; + } + + public Status getStatus() { + return status; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.status != null) { + + formData.put("status", this.status); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for QuoteUpdateStatusParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static QuoteUpdateStatusBuilder builder() { + return new QuoteUpdateStatusBuilder(); + } + + public static final class QuoteUpdateStatusBuilder { + + private Status status; + + private String comment; + + private QuoteUpdateStatusBuilder() {} + + public QuoteUpdateStatusBuilder status(Status value) { + this.status = value; + return this; + } + + public QuoteUpdateStatusBuilder comment(String value) { + this.comment = value; + return this; + } + + public QuoteUpdateStatusParams build() { + return new QuoteUpdateStatusParams(this); + } + } + + public enum Status { + OPEN("open"), + + ACCEPTED("accepted"), + + DECLINED("declined"), + + PROPOSED("proposed"), + + VOIDED("voided"), + + CLOSED("closed"), + + /** An enum member indicating that Status was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Status(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Status fromString(String value) { + if (value == null) return _UNKNOWN; + for (Status enumValue : Status.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/params/UpdateStatusForQuoteParams.java b/src/main/java/com/chargebee/v4/models/quote/params/UpdateStatusForQuoteParams.java deleted file mode 100644 index 8731094f..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/params/UpdateStatusForQuoteParams.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.quote.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UpdateStatusForQuoteParams { - - private final Status status; - - private final String comment; - - private UpdateStatusForQuoteParams(UpdateStatusForQuoteBuilder builder) { - - this.status = builder.status; - - this.comment = builder.comment; - } - - public Status getStatus() { - return status; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.status != null) { - - formData.put("status", this.status); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for UpdateStatusForQuoteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateStatusForQuoteBuilder builder() { - return new UpdateStatusForQuoteBuilder(); - } - - public static final class UpdateStatusForQuoteBuilder { - - private Status status; - - private String comment; - - private UpdateStatusForQuoteBuilder() {} - - public UpdateStatusForQuoteBuilder status(Status value) { - this.status = value; - return this; - } - - public UpdateStatusForQuoteBuilder comment(String value) { - this.comment = value; - return this; - } - - public UpdateStatusForQuoteParams build() { - return new UpdateStatusForQuoteParams(this); - } - } - - public enum Status { - OPEN("open"), - - ACCEPTED("accepted"), - - DECLINED("declined"), - - PROPOSED("proposed"), - - VOIDED("voided"), - - CLOSED("closed"), - - /** An enum member indicating that Status was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Status(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Status fromString(String value) { - if (value == null) return _UNKNOWN; - for (Status enumValue : Status.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/ConvertForQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/ConvertForQuoteResponse.java deleted file mode 100644 index 8f4c2599..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/ConvertForQuoteResponse.java +++ /dev/null @@ -1,262 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import java.util.List; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedRamp.QuotedRamp; - -import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.quotedCharge.QuotedCharge; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ConvertForQuote operation. Contains the response data from the API. - */ -public final class ConvertForQuoteResponse extends BaseResponse { - private final Quote quote; - - private final QuotedSubscription quotedSubscription; - - private final QuotedCharge quotedCharge; - - private final QuotedRamp quotedRamp; - - private final Customer customer; - - private final Subscription subscription; - - private final Invoice invoice; - - private final CreditNote creditNote; - - private final List unbilledCharges; - - private ConvertForQuoteResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedSubscription = builder.quotedSubscription; - - this.quotedCharge = builder.quotedCharge; - - this.quotedRamp = builder.quotedRamp; - - this.customer = builder.customer; - - this.subscription = builder.subscription; - - this.invoice = builder.invoice; - - this.creditNote = builder.creditNote; - - this.unbilledCharges = builder.unbilledCharges; - } - - /** Parse JSON response into ConvertForQuoteResponse object. */ - public static ConvertForQuoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ConvertForQuoteResponse object with HTTP response. */ - public static ConvertForQuoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); - if (__quotedSubscriptionJson != null) { - builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); - } - - String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); - if (__quotedChargeJson != null) { - builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); - } - - String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); - if (__quotedRampJson != null) { - builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); - if (__creditNoteJson != null) { - builder.creditNote(CreditNote.fromJson(__creditNoteJson)); - } - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ConvertForQuoteResponse from JSON", e); - } - } - - /** Create a new builder for ConvertForQuoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ConvertForQuoteResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedSubscription quotedSubscription; - - private QuotedCharge quotedCharge; - - private QuotedRamp quotedRamp; - - private Customer customer; - - private Subscription subscription; - - private Invoice invoice; - - private CreditNote creditNote; - - private List unbilledCharges; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedSubscription(QuotedSubscription quotedSubscription) { - this.quotedSubscription = quotedSubscription; - return this; - } - - public Builder quotedCharge(QuotedCharge quotedCharge) { - this.quotedCharge = quotedCharge; - return this; - } - - public Builder quotedRamp(QuotedRamp quotedRamp) { - this.quotedRamp = quotedRamp; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder creditNote(CreditNote creditNote) { - this.creditNote = creditNote; - return this; - } - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ConvertForQuoteResponse build() { - return new ConvertForQuoteResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedSubscription from the response. */ - public QuotedSubscription getQuotedSubscription() { - return quotedSubscription; - } - - /** Get the quotedCharge from the response. */ - public QuotedCharge getQuotedCharge() { - return quotedCharge; - } - - /** Get the quotedRamp from the response. */ - public QuotedRamp getQuotedRamp() { - return quotedRamp; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the creditNote from the response. */ - public CreditNote getCreditNote() { - return creditNote; - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionForCustomerQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionForCustomerQuoteResponse.java new file mode 100644 index 00000000..16663ef1 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionForCustomerQuoteResponse.java @@ -0,0 +1,104 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreateSubscriptionForCustomerQuote operation. Contains the response + * data from the API. + */ +public final class CreateSubscriptionForCustomerQuoteResponse extends BaseResponse { + private final Quote quote; + + private final QuotedSubscription quotedSubscription; + + private CreateSubscriptionForCustomerQuoteResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedSubscription = builder.quotedSubscription; + } + + /** Parse JSON response into CreateSubscriptionForCustomerQuoteResponse object. */ + public static CreateSubscriptionForCustomerQuoteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into CreateSubscriptionForCustomerQuoteResponse object with HTTP response. + */ + public static CreateSubscriptionForCustomerQuoteResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); + if (__quotedSubscriptionJson != null) { + builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CreateSubscriptionForCustomerQuoteResponse from JSON", e); + } + } + + /** Create a new builder for CreateSubscriptionForCustomerQuoteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreateSubscriptionForCustomerQuoteResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedSubscription quotedSubscription; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedSubscription(QuotedSubscription quotedSubscription) { + this.quotedSubscription = quotedSubscription; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreateSubscriptionForCustomerQuoteResponse build() { + return new CreateSubscriptionForCustomerQuoteResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedSubscription from the response. */ + public QuotedSubscription getQuotedSubscription() { + return quotedSubscription; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionItemsForCustomerQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionItemsForCustomerQuoteResponse.java new file mode 100644 index 00000000..190bcb6e --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionItemsForCustomerQuoteResponse.java @@ -0,0 +1,128 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedRamp.QuotedRamp; + +import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreateSubscriptionItemsForCustomerQuote operation. Contains the + * response data from the API. + */ +public final class CreateSubscriptionItemsForCustomerQuoteResponse extends BaseResponse { + private final Quote quote; + + private final QuotedSubscription quotedSubscription; + + private final QuotedRamp quotedRamp; + + private CreateSubscriptionItemsForCustomerQuoteResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedSubscription = builder.quotedSubscription; + + this.quotedRamp = builder.quotedRamp; + } + + /** Parse JSON response into CreateSubscriptionItemsForCustomerQuoteResponse object. */ + public static CreateSubscriptionItemsForCustomerQuoteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into CreateSubscriptionItemsForCustomerQuoteResponse object with HTTP + * response. + */ + public static CreateSubscriptionItemsForCustomerQuoteResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); + if (__quotedSubscriptionJson != null) { + builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); + } + + String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); + if (__quotedRampJson != null) { + builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse CreateSubscriptionItemsForCustomerQuoteResponse from JSON", e); + } + } + + /** Create a new builder for CreateSubscriptionItemsForCustomerQuoteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreateSubscriptionItemsForCustomerQuoteResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedSubscription quotedSubscription; + + private QuotedRamp quotedRamp; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedSubscription(QuotedSubscription quotedSubscription) { + this.quotedSubscription = quotedSubscription; + return this; + } + + public Builder quotedRamp(QuotedRamp quotedRamp) { + this.quotedRamp = quotedRamp; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreateSubscriptionItemsForCustomerQuoteResponse build() { + return new CreateSubscriptionItemsForCustomerQuoteResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedSubscription from the response. */ + public QuotedSubscription getQuotedSubscription() { + return quotedSubscription; + } + + /** Get the quotedRamp from the response. */ + public QuotedRamp getQuotedRamp() { + return quotedRamp; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionQuoteForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionQuoteForCustomerResponse.java deleted file mode 100644 index 557dea48..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionQuoteForCustomerResponse.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CreateSubscriptionQuoteForCustomer operation. Contains the response - * data from the API. - */ -public final class CreateSubscriptionQuoteForCustomerResponse extends BaseResponse { - private final Quote quote; - - private final QuotedSubscription quotedSubscription; - - private CreateSubscriptionQuoteForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedSubscription = builder.quotedSubscription; - } - - /** Parse JSON response into CreateSubscriptionQuoteForCustomerResponse object. */ - public static CreateSubscriptionQuoteForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into CreateSubscriptionQuoteForCustomerResponse object with HTTP response. - */ - public static CreateSubscriptionQuoteForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); - if (__quotedSubscriptionJson != null) { - builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse CreateSubscriptionQuoteForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for CreateSubscriptionQuoteForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CreateSubscriptionQuoteForCustomerResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedSubscription quotedSubscription; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedSubscription(QuotedSubscription quotedSubscription) { - this.quotedSubscription = quotedSubscription; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CreateSubscriptionQuoteForCustomerResponse build() { - return new CreateSubscriptionQuoteForCustomerResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedSubscription from the response. */ - public QuotedSubscription getQuotedSubscription() { - return quotedSubscription; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionQuoteForItemsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionQuoteForItemsForCustomerResponse.java deleted file mode 100644 index b06c8744..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/CreateSubscriptionQuoteForItemsForCustomerResponse.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedRamp.QuotedRamp; - -import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CreateSubscriptionQuoteForItemsForCustomer operation. Contains the - * response data from the API. - */ -public final class CreateSubscriptionQuoteForItemsForCustomerResponse extends BaseResponse { - private final Quote quote; - - private final QuotedSubscription quotedSubscription; - - private final QuotedRamp quotedRamp; - - private CreateSubscriptionQuoteForItemsForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedSubscription = builder.quotedSubscription; - - this.quotedRamp = builder.quotedRamp; - } - - /** Parse JSON response into CreateSubscriptionQuoteForItemsForCustomerResponse object. */ - public static CreateSubscriptionQuoteForItemsForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into CreateSubscriptionQuoteForItemsForCustomerResponse object with HTTP - * response. - */ - public static CreateSubscriptionQuoteForItemsForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); - if (__quotedSubscriptionJson != null) { - builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); - } - - String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); - if (__quotedRampJson != null) { - builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse CreateSubscriptionQuoteForItemsForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for CreateSubscriptionQuoteForItemsForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CreateSubscriptionQuoteForItemsForCustomerResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedSubscription quotedSubscription; - - private QuotedRamp quotedRamp; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedSubscription(QuotedSubscription quotedSubscription) { - this.quotedSubscription = quotedSubscription; - return this; - } - - public Builder quotedRamp(QuotedRamp quotedRamp) { - this.quotedRamp = quotedRamp; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CreateSubscriptionQuoteForItemsForCustomerResponse build() { - return new CreateSubscriptionQuoteForItemsForCustomerResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedSubscription from the response. */ - public QuotedSubscription getQuotedSubscription() { - return quotedSubscription; - } - - /** Get the quotedRamp from the response. */ - public QuotedRamp getQuotedRamp() { - return quotedRamp; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/DeleteQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/DeleteQuoteResponse.java deleted file mode 100644 index 693fc255..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/DeleteQuoteResponse.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedRamp.QuotedRamp; - -import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; - -import com.chargebee.v4.models.quotedCharge.QuotedCharge; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** Immutable response object for DeleteQuote operation. Contains the response data from the API. */ -public final class DeleteQuoteResponse extends BaseResponse { - private final Quote quote; - - private final QuotedSubscription quotedSubscription; - - private final QuotedCharge quotedCharge; - - private final QuotedRamp quotedRamp; - - private DeleteQuoteResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedSubscription = builder.quotedSubscription; - - this.quotedCharge = builder.quotedCharge; - - this.quotedRamp = builder.quotedRamp; - } - - /** Parse JSON response into DeleteQuoteResponse object. */ - public static DeleteQuoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteQuoteResponse object with HTTP response. */ - public static DeleteQuoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); - if (__quotedSubscriptionJson != null) { - builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); - } - - String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); - if (__quotedChargeJson != null) { - builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); - } - - String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); - if (__quotedRampJson != null) { - builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteQuoteResponse from JSON", e); - } - } - - /** Create a new builder for DeleteQuoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteQuoteResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedSubscription quotedSubscription; - - private QuotedCharge quotedCharge; - - private QuotedRamp quotedRamp; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedSubscription(QuotedSubscription quotedSubscription) { - this.quotedSubscription = quotedSubscription; - return this; - } - - public Builder quotedCharge(QuotedCharge quotedCharge) { - this.quotedCharge = quotedCharge; - return this; - } - - public Builder quotedRamp(QuotedRamp quotedRamp) { - this.quotedRamp = quotedRamp; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteQuoteResponse build() { - return new DeleteQuoteResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedSubscription from the response. */ - public QuotedSubscription getQuotedSubscription() { - return quotedSubscription; - } - - /** Get the quotedCharge from the response. */ - public QuotedCharge getQuotedCharge() { - return quotedCharge; - } - - /** Get the quotedRamp from the response. */ - public QuotedRamp getQuotedRamp() { - return quotedRamp; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionCustomerQuoteForItemsResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionCustomerQuoteForItemsResponse.java new file mode 100644 index 00000000..d081dc1e --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionCustomerQuoteForItemsResponse.java @@ -0,0 +1,128 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedRamp.QuotedRamp; + +import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for EditCreateSubscriptionCustomerQuoteForItems operation. Contains the + * response data from the API. + */ +public final class EditCreateSubscriptionCustomerQuoteForItemsResponse extends BaseResponse { + private final Quote quote; + + private final QuotedSubscription quotedSubscription; + + private final QuotedRamp quotedRamp; + + private EditCreateSubscriptionCustomerQuoteForItemsResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedSubscription = builder.quotedSubscription; + + this.quotedRamp = builder.quotedRamp; + } + + /** Parse JSON response into EditCreateSubscriptionCustomerQuoteForItemsResponse object. */ + public static EditCreateSubscriptionCustomerQuoteForItemsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into EditCreateSubscriptionCustomerQuoteForItemsResponse object with HTTP + * response. + */ + public static EditCreateSubscriptionCustomerQuoteForItemsResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); + if (__quotedSubscriptionJson != null) { + builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); + } + + String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); + if (__quotedRampJson != null) { + builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse EditCreateSubscriptionCustomerQuoteForItemsResponse from JSON", e); + } + } + + /** Create a new builder for EditCreateSubscriptionCustomerQuoteForItemsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for EditCreateSubscriptionCustomerQuoteForItemsResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedSubscription quotedSubscription; + + private QuotedRamp quotedRamp; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedSubscription(QuotedSubscription quotedSubscription) { + this.quotedSubscription = quotedSubscription; + return this; + } + + public Builder quotedRamp(QuotedRamp quotedRamp) { + this.quotedRamp = quotedRamp; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public EditCreateSubscriptionCustomerQuoteForItemsResponse build() { + return new EditCreateSubscriptionCustomerQuoteForItemsResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedSubscription from the response. */ + public QuotedSubscription getQuotedSubscription() { + return quotedSubscription; + } + + /** Get the quotedRamp from the response. */ + public QuotedRamp getQuotedRamp() { + return quotedRamp; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionForCustomerQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionForCustomerQuoteResponse.java new file mode 100644 index 00000000..159d51d1 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionForCustomerQuoteResponse.java @@ -0,0 +1,105 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for EditCreateSubscriptionForCustomerQuote operation. Contains the + * response data from the API. + */ +public final class EditCreateSubscriptionForCustomerQuoteResponse extends BaseResponse { + private final Quote quote; + + private final QuotedSubscription quotedSubscription; + + private EditCreateSubscriptionForCustomerQuoteResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedSubscription = builder.quotedSubscription; + } + + /** Parse JSON response into EditCreateSubscriptionForCustomerQuoteResponse object. */ + public static EditCreateSubscriptionForCustomerQuoteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into EditCreateSubscriptionForCustomerQuoteResponse object with HTTP + * response. + */ + public static EditCreateSubscriptionForCustomerQuoteResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); + if (__quotedSubscriptionJson != null) { + builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse EditCreateSubscriptionForCustomerQuoteResponse from JSON", e); + } + } + + /** Create a new builder for EditCreateSubscriptionForCustomerQuoteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for EditCreateSubscriptionForCustomerQuoteResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedSubscription quotedSubscription; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedSubscription(QuotedSubscription quotedSubscription) { + this.quotedSubscription = quotedSubscription; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public EditCreateSubscriptionForCustomerQuoteResponse build() { + return new EditCreateSubscriptionForCustomerQuoteResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedSubscription from the response. */ + public QuotedSubscription getQuotedSubscription() { + return quotedSubscription; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionQuoteForItemsForQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionQuoteForItemsForQuoteResponse.java deleted file mode 100644 index 0cc5ed36..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionQuoteForItemsForQuoteResponse.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedRamp.QuotedRamp; - -import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for EditCreateSubscriptionQuoteForItemsForQuote operation. Contains the - * response data from the API. - */ -public final class EditCreateSubscriptionQuoteForItemsForQuoteResponse extends BaseResponse { - private final Quote quote; - - private final QuotedSubscription quotedSubscription; - - private final QuotedRamp quotedRamp; - - private EditCreateSubscriptionQuoteForItemsForQuoteResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedSubscription = builder.quotedSubscription; - - this.quotedRamp = builder.quotedRamp; - } - - /** Parse JSON response into EditCreateSubscriptionQuoteForItemsForQuoteResponse object. */ - public static EditCreateSubscriptionQuoteForItemsForQuoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into EditCreateSubscriptionQuoteForItemsForQuoteResponse object with HTTP - * response. - */ - public static EditCreateSubscriptionQuoteForItemsForQuoteResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); - if (__quotedSubscriptionJson != null) { - builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); - } - - String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); - if (__quotedRampJson != null) { - builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse EditCreateSubscriptionQuoteForItemsForQuoteResponse from JSON", e); - } - } - - /** Create a new builder for EditCreateSubscriptionQuoteForItemsForQuoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for EditCreateSubscriptionQuoteForItemsForQuoteResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedSubscription quotedSubscription; - - private QuotedRamp quotedRamp; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedSubscription(QuotedSubscription quotedSubscription) { - this.quotedSubscription = quotedSubscription; - return this; - } - - public Builder quotedRamp(QuotedRamp quotedRamp) { - this.quotedRamp = quotedRamp; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public EditCreateSubscriptionQuoteForItemsForQuoteResponse build() { - return new EditCreateSubscriptionQuoteForItemsForQuoteResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedSubscription from the response. */ - public QuotedSubscription getQuotedSubscription() { - return quotedSubscription; - } - - /** Get the quotedRamp from the response. */ - public QuotedRamp getQuotedRamp() { - return quotedRamp; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionQuoteForQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionQuoteForQuoteResponse.java deleted file mode 100644 index 39ddf2ec..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/EditCreateSubscriptionQuoteForQuoteResponse.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for EditCreateSubscriptionQuoteForQuote operation. Contains the - * response data from the API. - */ -public final class EditCreateSubscriptionQuoteForQuoteResponse extends BaseResponse { - private final Quote quote; - - private final QuotedSubscription quotedSubscription; - - private EditCreateSubscriptionQuoteForQuoteResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedSubscription = builder.quotedSubscription; - } - - /** Parse JSON response into EditCreateSubscriptionQuoteForQuoteResponse object. */ - public static EditCreateSubscriptionQuoteForQuoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into EditCreateSubscriptionQuoteForQuoteResponse object with HTTP response. - */ - public static EditCreateSubscriptionQuoteForQuoteResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); - if (__quotedSubscriptionJson != null) { - builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse EditCreateSubscriptionQuoteForQuoteResponse from JSON", e); - } - } - - /** Create a new builder for EditCreateSubscriptionQuoteForQuoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for EditCreateSubscriptionQuoteForQuoteResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedSubscription quotedSubscription; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedSubscription(QuotedSubscription quotedSubscription) { - this.quotedSubscription = quotedSubscription; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public EditCreateSubscriptionQuoteForQuoteResponse build() { - return new EditCreateSubscriptionQuoteForQuoteResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedSubscription from the response. */ - public QuotedSubscription getQuotedSubscription() { - return quotedSubscription; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/EditForChargeItemsAndChargesForQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/EditForChargeItemsAndChargesForQuoteResponse.java deleted file mode 100644 index 08ba414d..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/EditForChargeItemsAndChargesForQuoteResponse.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedCharge.QuotedCharge; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for EditForChargeItemsAndChargesForQuote operation. Contains the - * response data from the API. - */ -public final class EditForChargeItemsAndChargesForQuoteResponse extends BaseResponse { - private final Quote quote; - - private final QuotedCharge quotedCharge; - - private EditForChargeItemsAndChargesForQuoteResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedCharge = builder.quotedCharge; - } - - /** Parse JSON response into EditForChargeItemsAndChargesForQuoteResponse object. */ - public static EditForChargeItemsAndChargesForQuoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into EditForChargeItemsAndChargesForQuoteResponse object with HTTP - * response. - */ - public static EditForChargeItemsAndChargesForQuoteResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); - if (__quotedChargeJson != null) { - builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse EditForChargeItemsAndChargesForQuoteResponse from JSON", e); - } - } - - /** Create a new builder for EditForChargeItemsAndChargesForQuoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for EditForChargeItemsAndChargesForQuoteResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedCharge quotedCharge; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedCharge(QuotedCharge quotedCharge) { - this.quotedCharge = quotedCharge; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public EditForChargeItemsAndChargesForQuoteResponse build() { - return new EditForChargeItemsAndChargesForQuoteResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedCharge from the response. */ - public QuotedCharge getQuotedCharge() { - return quotedCharge; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/EditOneTimeQuoteForQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/EditOneTimeQuoteForQuoteResponse.java deleted file mode 100644 index b787d3a8..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/EditOneTimeQuoteForQuoteResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedCharge.QuotedCharge; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for EditOneTimeQuoteForQuote operation. Contains the response data from - * the API. - */ -public final class EditOneTimeQuoteForQuoteResponse extends BaseResponse { - private final Quote quote; - - private final QuotedCharge quotedCharge; - - private EditOneTimeQuoteForQuoteResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedCharge = builder.quotedCharge; - } - - /** Parse JSON response into EditOneTimeQuoteForQuoteResponse object. */ - public static EditOneTimeQuoteForQuoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into EditOneTimeQuoteForQuoteResponse object with HTTP response. */ - public static EditOneTimeQuoteForQuoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); - if (__quotedChargeJson != null) { - builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse EditOneTimeQuoteForQuoteResponse from JSON", e); - } - } - - /** Create a new builder for EditOneTimeQuoteForQuoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for EditOneTimeQuoteForQuoteResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedCharge quotedCharge; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedCharge(QuotedCharge quotedCharge) { - this.quotedCharge = quotedCharge; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public EditOneTimeQuoteForQuoteResponse build() { - return new EditOneTimeQuoteForQuoteResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedCharge from the response. */ - public QuotedCharge getQuotedCharge() { - return quotedCharge; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/EditOneTimeQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/EditOneTimeQuoteResponse.java new file mode 100644 index 00000000..b0290dee --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/EditOneTimeQuoteResponse.java @@ -0,0 +1,100 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedCharge.QuotedCharge; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for EditOneTimeQuote operation. Contains the response data from the + * API. + */ +public final class EditOneTimeQuoteResponse extends BaseResponse { + private final Quote quote; + + private final QuotedCharge quotedCharge; + + private EditOneTimeQuoteResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedCharge = builder.quotedCharge; + } + + /** Parse JSON response into EditOneTimeQuoteResponse object. */ + public static EditOneTimeQuoteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into EditOneTimeQuoteResponse object with HTTP response. */ + public static EditOneTimeQuoteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); + if (__quotedChargeJson != null) { + builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse EditOneTimeQuoteResponse from JSON", e); + } + } + + /** Create a new builder for EditOneTimeQuoteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for EditOneTimeQuoteResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedCharge quotedCharge; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedCharge(QuotedCharge quotedCharge) { + this.quotedCharge = quotedCharge; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public EditOneTimeQuoteResponse build() { + return new EditOneTimeQuoteResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedCharge from the response. */ + public QuotedCharge getQuotedCharge() { + return quotedCharge; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteForItemsForQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteForItemsForQuoteResponse.java deleted file mode 100644 index cd7dd66d..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteForItemsForQuoteResponse.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedRamp.QuotedRamp; - -import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for EditUpdateSubscriptionQuoteForItemsForQuote operation. Contains the - * response data from the API. - */ -public final class EditUpdateSubscriptionQuoteForItemsForQuoteResponse extends BaseResponse { - private final Quote quote; - - private final QuotedSubscription quotedSubscription; - - private final QuotedRamp quotedRamp; - - private EditUpdateSubscriptionQuoteForItemsForQuoteResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedSubscription = builder.quotedSubscription; - - this.quotedRamp = builder.quotedRamp; - } - - /** Parse JSON response into EditUpdateSubscriptionQuoteForItemsForQuoteResponse object. */ - public static EditUpdateSubscriptionQuoteForItemsForQuoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into EditUpdateSubscriptionQuoteForItemsForQuoteResponse object with HTTP - * response. - */ - public static EditUpdateSubscriptionQuoteForItemsForQuoteResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); - if (__quotedSubscriptionJson != null) { - builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); - } - - String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); - if (__quotedRampJson != null) { - builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse EditUpdateSubscriptionQuoteForItemsForQuoteResponse from JSON", e); - } - } - - /** Create a new builder for EditUpdateSubscriptionQuoteForItemsForQuoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for EditUpdateSubscriptionQuoteForItemsForQuoteResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedSubscription quotedSubscription; - - private QuotedRamp quotedRamp; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedSubscription(QuotedSubscription quotedSubscription) { - this.quotedSubscription = quotedSubscription; - return this; - } - - public Builder quotedRamp(QuotedRamp quotedRamp) { - this.quotedRamp = quotedRamp; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public EditUpdateSubscriptionQuoteForItemsForQuoteResponse build() { - return new EditUpdateSubscriptionQuoteForItemsForQuoteResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedSubscription from the response. */ - public QuotedSubscription getQuotedSubscription() { - return quotedSubscription; - } - - /** Get the quotedRamp from the response. */ - public QuotedRamp getQuotedRamp() { - return quotedRamp; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteForItemsResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteForItemsResponse.java new file mode 100644 index 00000000..8c2efa35 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteForItemsResponse.java @@ -0,0 +1,127 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedRamp.QuotedRamp; + +import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for EditUpdateSubscriptionQuoteForItems operation. Contains the + * response data from the API. + */ +public final class EditUpdateSubscriptionQuoteForItemsResponse extends BaseResponse { + private final Quote quote; + + private final QuotedSubscription quotedSubscription; + + private final QuotedRamp quotedRamp; + + private EditUpdateSubscriptionQuoteForItemsResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedSubscription = builder.quotedSubscription; + + this.quotedRamp = builder.quotedRamp; + } + + /** Parse JSON response into EditUpdateSubscriptionQuoteForItemsResponse object. */ + public static EditUpdateSubscriptionQuoteForItemsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into EditUpdateSubscriptionQuoteForItemsResponse object with HTTP response. + */ + public static EditUpdateSubscriptionQuoteForItemsResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); + if (__quotedSubscriptionJson != null) { + builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); + } + + String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); + if (__quotedRampJson != null) { + builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse EditUpdateSubscriptionQuoteForItemsResponse from JSON", e); + } + } + + /** Create a new builder for EditUpdateSubscriptionQuoteForItemsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for EditUpdateSubscriptionQuoteForItemsResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedSubscription quotedSubscription; + + private QuotedRamp quotedRamp; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedSubscription(QuotedSubscription quotedSubscription) { + this.quotedSubscription = quotedSubscription; + return this; + } + + public Builder quotedRamp(QuotedRamp quotedRamp) { + this.quotedRamp = quotedRamp; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public EditUpdateSubscriptionQuoteForItemsResponse build() { + return new EditUpdateSubscriptionQuoteForItemsResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedSubscription from the response. */ + public QuotedSubscription getQuotedSubscription() { + return quotedSubscription; + } + + /** Get the quotedRamp from the response. */ + public QuotedRamp getQuotedRamp() { + return quotedRamp; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteForQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteForQuoteResponse.java deleted file mode 100644 index 6c1a8b43..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteForQuoteResponse.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for EditUpdateSubscriptionQuoteForQuote operation. Contains the - * response data from the API. - */ -public final class EditUpdateSubscriptionQuoteForQuoteResponse extends BaseResponse { - private final Quote quote; - - private final QuotedSubscription quotedSubscription; - - private EditUpdateSubscriptionQuoteForQuoteResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedSubscription = builder.quotedSubscription; - } - - /** Parse JSON response into EditUpdateSubscriptionQuoteForQuoteResponse object. */ - public static EditUpdateSubscriptionQuoteForQuoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into EditUpdateSubscriptionQuoteForQuoteResponse object with HTTP response. - */ - public static EditUpdateSubscriptionQuoteForQuoteResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); - if (__quotedSubscriptionJson != null) { - builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse EditUpdateSubscriptionQuoteForQuoteResponse from JSON", e); - } - } - - /** Create a new builder for EditUpdateSubscriptionQuoteForQuoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for EditUpdateSubscriptionQuoteForQuoteResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedSubscription quotedSubscription; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedSubscription(QuotedSubscription quotedSubscription) { - this.quotedSubscription = quotedSubscription; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public EditUpdateSubscriptionQuoteForQuoteResponse build() { - return new EditUpdateSubscriptionQuoteForQuoteResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedSubscription from the response. */ - public QuotedSubscription getQuotedSubscription() { - return quotedSubscription; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteResponse.java new file mode 100644 index 00000000..210a425a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/EditUpdateSubscriptionQuoteResponse.java @@ -0,0 +1,101 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for EditUpdateSubscriptionQuote operation. Contains the response data + * from the API. + */ +public final class EditUpdateSubscriptionQuoteResponse extends BaseResponse { + private final Quote quote; + + private final QuotedSubscription quotedSubscription; + + private EditUpdateSubscriptionQuoteResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedSubscription = builder.quotedSubscription; + } + + /** Parse JSON response into EditUpdateSubscriptionQuoteResponse object. */ + public static EditUpdateSubscriptionQuoteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into EditUpdateSubscriptionQuoteResponse object with HTTP response. */ + public static EditUpdateSubscriptionQuoteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); + if (__quotedSubscriptionJson != null) { + builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse EditUpdateSubscriptionQuoteResponse from JSON", e); + } + } + + /** Create a new builder for EditUpdateSubscriptionQuoteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for EditUpdateSubscriptionQuoteResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedSubscription quotedSubscription; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedSubscription(QuotedSubscription quotedSubscription) { + this.quotedSubscription = quotedSubscription; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public EditUpdateSubscriptionQuoteResponse build() { + return new EditUpdateSubscriptionQuoteResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedSubscription from the response. */ + public QuotedSubscription getQuotedSubscription() { + return quotedSubscription; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/ExtendExpiryDateForQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/ExtendExpiryDateForQuoteResponse.java deleted file mode 100644 index ee3ee476..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/ExtendExpiryDateForQuoteResponse.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedRamp.QuotedRamp; - -import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; - -import com.chargebee.v4.models.quotedCharge.QuotedCharge; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ExtendExpiryDateForQuote operation. Contains the response data from - * the API. - */ -public final class ExtendExpiryDateForQuoteResponse extends BaseResponse { - private final Quote quote; - - private final QuotedSubscription quotedSubscription; - - private final QuotedCharge quotedCharge; - - private final QuotedRamp quotedRamp; - - private ExtendExpiryDateForQuoteResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedSubscription = builder.quotedSubscription; - - this.quotedCharge = builder.quotedCharge; - - this.quotedRamp = builder.quotedRamp; - } - - /** Parse JSON response into ExtendExpiryDateForQuoteResponse object. */ - public static ExtendExpiryDateForQuoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ExtendExpiryDateForQuoteResponse object with HTTP response. */ - public static ExtendExpiryDateForQuoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); - if (__quotedSubscriptionJson != null) { - builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); - } - - String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); - if (__quotedChargeJson != null) { - builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); - } - - String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); - if (__quotedRampJson != null) { - builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ExtendExpiryDateForQuoteResponse from JSON", e); - } - } - - /** Create a new builder for ExtendExpiryDateForQuoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ExtendExpiryDateForQuoteResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedSubscription quotedSubscription; - - private QuotedCharge quotedCharge; - - private QuotedRamp quotedRamp; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedSubscription(QuotedSubscription quotedSubscription) { - this.quotedSubscription = quotedSubscription; - return this; - } - - public Builder quotedCharge(QuotedCharge quotedCharge) { - this.quotedCharge = quotedCharge; - return this; - } - - public Builder quotedRamp(QuotedRamp quotedRamp) { - this.quotedRamp = quotedRamp; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ExtendExpiryDateForQuoteResponse build() { - return new ExtendExpiryDateForQuoteResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedSubscription from the response. */ - public QuotedSubscription getQuotedSubscription() { - return quotedSubscription; - } - - /** Get the quotedCharge from the response. */ - public QuotedCharge getQuotedCharge() { - return quotedCharge; - } - - /** Get the quotedRamp from the response. */ - public QuotedRamp getQuotedRamp() { - return quotedRamp; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/PdfForQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/PdfForQuoteResponse.java deleted file mode 100644 index 15db5234..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/PdfForQuoteResponse.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.download.Download; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** Immutable response object for PdfForQuote operation. Contains the response data from the API. */ -public final class PdfForQuoteResponse extends BaseResponse { - private final Download download; - - private PdfForQuoteResponse(Builder builder) { - super(builder.httpResponse); - - this.download = builder.download; - } - - /** Parse JSON response into PdfForQuoteResponse object. */ - public static PdfForQuoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into PdfForQuoteResponse object with HTTP response. */ - public static PdfForQuoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __downloadJson = JsonUtil.getObject(json, "download"); - if (__downloadJson != null) { - builder.download(Download.fromJson(__downloadJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse PdfForQuoteResponse from JSON", e); - } - } - - /** Create a new builder for PdfForQuoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for PdfForQuoteResponse. */ - public static class Builder { - - private Download download; - - private Response httpResponse; - - private Builder() {} - - public Builder download(Download download) { - this.download = download; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public PdfForQuoteResponse build() { - return new PdfForQuoteResponse(this); - } - } - - /** Get the download from the response. */ - public Download getDownload() { - return download; - } -} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/QuoteConvertResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteConvertResponse.java new file mode 100644 index 00000000..da4b9d86 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteConvertResponse.java @@ -0,0 +1,262 @@ +package com.chargebee.v4.models.quote.responses; + +import java.util.List; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedRamp.QuotedRamp; + +import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.quotedCharge.QuotedCharge; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for QuoteConvert operation. Contains the response data from the API. + */ +public final class QuoteConvertResponse extends BaseResponse { + private final Quote quote; + + private final QuotedSubscription quotedSubscription; + + private final QuotedCharge quotedCharge; + + private final QuotedRamp quotedRamp; + + private final Customer customer; + + private final Subscription subscription; + + private final Invoice invoice; + + private final CreditNote creditNote; + + private final List unbilledCharges; + + private QuoteConvertResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedSubscription = builder.quotedSubscription; + + this.quotedCharge = builder.quotedCharge; + + this.quotedRamp = builder.quotedRamp; + + this.customer = builder.customer; + + this.subscription = builder.subscription; + + this.invoice = builder.invoice; + + this.creditNote = builder.creditNote; + + this.unbilledCharges = builder.unbilledCharges; + } + + /** Parse JSON response into QuoteConvertResponse object. */ + public static QuoteConvertResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into QuoteConvertResponse object with HTTP response. */ + public static QuoteConvertResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); + if (__quotedSubscriptionJson != null) { + builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); + } + + String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); + if (__quotedChargeJson != null) { + builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); + } + + String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); + if (__quotedRampJson != null) { + builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + String __creditNoteJson = JsonUtil.getObject(json, "credit_note"); + if (__creditNoteJson != null) { + builder.creditNote(CreditNote.fromJson(__creditNoteJson)); + } + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse QuoteConvertResponse from JSON", e); + } + } + + /** Create a new builder for QuoteConvertResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for QuoteConvertResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedSubscription quotedSubscription; + + private QuotedCharge quotedCharge; + + private QuotedRamp quotedRamp; + + private Customer customer; + + private Subscription subscription; + + private Invoice invoice; + + private CreditNote creditNote; + + private List unbilledCharges; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedSubscription(QuotedSubscription quotedSubscription) { + this.quotedSubscription = quotedSubscription; + return this; + } + + public Builder quotedCharge(QuotedCharge quotedCharge) { + this.quotedCharge = quotedCharge; + return this; + } + + public Builder quotedRamp(QuotedRamp quotedRamp) { + this.quotedRamp = quotedRamp; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder creditNote(CreditNote creditNote) { + this.creditNote = creditNote; + return this; + } + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public QuoteConvertResponse build() { + return new QuoteConvertResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedSubscription from the response. */ + public QuotedSubscription getQuotedSubscription() { + return quotedSubscription; + } + + /** Get the quotedCharge from the response. */ + public QuotedCharge getQuotedCharge() { + return quotedCharge; + } + + /** Get the quotedRamp from the response. */ + public QuotedRamp getQuotedRamp() { + return quotedRamp; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the creditNote from the response. */ + public CreditNote getCreditNote() { + return creditNote; + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/QuoteDeleteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteDeleteResponse.java new file mode 100644 index 00000000..863df81b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteDeleteResponse.java @@ -0,0 +1,143 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedRamp.QuotedRamp; + +import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; + +import com.chargebee.v4.models.quotedCharge.QuotedCharge; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for QuoteDelete operation. Contains the response data from the API. */ +public final class QuoteDeleteResponse extends BaseResponse { + private final Quote quote; + + private final QuotedSubscription quotedSubscription; + + private final QuotedCharge quotedCharge; + + private final QuotedRamp quotedRamp; + + private QuoteDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedSubscription = builder.quotedSubscription; + + this.quotedCharge = builder.quotedCharge; + + this.quotedRamp = builder.quotedRamp; + } + + /** Parse JSON response into QuoteDeleteResponse object. */ + public static QuoteDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into QuoteDeleteResponse object with HTTP response. */ + public static QuoteDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); + if (__quotedSubscriptionJson != null) { + builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); + } + + String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); + if (__quotedChargeJson != null) { + builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); + } + + String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); + if (__quotedRampJson != null) { + builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse QuoteDeleteResponse from JSON", e); + } + } + + /** Create a new builder for QuoteDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for QuoteDeleteResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedSubscription quotedSubscription; + + private QuotedCharge quotedCharge; + + private QuotedRamp quotedRamp; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedSubscription(QuotedSubscription quotedSubscription) { + this.quotedSubscription = quotedSubscription; + return this; + } + + public Builder quotedCharge(QuotedCharge quotedCharge) { + this.quotedCharge = quotedCharge; + return this; + } + + public Builder quotedRamp(QuotedRamp quotedRamp) { + this.quotedRamp = quotedRamp; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public QuoteDeleteResponse build() { + return new QuoteDeleteResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedSubscription from the response. */ + public QuotedSubscription getQuotedSubscription() { + return quotedSubscription; + } + + /** Get the quotedCharge from the response. */ + public QuotedCharge getQuotedCharge() { + return quotedCharge; + } + + /** Get the quotedRamp from the response. */ + public QuotedRamp getQuotedRamp() { + return quotedRamp; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/QuoteEditForChargeItemsAndChargesResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteEditForChargeItemsAndChargesResponse.java new file mode 100644 index 00000000..76f9c521 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteEditForChargeItemsAndChargesResponse.java @@ -0,0 +1,104 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedCharge.QuotedCharge; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for QuoteEditForChargeItemsAndCharges operation. Contains the response + * data from the API. + */ +public final class QuoteEditForChargeItemsAndChargesResponse extends BaseResponse { + private final Quote quote; + + private final QuotedCharge quotedCharge; + + private QuoteEditForChargeItemsAndChargesResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedCharge = builder.quotedCharge; + } + + /** Parse JSON response into QuoteEditForChargeItemsAndChargesResponse object. */ + public static QuoteEditForChargeItemsAndChargesResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into QuoteEditForChargeItemsAndChargesResponse object with HTTP response. + */ + public static QuoteEditForChargeItemsAndChargesResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); + if (__quotedChargeJson != null) { + builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse QuoteEditForChargeItemsAndChargesResponse from JSON", e); + } + } + + /** Create a new builder for QuoteEditForChargeItemsAndChargesResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for QuoteEditForChargeItemsAndChargesResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedCharge quotedCharge; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedCharge(QuotedCharge quotedCharge) { + this.quotedCharge = quotedCharge; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public QuoteEditForChargeItemsAndChargesResponse build() { + return new QuoteEditForChargeItemsAndChargesResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedCharge from the response. */ + public QuotedCharge getQuotedCharge() { + return quotedCharge; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/QuoteExtendExpiryDateResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteExtendExpiryDateResponse.java new file mode 100644 index 00000000..88a36f7b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteExtendExpiryDateResponse.java @@ -0,0 +1,146 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedRamp.QuotedRamp; + +import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; + +import com.chargebee.v4.models.quotedCharge.QuotedCharge; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for QuoteExtendExpiryDate operation. Contains the response data from + * the API. + */ +public final class QuoteExtendExpiryDateResponse extends BaseResponse { + private final Quote quote; + + private final QuotedSubscription quotedSubscription; + + private final QuotedCharge quotedCharge; + + private final QuotedRamp quotedRamp; + + private QuoteExtendExpiryDateResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedSubscription = builder.quotedSubscription; + + this.quotedCharge = builder.quotedCharge; + + this.quotedRamp = builder.quotedRamp; + } + + /** Parse JSON response into QuoteExtendExpiryDateResponse object. */ + public static QuoteExtendExpiryDateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into QuoteExtendExpiryDateResponse object with HTTP response. */ + public static QuoteExtendExpiryDateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); + if (__quotedSubscriptionJson != null) { + builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); + } + + String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); + if (__quotedChargeJson != null) { + builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); + } + + String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); + if (__quotedRampJson != null) { + builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse QuoteExtendExpiryDateResponse from JSON", e); + } + } + + /** Create a new builder for QuoteExtendExpiryDateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for QuoteExtendExpiryDateResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedSubscription quotedSubscription; + + private QuotedCharge quotedCharge; + + private QuotedRamp quotedRamp; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedSubscription(QuotedSubscription quotedSubscription) { + this.quotedSubscription = quotedSubscription; + return this; + } + + public Builder quotedCharge(QuotedCharge quotedCharge) { + this.quotedCharge = quotedCharge; + return this; + } + + public Builder quotedRamp(QuotedRamp quotedRamp) { + this.quotedRamp = quotedRamp; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public QuoteExtendExpiryDateResponse build() { + return new QuoteExtendExpiryDateResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedSubscription from the response. */ + public QuotedSubscription getQuotedSubscription() { + return quotedSubscription; + } + + /** Get the quotedCharge from the response. */ + public QuotedCharge getQuotedCharge() { + return quotedCharge; + } + + /** Get the quotedRamp from the response. */ + public QuotedRamp getQuotedRamp() { + return quotedRamp; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/QuoteLineGroupsForQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteLineGroupsForQuoteResponse.java index 98b73985..3c3706fb 100644 --- a/src/main/java/com/chargebee/v4/models/quote/responses/QuoteLineGroupsForQuoteResponse.java +++ b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteLineGroupsForQuoteResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.quoteLineGroup.QuoteLineGroup; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.QuoteService; @@ -107,9 +108,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public QuoteLineGroupsForQuoteResponse nextPage() throws Exception { + public QuoteLineGroupsForQuoteResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/QuoteListResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteListResponse.java index bbd5af83..4a6b645e 100644 --- a/src/main/java/com/chargebee/v4/models/quote/responses/QuoteListResponse.java +++ b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteListResponse.java @@ -8,6 +8,7 @@ import com.chargebee.v4.models.quotedRamp.QuotedRamp; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.QuoteService; @@ -99,9 +100,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public QuoteListResponse nextPage() throws Exception { + public QuoteListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/QuotePdfResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/QuotePdfResponse.java new file mode 100644 index 00000000..14b81125 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/QuotePdfResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.download.Download; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for QuotePdf operation. Contains the response data from the API. */ +public final class QuotePdfResponse extends BaseResponse { + private final Download download; + + private QuotePdfResponse(Builder builder) { + super(builder.httpResponse); + + this.download = builder.download; + } + + /** Parse JSON response into QuotePdfResponse object. */ + public static QuotePdfResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into QuotePdfResponse object with HTTP response. */ + public static QuotePdfResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __downloadJson = JsonUtil.getObject(json, "download"); + if (__downloadJson != null) { + builder.download(Download.fromJson(__downloadJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse QuotePdfResponse from JSON", e); + } + } + + /** Create a new builder for QuotePdfResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for QuotePdfResponse. */ + public static class Builder { + + private Download download; + + private Response httpResponse; + + private Builder() {} + + public Builder download(Download download) { + this.download = download; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public QuotePdfResponse build() { + return new QuotePdfResponse(this); + } + } + + /** Get the download from the response. */ + public Download getDownload() { + return download; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/QuoteUpdateStatusResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteUpdateStatusResponse.java new file mode 100644 index 00000000..ad79eece --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/quote/responses/QuoteUpdateStatusResponse.java @@ -0,0 +1,146 @@ +package com.chargebee.v4.models.quote.responses; + +import com.chargebee.v4.models.quote.Quote; + +import com.chargebee.v4.models.quotedRamp.QuotedRamp; + +import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; + +import com.chargebee.v4.models.quotedCharge.QuotedCharge; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for QuoteUpdateStatus operation. Contains the response data from the + * API. + */ +public final class QuoteUpdateStatusResponse extends BaseResponse { + private final Quote quote; + + private final QuotedSubscription quotedSubscription; + + private final QuotedCharge quotedCharge; + + private final QuotedRamp quotedRamp; + + private QuoteUpdateStatusResponse(Builder builder) { + super(builder.httpResponse); + + this.quote = builder.quote; + + this.quotedSubscription = builder.quotedSubscription; + + this.quotedCharge = builder.quotedCharge; + + this.quotedRamp = builder.quotedRamp; + } + + /** Parse JSON response into QuoteUpdateStatusResponse object. */ + public static QuoteUpdateStatusResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into QuoteUpdateStatusResponse object with HTTP response. */ + public static QuoteUpdateStatusResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __quoteJson = JsonUtil.getObject(json, "quote"); + if (__quoteJson != null) { + builder.quote(Quote.fromJson(__quoteJson)); + } + + String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); + if (__quotedSubscriptionJson != null) { + builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); + } + + String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); + if (__quotedChargeJson != null) { + builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); + } + + String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); + if (__quotedRampJson != null) { + builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse QuoteUpdateStatusResponse from JSON", e); + } + } + + /** Create a new builder for QuoteUpdateStatusResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for QuoteUpdateStatusResponse. */ + public static class Builder { + + private Quote quote; + + private QuotedSubscription quotedSubscription; + + private QuotedCharge quotedCharge; + + private QuotedRamp quotedRamp; + + private Response httpResponse; + + private Builder() {} + + public Builder quote(Quote quote) { + this.quote = quote; + return this; + } + + public Builder quotedSubscription(QuotedSubscription quotedSubscription) { + this.quotedSubscription = quotedSubscription; + return this; + } + + public Builder quotedCharge(QuotedCharge quotedCharge) { + this.quotedCharge = quotedCharge; + return this; + } + + public Builder quotedRamp(QuotedRamp quotedRamp) { + this.quotedRamp = quotedRamp; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public QuoteUpdateStatusResponse build() { + return new QuoteUpdateStatusResponse(this); + } + } + + /** Get the quote from the response. */ + public Quote getQuote() { + return quote; + } + + /** Get the quotedSubscription from the response. */ + public QuotedSubscription getQuotedSubscription() { + return quotedSubscription; + } + + /** Get the quotedCharge from the response. */ + public QuotedCharge getQuotedCharge() { + return quotedCharge; + } + + /** Get the quotedRamp from the response. */ + public QuotedRamp getQuotedRamp() { + return quotedRamp; + } +} diff --git a/src/main/java/com/chargebee/v4/models/quote/responses/UpdateStatusForQuoteResponse.java b/src/main/java/com/chargebee/v4/models/quote/responses/UpdateStatusForQuoteResponse.java deleted file mode 100644 index 5e85e75a..00000000 --- a/src/main/java/com/chargebee/v4/models/quote/responses/UpdateStatusForQuoteResponse.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.chargebee.v4.models.quote.responses; - -import com.chargebee.v4.models.quote.Quote; - -import com.chargebee.v4.models.quotedRamp.QuotedRamp; - -import com.chargebee.v4.models.quotedSubscription.QuotedSubscription; - -import com.chargebee.v4.models.quotedCharge.QuotedCharge; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateStatusForQuote operation. Contains the response data from the - * API. - */ -public final class UpdateStatusForQuoteResponse extends BaseResponse { - private final Quote quote; - - private final QuotedSubscription quotedSubscription; - - private final QuotedCharge quotedCharge; - - private final QuotedRamp quotedRamp; - - private UpdateStatusForQuoteResponse(Builder builder) { - super(builder.httpResponse); - - this.quote = builder.quote; - - this.quotedSubscription = builder.quotedSubscription; - - this.quotedCharge = builder.quotedCharge; - - this.quotedRamp = builder.quotedRamp; - } - - /** Parse JSON response into UpdateStatusForQuoteResponse object. */ - public static UpdateStatusForQuoteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdateStatusForQuoteResponse object with HTTP response. */ - public static UpdateStatusForQuoteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __quoteJson = JsonUtil.getObject(json, "quote"); - if (__quoteJson != null) { - builder.quote(Quote.fromJson(__quoteJson)); - } - - String __quotedSubscriptionJson = JsonUtil.getObject(json, "quoted_subscription"); - if (__quotedSubscriptionJson != null) { - builder.quotedSubscription(QuotedSubscription.fromJson(__quotedSubscriptionJson)); - } - - String __quotedChargeJson = JsonUtil.getObject(json, "quoted_charge"); - if (__quotedChargeJson != null) { - builder.quotedCharge(QuotedCharge.fromJson(__quotedChargeJson)); - } - - String __quotedRampJson = JsonUtil.getObject(json, "quoted_ramp"); - if (__quotedRampJson != null) { - builder.quotedRamp(QuotedRamp.fromJson(__quotedRampJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UpdateStatusForQuoteResponse from JSON", e); - } - } - - /** Create a new builder for UpdateStatusForQuoteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateStatusForQuoteResponse. */ - public static class Builder { - - private Quote quote; - - private QuotedSubscription quotedSubscription; - - private QuotedCharge quotedCharge; - - private QuotedRamp quotedRamp; - - private Response httpResponse; - - private Builder() {} - - public Builder quote(Quote quote) { - this.quote = quote; - return this; - } - - public Builder quotedSubscription(QuotedSubscription quotedSubscription) { - this.quotedSubscription = quotedSubscription; - return this; - } - - public Builder quotedCharge(QuotedCharge quotedCharge) { - this.quotedCharge = quotedCharge; - return this; - } - - public Builder quotedRamp(QuotedRamp quotedRamp) { - this.quotedRamp = quotedRamp; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateStatusForQuoteResponse build() { - return new UpdateStatusForQuoteResponse(this); - } - } - - /** Get the quote from the response. */ - public Quote getQuote() { - return quote; - } - - /** Get the quotedSubscription from the response. */ - public QuotedSubscription getQuotedSubscription() { - return quotedSubscription; - } - - /** Get the quotedCharge from the response. */ - public QuotedCharge getQuotedCharge() { - return quotedCharge; - } - - /** Get the quotedRamp from the response. */ - public QuotedRamp getQuotedRamp() { - return quotedRamp; - } -} diff --git a/src/main/java/com/chargebee/v4/models/ramp/params/CreateRampForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/ramp/params/CreateRampForSubscriptionParams.java deleted file mode 100644 index cacb6400..00000000 --- a/src/main/java/com/chargebee/v4/models/ramp/params/CreateRampForSubscriptionParams.java +++ /dev/null @@ -1,1597 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.ramp.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class CreateRampForSubscriptionParams { - - private final Timestamp effectiveFrom; - - private final String description; - - private final List couponsToRemove; - - private final List discountsToRemove; - - private final List itemsToRemove; - - private final ContractTermParams contractTerm; - - private final List itemsToAdd; - - private final List itemsToUpdate; - - private final List itemTiers; - - private final List couponsToAdd; - - private final List discountsToAdd; - - private CreateRampForSubscriptionParams(CreateRampForSubscriptionBuilder builder) { - - this.effectiveFrom = builder.effectiveFrom; - - this.description = builder.description; - - this.couponsToRemove = builder.couponsToRemove; - - this.discountsToRemove = builder.discountsToRemove; - - this.itemsToRemove = builder.itemsToRemove; - - this.contractTerm = builder.contractTerm; - - this.itemsToAdd = builder.itemsToAdd; - - this.itemsToUpdate = builder.itemsToUpdate; - - this.itemTiers = builder.itemTiers; - - this.couponsToAdd = builder.couponsToAdd; - - this.discountsToAdd = builder.discountsToAdd; - } - - public Timestamp getEffectiveFrom() { - return effectiveFrom; - } - - public String getDescription() { - return description; - } - - public List getCouponsToRemove() { - return couponsToRemove; - } - - public List getDiscountsToRemove() { - return discountsToRemove; - } - - public List getItemsToRemove() { - return itemsToRemove; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public List getItemsToAdd() { - return itemsToAdd; - } - - public List getItemsToUpdate() { - return itemsToUpdate; - } - - public List getItemTiers() { - return itemTiers; - } - - public List getCouponsToAdd() { - return couponsToAdd; - } - - public List getDiscountsToAdd() { - return discountsToAdd; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.effectiveFrom != null) { - - formData.put("effective_from", this.effectiveFrom); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.couponsToRemove != null) { - - formData.put("coupons_to_remove", this.couponsToRemove); - } - - if (this.discountsToRemove != null) { - - formData.put("discounts_to_remove", this.discountsToRemove); - } - - if (this.itemsToRemove != null) { - - formData.put("items_to_remove", this.itemsToRemove); - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.itemsToAdd != null) { - - // List of objects - for (int i = 0; i < this.itemsToAdd.size(); i++) { - ItemsToAddParams item = this.itemsToAdd.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "items_to_add[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemsToUpdate != null) { - - // List of objects - for (int i = 0; i < this.itemsToUpdate.size(); i++) { - ItemsToUpdateParams item = this.itemsToUpdate.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "items_to_update[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.couponsToAdd != null) { - - // List of objects - for (int i = 0; i < this.couponsToAdd.size(); i++) { - CouponsToAddParams item = this.couponsToAdd.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "coupons_to_add[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discountsToAdd != null) { - - // List of objects - for (int i = 0; i < this.discountsToAdd.size(); i++) { - DiscountsToAddParams item = this.discountsToAdd.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts_to_add[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for CreateRampForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CreateRampForSubscriptionBuilder builder() { - return new CreateRampForSubscriptionBuilder(); - } - - public static final class CreateRampForSubscriptionBuilder { - - private Timestamp effectiveFrom; - - private String description; - - private List couponsToRemove; - - private List discountsToRemove; - - private List itemsToRemove; - - private ContractTermParams contractTerm; - - private List itemsToAdd; - - private List itemsToUpdate; - - private List itemTiers; - - private List couponsToAdd; - - private List discountsToAdd; - - private CreateRampForSubscriptionBuilder() {} - - public CreateRampForSubscriptionBuilder effectiveFrom(Timestamp value) { - this.effectiveFrom = value; - return this; - } - - public CreateRampForSubscriptionBuilder description(String value) { - this.description = value; - return this; - } - - public CreateRampForSubscriptionBuilder couponsToRemove(List value) { - this.couponsToRemove = value; - return this; - } - - public CreateRampForSubscriptionBuilder discountsToRemove(List value) { - this.discountsToRemove = value; - return this; - } - - public CreateRampForSubscriptionBuilder itemsToRemove(List value) { - this.itemsToRemove = value; - return this; - } - - public CreateRampForSubscriptionBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public CreateRampForSubscriptionBuilder itemsToAdd(List value) { - this.itemsToAdd = value; - return this; - } - - public CreateRampForSubscriptionBuilder itemsToUpdate(List value) { - this.itemsToUpdate = value; - return this; - } - - public CreateRampForSubscriptionBuilder itemTiers(List value) { - this.itemTiers = value; - return this; - } - - public CreateRampForSubscriptionBuilder couponsToAdd(List value) { - this.couponsToAdd = value; - return this; - } - - public CreateRampForSubscriptionBuilder discountsToAdd(List value) { - this.discountsToAdd = value; - return this; - } - - public CreateRampForSubscriptionParams build() { - return new CreateRampForSubscriptionParams(this); - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private final Integer renewalBillingCycles; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - - this.renewalBillingCycles = builder.renewalBillingCycles; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - public Integer getRenewalBillingCycles() { - return renewalBillingCycles; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - if (this.renewalBillingCycles != null) { - - formData.put("renewal_billing_cycles", this.renewalBillingCycles); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private Integer renewalBillingCycles; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermBuilder renewalBillingCycles(Integer value) { - this.renewalBillingCycles = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - RENEW_ONCE("renew_once"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemsToAddParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ChargeOnOption chargeOnOption; - - private ItemsToAddParams(ItemsToAddBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.chargeOnOption = builder.chargeOnOption; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ChargeOnOption getChargeOnOption() { - return chargeOnOption; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.chargeOnOption != null) { - - formData.put("charge_on_option", this.chargeOnOption); - } - - return formData; - } - - /** Create a new builder for ItemsToAddParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemsToAddBuilder builder() { - return new ItemsToAddBuilder(); - } - - public static final class ItemsToAddBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ChargeOnOption chargeOnOption; - - private ItemsToAddBuilder() {} - - public ItemsToAddBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemsToAddBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public ItemsToAddBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public ItemsToAddBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public ItemsToAddBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public ItemsToAddBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public ItemsToAddBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public ItemsToAddBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public ItemsToAddBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public ItemsToAddBuilder chargeOnOption(ChargeOnOption value) { - this.chargeOnOption = value; - return this; - } - - public ItemsToAddParams build() { - return new ItemsToAddParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnOption { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnOption enumValue : ChargeOnOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemsToUpdateParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ChargeOnOption chargeOnOption; - - private ItemsToUpdateParams(ItemsToUpdateBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.chargeOnOption = builder.chargeOnOption; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ChargeOnOption getChargeOnOption() { - return chargeOnOption; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.chargeOnOption != null) { - - formData.put("charge_on_option", this.chargeOnOption); - } - - return formData; - } - - /** Create a new builder for ItemsToUpdateParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemsToUpdateBuilder builder() { - return new ItemsToUpdateBuilder(); - } - - public static final class ItemsToUpdateBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ChargeOnOption chargeOnOption; - - private ItemsToUpdateBuilder() {} - - public ItemsToUpdateBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemsToUpdateBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public ItemsToUpdateBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public ItemsToUpdateBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public ItemsToUpdateBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public ItemsToUpdateBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public ItemsToUpdateBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public ItemsToUpdateBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public ItemsToUpdateBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public ItemsToUpdateBuilder chargeOnOption(ChargeOnOption value) { - this.chargeOnOption = value; - return this; - } - - public ItemsToUpdateParams build() { - return new ItemsToUpdateParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnOption { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnOption enumValue : ChargeOnOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemTiersParams { - - private final String itemPriceId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private String itemPriceId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CouponsToAddParams { - - private final String couponId; - - private final Timestamp applyTill; - - private CouponsToAddParams(CouponsToAddBuilder builder) { - - this.couponId = builder.couponId; - - this.applyTill = builder.applyTill; - } - - public String getCouponId() { - return couponId; - } - - public Timestamp getApplyTill() { - return applyTill; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.couponId != null) { - - formData.put("coupon_id", this.couponId); - } - - if (this.applyTill != null) { - - formData.put("apply_till", this.applyTill); - } - - return formData; - } - - /** Create a new builder for CouponsToAddParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CouponsToAddBuilder builder() { - return new CouponsToAddBuilder(); - } - - public static final class CouponsToAddBuilder { - - private String couponId; - - private Timestamp applyTill; - - private CouponsToAddBuilder() {} - - public CouponsToAddBuilder couponId(String value) { - this.couponId = value; - return this; - } - - public CouponsToAddBuilder applyTill(Timestamp value) { - this.applyTill = value; - return this; - } - - public CouponsToAddParams build() { - return new CouponsToAddParams(this); - } - } - } - - public static final class DiscountsToAddParams { - - private final ApplyOn applyOn; - - private final DurationType durationType; - - private final Number percentage; - - private final Long amount; - - private final Integer period; - - private final PeriodUnit periodUnit; - - private final Boolean includedInMrr; - - private final String itemPriceId; - - private DiscountsToAddParams(DiscountsToAddBuilder builder) { - - this.applyOn = builder.applyOn; - - this.durationType = builder.durationType; - - this.percentage = builder.percentage; - - this.amount = builder.amount; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - - this.includedInMrr = builder.includedInMrr; - - this.itemPriceId = builder.itemPriceId; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public DurationType getDurationType() { - return durationType; - } - - public Number getPercentage() { - return percentage; - } - - public Long getAmount() { - return amount; - } - - public Integer getPeriod() { - return period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public Boolean getIncludedInMrr() { - return includedInMrr; - } - - public String getItemPriceId() { - return itemPriceId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.durationType != null) { - - formData.put("duration_type", this.durationType); - } - - if (this.percentage != null) { - - formData.put("percentage", this.percentage); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.includedInMrr != null) { - - formData.put("included_in_mrr", this.includedInMrr); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - return formData; - } - - /** Create a new builder for DiscountsToAddParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsToAddBuilder builder() { - return new DiscountsToAddBuilder(); - } - - public static final class DiscountsToAddBuilder { - - private ApplyOn applyOn; - - private DurationType durationType; - - private Number percentage; - - private Long amount; - - private Integer period; - - private PeriodUnit periodUnit; - - private Boolean includedInMrr; - - private String itemPriceId; - - private DiscountsToAddBuilder() {} - - public DiscountsToAddBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public DiscountsToAddBuilder durationType(DurationType value) { - this.durationType = value; - return this; - } - - public DiscountsToAddBuilder percentage(Number value) { - this.percentage = value; - return this; - } - - public DiscountsToAddBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsToAddBuilder period(Integer value) { - this.period = value; - return this; - } - - public DiscountsToAddBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public DiscountsToAddBuilder includedInMrr(Boolean value) { - this.includedInMrr = value; - return this; - } - - public DiscountsToAddBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DiscountsToAddParams build() { - return new DiscountsToAddParams(this); - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIC_ITEM_PRICE("specific_item_price"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum DurationType { - ONE_TIME("one_time"), - - FOREVER("forever"), - - LIMITED_PERIOD("limited_period"), - - /** An enum member indicating that DurationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DurationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DurationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DurationType enumValue : DurationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/ramp/params/DeleteRampParams.java b/src/main/java/com/chargebee/v4/models/ramp/params/DeleteRampParams.java deleted file mode 100644 index ba434ad8..00000000 --- a/src/main/java/com/chargebee/v4/models/ramp/params/DeleteRampParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.ramp.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteRampParams { - - private DeleteRampParams(DeleteRampBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteRampParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteRampBuilder builder() { - return new DeleteRampBuilder(); - } - - public static final class DeleteRampBuilder { - - private DeleteRampBuilder() {} - - public DeleteRampParams build() { - return new DeleteRampParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/ramp/params/RampCreateForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/ramp/params/RampCreateForSubscriptionParams.java new file mode 100644 index 00000000..ef40290a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/ramp/params/RampCreateForSubscriptionParams.java @@ -0,0 +1,1597 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.ramp.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class RampCreateForSubscriptionParams { + + private final Timestamp effectiveFrom; + + private final String description; + + private final List couponsToRemove; + + private final List discountsToRemove; + + private final List itemsToRemove; + + private final ContractTermParams contractTerm; + + private final List itemsToAdd; + + private final List itemsToUpdate; + + private final List itemTiers; + + private final List couponsToAdd; + + private final List discountsToAdd; + + private RampCreateForSubscriptionParams(RampCreateForSubscriptionBuilder builder) { + + this.effectiveFrom = builder.effectiveFrom; + + this.description = builder.description; + + this.couponsToRemove = builder.couponsToRemove; + + this.discountsToRemove = builder.discountsToRemove; + + this.itemsToRemove = builder.itemsToRemove; + + this.contractTerm = builder.contractTerm; + + this.itemsToAdd = builder.itemsToAdd; + + this.itemsToUpdate = builder.itemsToUpdate; + + this.itemTiers = builder.itemTiers; + + this.couponsToAdd = builder.couponsToAdd; + + this.discountsToAdd = builder.discountsToAdd; + } + + public Timestamp getEffectiveFrom() { + return effectiveFrom; + } + + public String getDescription() { + return description; + } + + public List getCouponsToRemove() { + return couponsToRemove; + } + + public List getDiscountsToRemove() { + return discountsToRemove; + } + + public List getItemsToRemove() { + return itemsToRemove; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public List getItemsToAdd() { + return itemsToAdd; + } + + public List getItemsToUpdate() { + return itemsToUpdate; + } + + public List getItemTiers() { + return itemTiers; + } + + public List getCouponsToAdd() { + return couponsToAdd; + } + + public List getDiscountsToAdd() { + return discountsToAdd; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.effectiveFrom != null) { + + formData.put("effective_from", this.effectiveFrom); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.couponsToRemove != null) { + + formData.put("coupons_to_remove", this.couponsToRemove); + } + + if (this.discountsToRemove != null) { + + formData.put("discounts_to_remove", this.discountsToRemove); + } + + if (this.itemsToRemove != null) { + + formData.put("items_to_remove", this.itemsToRemove); + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.itemsToAdd != null) { + + // List of objects + for (int i = 0; i < this.itemsToAdd.size(); i++) { + ItemsToAddParams item = this.itemsToAdd.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "items_to_add[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemsToUpdate != null) { + + // List of objects + for (int i = 0; i < this.itemsToUpdate.size(); i++) { + ItemsToUpdateParams item = this.itemsToUpdate.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "items_to_update[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.couponsToAdd != null) { + + // List of objects + for (int i = 0; i < this.couponsToAdd.size(); i++) { + CouponsToAddParams item = this.couponsToAdd.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "coupons_to_add[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discountsToAdd != null) { + + // List of objects + for (int i = 0; i < this.discountsToAdd.size(); i++) { + DiscountsToAddParams item = this.discountsToAdd.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts_to_add[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for RampCreateForSubscriptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static RampCreateForSubscriptionBuilder builder() { + return new RampCreateForSubscriptionBuilder(); + } + + public static final class RampCreateForSubscriptionBuilder { + + private Timestamp effectiveFrom; + + private String description; + + private List couponsToRemove; + + private List discountsToRemove; + + private List itemsToRemove; + + private ContractTermParams contractTerm; + + private List itemsToAdd; + + private List itemsToUpdate; + + private List itemTiers; + + private List couponsToAdd; + + private List discountsToAdd; + + private RampCreateForSubscriptionBuilder() {} + + public RampCreateForSubscriptionBuilder effectiveFrom(Timestamp value) { + this.effectiveFrom = value; + return this; + } + + public RampCreateForSubscriptionBuilder description(String value) { + this.description = value; + return this; + } + + public RampCreateForSubscriptionBuilder couponsToRemove(List value) { + this.couponsToRemove = value; + return this; + } + + public RampCreateForSubscriptionBuilder discountsToRemove(List value) { + this.discountsToRemove = value; + return this; + } + + public RampCreateForSubscriptionBuilder itemsToRemove(List value) { + this.itemsToRemove = value; + return this; + } + + public RampCreateForSubscriptionBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public RampCreateForSubscriptionBuilder itemsToAdd(List value) { + this.itemsToAdd = value; + return this; + } + + public RampCreateForSubscriptionBuilder itemsToUpdate(List value) { + this.itemsToUpdate = value; + return this; + } + + public RampCreateForSubscriptionBuilder itemTiers(List value) { + this.itemTiers = value; + return this; + } + + public RampCreateForSubscriptionBuilder couponsToAdd(List value) { + this.couponsToAdd = value; + return this; + } + + public RampCreateForSubscriptionBuilder discountsToAdd(List value) { + this.discountsToAdd = value; + return this; + } + + public RampCreateForSubscriptionParams build() { + return new RampCreateForSubscriptionParams(this); + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private final Integer renewalBillingCycles; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + + this.renewalBillingCycles = builder.renewalBillingCycles; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + public Integer getRenewalBillingCycles() { + return renewalBillingCycles; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + if (this.renewalBillingCycles != null) { + + formData.put("renewal_billing_cycles", this.renewalBillingCycles); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private Integer renewalBillingCycles; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermBuilder renewalBillingCycles(Integer value) { + this.renewalBillingCycles = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + RENEW_ONCE("renew_once"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemsToAddParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ChargeOnOption chargeOnOption; + + private ItemsToAddParams(ItemsToAddBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.chargeOnOption = builder.chargeOnOption; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ChargeOnOption getChargeOnOption() { + return chargeOnOption; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.chargeOnOption != null) { + + formData.put("charge_on_option", this.chargeOnOption); + } + + return formData; + } + + /** Create a new builder for ItemsToAddParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemsToAddBuilder builder() { + return new ItemsToAddBuilder(); + } + + public static final class ItemsToAddBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ChargeOnOption chargeOnOption; + + private ItemsToAddBuilder() {} + + public ItemsToAddBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemsToAddBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public ItemsToAddBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public ItemsToAddBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public ItemsToAddBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public ItemsToAddBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public ItemsToAddBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public ItemsToAddBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public ItemsToAddBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public ItemsToAddBuilder chargeOnOption(ChargeOnOption value) { + this.chargeOnOption = value; + return this; + } + + public ItemsToAddParams build() { + return new ItemsToAddParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnOption { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnOption enumValue : ChargeOnOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemsToUpdateParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ChargeOnOption chargeOnOption; + + private ItemsToUpdateParams(ItemsToUpdateBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.chargeOnOption = builder.chargeOnOption; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ChargeOnOption getChargeOnOption() { + return chargeOnOption; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.chargeOnOption != null) { + + formData.put("charge_on_option", this.chargeOnOption); + } + + return formData; + } + + /** Create a new builder for ItemsToUpdateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemsToUpdateBuilder builder() { + return new ItemsToUpdateBuilder(); + } + + public static final class ItemsToUpdateBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ChargeOnOption chargeOnOption; + + private ItemsToUpdateBuilder() {} + + public ItemsToUpdateBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemsToUpdateBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public ItemsToUpdateBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public ItemsToUpdateBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public ItemsToUpdateBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public ItemsToUpdateBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public ItemsToUpdateBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public ItemsToUpdateBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public ItemsToUpdateBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public ItemsToUpdateBuilder chargeOnOption(ChargeOnOption value) { + this.chargeOnOption = value; + return this; + } + + public ItemsToUpdateParams build() { + return new ItemsToUpdateParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnOption { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnOption enumValue : ChargeOnOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemTiersParams { + + private final String itemPriceId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private String itemPriceId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CouponsToAddParams { + + private final String couponId; + + private final Timestamp applyTill; + + private CouponsToAddParams(CouponsToAddBuilder builder) { + + this.couponId = builder.couponId; + + this.applyTill = builder.applyTill; + } + + public String getCouponId() { + return couponId; + } + + public Timestamp getApplyTill() { + return applyTill; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.couponId != null) { + + formData.put("coupon_id", this.couponId); + } + + if (this.applyTill != null) { + + formData.put("apply_till", this.applyTill); + } + + return formData; + } + + /** Create a new builder for CouponsToAddParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponsToAddBuilder builder() { + return new CouponsToAddBuilder(); + } + + public static final class CouponsToAddBuilder { + + private String couponId; + + private Timestamp applyTill; + + private CouponsToAddBuilder() {} + + public CouponsToAddBuilder couponId(String value) { + this.couponId = value; + return this; + } + + public CouponsToAddBuilder applyTill(Timestamp value) { + this.applyTill = value; + return this; + } + + public CouponsToAddParams build() { + return new CouponsToAddParams(this); + } + } + } + + public static final class DiscountsToAddParams { + + private final ApplyOn applyOn; + + private final DurationType durationType; + + private final Number percentage; + + private final Long amount; + + private final Integer period; + + private final PeriodUnit periodUnit; + + private final Boolean includedInMrr; + + private final String itemPriceId; + + private DiscountsToAddParams(DiscountsToAddBuilder builder) { + + this.applyOn = builder.applyOn; + + this.durationType = builder.durationType; + + this.percentage = builder.percentage; + + this.amount = builder.amount; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + + this.includedInMrr = builder.includedInMrr; + + this.itemPriceId = builder.itemPriceId; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public DurationType getDurationType() { + return durationType; + } + + public Number getPercentage() { + return percentage; + } + + public Long getAmount() { + return amount; + } + + public Integer getPeriod() { + return period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public Boolean getIncludedInMrr() { + return includedInMrr; + } + + public String getItemPriceId() { + return itemPriceId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.durationType != null) { + + formData.put("duration_type", this.durationType); + } + + if (this.percentage != null) { + + formData.put("percentage", this.percentage); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.includedInMrr != null) { + + formData.put("included_in_mrr", this.includedInMrr); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + return formData; + } + + /** Create a new builder for DiscountsToAddParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsToAddBuilder builder() { + return new DiscountsToAddBuilder(); + } + + public static final class DiscountsToAddBuilder { + + private ApplyOn applyOn; + + private DurationType durationType; + + private Number percentage; + + private Long amount; + + private Integer period; + + private PeriodUnit periodUnit; + + private Boolean includedInMrr; + + private String itemPriceId; + + private DiscountsToAddBuilder() {} + + public DiscountsToAddBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public DiscountsToAddBuilder durationType(DurationType value) { + this.durationType = value; + return this; + } + + public DiscountsToAddBuilder percentage(Number value) { + this.percentage = value; + return this; + } + + public DiscountsToAddBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsToAddBuilder period(Integer value) { + this.period = value; + return this; + } + + public DiscountsToAddBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public DiscountsToAddBuilder includedInMrr(Boolean value) { + this.includedInMrr = value; + return this; + } + + public DiscountsToAddBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DiscountsToAddParams build() { + return new DiscountsToAddParams(this); + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIC_ITEM_PRICE("specific_item_price"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum DurationType { + ONE_TIME("one_time"), + + FOREVER("forever"), + + LIMITED_PERIOD("limited_period"), + + /** An enum member indicating that DurationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DurationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DurationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DurationType enumValue : DurationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/ramp/params/RampDeleteParams.java b/src/main/java/com/chargebee/v4/models/ramp/params/RampDeleteParams.java new file mode 100644 index 00000000..eafdeab5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/ramp/params/RampDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.ramp.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class RampDeleteParams { + + private RampDeleteParams(RampDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for RampDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static RampDeleteBuilder builder() { + return new RampDeleteBuilder(); + } + + public static final class RampDeleteBuilder { + + private RampDeleteBuilder() {} + + public RampDeleteParams build() { + return new RampDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/ramp/params/RampUpdateParams.java b/src/main/java/com/chargebee/v4/models/ramp/params/RampUpdateParams.java new file mode 100644 index 00000000..66a70bbd --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/ramp/params/RampUpdateParams.java @@ -0,0 +1,1597 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.ramp.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class RampUpdateParams { + + private final Timestamp effectiveFrom; + + private final String description; + + private final List couponsToRemove; + + private final List discountsToRemove; + + private final List itemsToRemove; + + private final ContractTermParams contractTerm; + + private final List itemsToAdd; + + private final List itemsToUpdate; + + private final List itemTiers; + + private final List couponsToAdd; + + private final List discountsToAdd; + + private RampUpdateParams(RampUpdateBuilder builder) { + + this.effectiveFrom = builder.effectiveFrom; + + this.description = builder.description; + + this.couponsToRemove = builder.couponsToRemove; + + this.discountsToRemove = builder.discountsToRemove; + + this.itemsToRemove = builder.itemsToRemove; + + this.contractTerm = builder.contractTerm; + + this.itemsToAdd = builder.itemsToAdd; + + this.itemsToUpdate = builder.itemsToUpdate; + + this.itemTiers = builder.itemTiers; + + this.couponsToAdd = builder.couponsToAdd; + + this.discountsToAdd = builder.discountsToAdd; + } + + public Timestamp getEffectiveFrom() { + return effectiveFrom; + } + + public String getDescription() { + return description; + } + + public List getCouponsToRemove() { + return couponsToRemove; + } + + public List getDiscountsToRemove() { + return discountsToRemove; + } + + public List getItemsToRemove() { + return itemsToRemove; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public List getItemsToAdd() { + return itemsToAdd; + } + + public List getItemsToUpdate() { + return itemsToUpdate; + } + + public List getItemTiers() { + return itemTiers; + } + + public List getCouponsToAdd() { + return couponsToAdd; + } + + public List getDiscountsToAdd() { + return discountsToAdd; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.effectiveFrom != null) { + + formData.put("effective_from", this.effectiveFrom); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.couponsToRemove != null) { + + formData.put("coupons_to_remove", this.couponsToRemove); + } + + if (this.discountsToRemove != null) { + + formData.put("discounts_to_remove", this.discountsToRemove); + } + + if (this.itemsToRemove != null) { + + formData.put("items_to_remove", this.itemsToRemove); + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.itemsToAdd != null) { + + // List of objects + for (int i = 0; i < this.itemsToAdd.size(); i++) { + ItemsToAddParams item = this.itemsToAdd.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "items_to_add[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemsToUpdate != null) { + + // List of objects + for (int i = 0; i < this.itemsToUpdate.size(); i++) { + ItemsToUpdateParams item = this.itemsToUpdate.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "items_to_update[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.couponsToAdd != null) { + + // List of objects + for (int i = 0; i < this.couponsToAdd.size(); i++) { + CouponsToAddParams item = this.couponsToAdd.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "coupons_to_add[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discountsToAdd != null) { + + // List of objects + for (int i = 0; i < this.discountsToAdd.size(); i++) { + DiscountsToAddParams item = this.discountsToAdd.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts_to_add[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for RampUpdateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static RampUpdateBuilder builder() { + return new RampUpdateBuilder(); + } + + public static final class RampUpdateBuilder { + + private Timestamp effectiveFrom; + + private String description; + + private List couponsToRemove; + + private List discountsToRemove; + + private List itemsToRemove; + + private ContractTermParams contractTerm; + + private List itemsToAdd; + + private List itemsToUpdate; + + private List itemTiers; + + private List couponsToAdd; + + private List discountsToAdd; + + private RampUpdateBuilder() {} + + public RampUpdateBuilder effectiveFrom(Timestamp value) { + this.effectiveFrom = value; + return this; + } + + public RampUpdateBuilder description(String value) { + this.description = value; + return this; + } + + public RampUpdateBuilder couponsToRemove(List value) { + this.couponsToRemove = value; + return this; + } + + public RampUpdateBuilder discountsToRemove(List value) { + this.discountsToRemove = value; + return this; + } + + public RampUpdateBuilder itemsToRemove(List value) { + this.itemsToRemove = value; + return this; + } + + public RampUpdateBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public RampUpdateBuilder itemsToAdd(List value) { + this.itemsToAdd = value; + return this; + } + + public RampUpdateBuilder itemsToUpdate(List value) { + this.itemsToUpdate = value; + return this; + } + + public RampUpdateBuilder itemTiers(List value) { + this.itemTiers = value; + return this; + } + + public RampUpdateBuilder couponsToAdd(List value) { + this.couponsToAdd = value; + return this; + } + + public RampUpdateBuilder discountsToAdd(List value) { + this.discountsToAdd = value; + return this; + } + + public RampUpdateParams build() { + return new RampUpdateParams(this); + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private final Integer renewalBillingCycles; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + + this.renewalBillingCycles = builder.renewalBillingCycles; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + public Integer getRenewalBillingCycles() { + return renewalBillingCycles; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + if (this.renewalBillingCycles != null) { + + formData.put("renewal_billing_cycles", this.renewalBillingCycles); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private Integer renewalBillingCycles; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermBuilder renewalBillingCycles(Integer value) { + this.renewalBillingCycles = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + RENEW_ONCE("renew_once"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemsToAddParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ChargeOnOption chargeOnOption; + + private ItemsToAddParams(ItemsToAddBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.chargeOnOption = builder.chargeOnOption; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ChargeOnOption getChargeOnOption() { + return chargeOnOption; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.chargeOnOption != null) { + + formData.put("charge_on_option", this.chargeOnOption); + } + + return formData; + } + + /** Create a new builder for ItemsToAddParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemsToAddBuilder builder() { + return new ItemsToAddBuilder(); + } + + public static final class ItemsToAddBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ChargeOnOption chargeOnOption; + + private ItemsToAddBuilder() {} + + public ItemsToAddBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemsToAddBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public ItemsToAddBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public ItemsToAddBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public ItemsToAddBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public ItemsToAddBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public ItemsToAddBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public ItemsToAddBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public ItemsToAddBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public ItemsToAddBuilder chargeOnOption(ChargeOnOption value) { + this.chargeOnOption = value; + return this; + } + + public ItemsToAddParams build() { + return new ItemsToAddParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnOption { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnOption enumValue : ChargeOnOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemsToUpdateParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ChargeOnOption chargeOnOption; + + private ItemsToUpdateParams(ItemsToUpdateBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.chargeOnOption = builder.chargeOnOption; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ChargeOnOption getChargeOnOption() { + return chargeOnOption; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.chargeOnOption != null) { + + formData.put("charge_on_option", this.chargeOnOption); + } + + return formData; + } + + /** Create a new builder for ItemsToUpdateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemsToUpdateBuilder builder() { + return new ItemsToUpdateBuilder(); + } + + public static final class ItemsToUpdateBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ChargeOnOption chargeOnOption; + + private ItemsToUpdateBuilder() {} + + public ItemsToUpdateBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemsToUpdateBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public ItemsToUpdateBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public ItemsToUpdateBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public ItemsToUpdateBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public ItemsToUpdateBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public ItemsToUpdateBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public ItemsToUpdateBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public ItemsToUpdateBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public ItemsToUpdateBuilder chargeOnOption(ChargeOnOption value) { + this.chargeOnOption = value; + return this; + } + + public ItemsToUpdateParams build() { + return new ItemsToUpdateParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnOption { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnOption enumValue : ChargeOnOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemTiersParams { + + private final String itemPriceId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private String itemPriceId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CouponsToAddParams { + + private final String couponId; + + private final Timestamp applyTill; + + private CouponsToAddParams(CouponsToAddBuilder builder) { + + this.couponId = builder.couponId; + + this.applyTill = builder.applyTill; + } + + public String getCouponId() { + return couponId; + } + + public Timestamp getApplyTill() { + return applyTill; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.couponId != null) { + + formData.put("coupon_id", this.couponId); + } + + if (this.applyTill != null) { + + formData.put("apply_till", this.applyTill); + } + + return formData; + } + + /** Create a new builder for CouponsToAddParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponsToAddBuilder builder() { + return new CouponsToAddBuilder(); + } + + public static final class CouponsToAddBuilder { + + private String couponId; + + private Timestamp applyTill; + + private CouponsToAddBuilder() {} + + public CouponsToAddBuilder couponId(String value) { + this.couponId = value; + return this; + } + + public CouponsToAddBuilder applyTill(Timestamp value) { + this.applyTill = value; + return this; + } + + public CouponsToAddParams build() { + return new CouponsToAddParams(this); + } + } + } + + public static final class DiscountsToAddParams { + + private final ApplyOn applyOn; + + private final DurationType durationType; + + private final Number percentage; + + private final Long amount; + + private final Integer period; + + private final PeriodUnit periodUnit; + + private final Boolean includedInMrr; + + private final String itemPriceId; + + private DiscountsToAddParams(DiscountsToAddBuilder builder) { + + this.applyOn = builder.applyOn; + + this.durationType = builder.durationType; + + this.percentage = builder.percentage; + + this.amount = builder.amount; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + + this.includedInMrr = builder.includedInMrr; + + this.itemPriceId = builder.itemPriceId; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public DurationType getDurationType() { + return durationType; + } + + public Number getPercentage() { + return percentage; + } + + public Long getAmount() { + return amount; + } + + public Integer getPeriod() { + return period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public Boolean getIncludedInMrr() { + return includedInMrr; + } + + public String getItemPriceId() { + return itemPriceId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.durationType != null) { + + formData.put("duration_type", this.durationType); + } + + if (this.percentage != null) { + + formData.put("percentage", this.percentage); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.includedInMrr != null) { + + formData.put("included_in_mrr", this.includedInMrr); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + return formData; + } + + /** Create a new builder for DiscountsToAddParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsToAddBuilder builder() { + return new DiscountsToAddBuilder(); + } + + public static final class DiscountsToAddBuilder { + + private ApplyOn applyOn; + + private DurationType durationType; + + private Number percentage; + + private Long amount; + + private Integer period; + + private PeriodUnit periodUnit; + + private Boolean includedInMrr; + + private String itemPriceId; + + private DiscountsToAddBuilder() {} + + public DiscountsToAddBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public DiscountsToAddBuilder durationType(DurationType value) { + this.durationType = value; + return this; + } + + public DiscountsToAddBuilder percentage(Number value) { + this.percentage = value; + return this; + } + + public DiscountsToAddBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsToAddBuilder period(Integer value) { + this.period = value; + return this; + } + + public DiscountsToAddBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public DiscountsToAddBuilder includedInMrr(Boolean value) { + this.includedInMrr = value; + return this; + } + + public DiscountsToAddBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DiscountsToAddParams build() { + return new DiscountsToAddParams(this); + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIC_ITEM_PRICE("specific_item_price"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum DurationType { + ONE_TIME("one_time"), + + FOREVER("forever"), + + LIMITED_PERIOD("limited_period"), + + /** An enum member indicating that DurationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DurationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DurationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DurationType enumValue : DurationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/ramp/params/UpdateRampParams.java b/src/main/java/com/chargebee/v4/models/ramp/params/UpdateRampParams.java deleted file mode 100644 index 1a9dc679..00000000 --- a/src/main/java/com/chargebee/v4/models/ramp/params/UpdateRampParams.java +++ /dev/null @@ -1,1597 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.ramp.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class UpdateRampParams { - - private final Timestamp effectiveFrom; - - private final String description; - - private final List couponsToRemove; - - private final List discountsToRemove; - - private final List itemsToRemove; - - private final ContractTermParams contractTerm; - - private final List itemsToAdd; - - private final List itemsToUpdate; - - private final List itemTiers; - - private final List couponsToAdd; - - private final List discountsToAdd; - - private UpdateRampParams(UpdateRampBuilder builder) { - - this.effectiveFrom = builder.effectiveFrom; - - this.description = builder.description; - - this.couponsToRemove = builder.couponsToRemove; - - this.discountsToRemove = builder.discountsToRemove; - - this.itemsToRemove = builder.itemsToRemove; - - this.contractTerm = builder.contractTerm; - - this.itemsToAdd = builder.itemsToAdd; - - this.itemsToUpdate = builder.itemsToUpdate; - - this.itemTiers = builder.itemTiers; - - this.couponsToAdd = builder.couponsToAdd; - - this.discountsToAdd = builder.discountsToAdd; - } - - public Timestamp getEffectiveFrom() { - return effectiveFrom; - } - - public String getDescription() { - return description; - } - - public List getCouponsToRemove() { - return couponsToRemove; - } - - public List getDiscountsToRemove() { - return discountsToRemove; - } - - public List getItemsToRemove() { - return itemsToRemove; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public List getItemsToAdd() { - return itemsToAdd; - } - - public List getItemsToUpdate() { - return itemsToUpdate; - } - - public List getItemTiers() { - return itemTiers; - } - - public List getCouponsToAdd() { - return couponsToAdd; - } - - public List getDiscountsToAdd() { - return discountsToAdd; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.effectiveFrom != null) { - - formData.put("effective_from", this.effectiveFrom); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.couponsToRemove != null) { - - formData.put("coupons_to_remove", this.couponsToRemove); - } - - if (this.discountsToRemove != null) { - - formData.put("discounts_to_remove", this.discountsToRemove); - } - - if (this.itemsToRemove != null) { - - formData.put("items_to_remove", this.itemsToRemove); - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.itemsToAdd != null) { - - // List of objects - for (int i = 0; i < this.itemsToAdd.size(); i++) { - ItemsToAddParams item = this.itemsToAdd.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "items_to_add[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemsToUpdate != null) { - - // List of objects - for (int i = 0; i < this.itemsToUpdate.size(); i++) { - ItemsToUpdateParams item = this.itemsToUpdate.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "items_to_update[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.couponsToAdd != null) { - - // List of objects - for (int i = 0; i < this.couponsToAdd.size(); i++) { - CouponsToAddParams item = this.couponsToAdd.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "coupons_to_add[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discountsToAdd != null) { - - // List of objects - for (int i = 0; i < this.discountsToAdd.size(); i++) { - DiscountsToAddParams item = this.discountsToAdd.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts_to_add[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for UpdateRampParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateRampBuilder builder() { - return new UpdateRampBuilder(); - } - - public static final class UpdateRampBuilder { - - private Timestamp effectiveFrom; - - private String description; - - private List couponsToRemove; - - private List discountsToRemove; - - private List itemsToRemove; - - private ContractTermParams contractTerm; - - private List itemsToAdd; - - private List itemsToUpdate; - - private List itemTiers; - - private List couponsToAdd; - - private List discountsToAdd; - - private UpdateRampBuilder() {} - - public UpdateRampBuilder effectiveFrom(Timestamp value) { - this.effectiveFrom = value; - return this; - } - - public UpdateRampBuilder description(String value) { - this.description = value; - return this; - } - - public UpdateRampBuilder couponsToRemove(List value) { - this.couponsToRemove = value; - return this; - } - - public UpdateRampBuilder discountsToRemove(List value) { - this.discountsToRemove = value; - return this; - } - - public UpdateRampBuilder itemsToRemove(List value) { - this.itemsToRemove = value; - return this; - } - - public UpdateRampBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public UpdateRampBuilder itemsToAdd(List value) { - this.itemsToAdd = value; - return this; - } - - public UpdateRampBuilder itemsToUpdate(List value) { - this.itemsToUpdate = value; - return this; - } - - public UpdateRampBuilder itemTiers(List value) { - this.itemTiers = value; - return this; - } - - public UpdateRampBuilder couponsToAdd(List value) { - this.couponsToAdd = value; - return this; - } - - public UpdateRampBuilder discountsToAdd(List value) { - this.discountsToAdd = value; - return this; - } - - public UpdateRampParams build() { - return new UpdateRampParams(this); - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private final Integer renewalBillingCycles; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - - this.renewalBillingCycles = builder.renewalBillingCycles; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - public Integer getRenewalBillingCycles() { - return renewalBillingCycles; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - if (this.renewalBillingCycles != null) { - - formData.put("renewal_billing_cycles", this.renewalBillingCycles); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private Integer renewalBillingCycles; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermBuilder renewalBillingCycles(Integer value) { - this.renewalBillingCycles = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - RENEW_ONCE("renew_once"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemsToAddParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ChargeOnOption chargeOnOption; - - private ItemsToAddParams(ItemsToAddBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.chargeOnOption = builder.chargeOnOption; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ChargeOnOption getChargeOnOption() { - return chargeOnOption; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.chargeOnOption != null) { - - formData.put("charge_on_option", this.chargeOnOption); - } - - return formData; - } - - /** Create a new builder for ItemsToAddParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemsToAddBuilder builder() { - return new ItemsToAddBuilder(); - } - - public static final class ItemsToAddBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ChargeOnOption chargeOnOption; - - private ItemsToAddBuilder() {} - - public ItemsToAddBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemsToAddBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public ItemsToAddBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public ItemsToAddBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public ItemsToAddBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public ItemsToAddBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public ItemsToAddBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public ItemsToAddBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public ItemsToAddBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public ItemsToAddBuilder chargeOnOption(ChargeOnOption value) { - this.chargeOnOption = value; - return this; - } - - public ItemsToAddParams build() { - return new ItemsToAddParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnOption { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnOption enumValue : ChargeOnOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemsToUpdateParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ChargeOnOption chargeOnOption; - - private ItemsToUpdateParams(ItemsToUpdateBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.chargeOnOption = builder.chargeOnOption; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ChargeOnOption getChargeOnOption() { - return chargeOnOption; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.chargeOnOption != null) { - - formData.put("charge_on_option", this.chargeOnOption); - } - - return formData; - } - - /** Create a new builder for ItemsToUpdateParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemsToUpdateBuilder builder() { - return new ItemsToUpdateBuilder(); - } - - public static final class ItemsToUpdateBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ChargeOnOption chargeOnOption; - - private ItemsToUpdateBuilder() {} - - public ItemsToUpdateBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemsToUpdateBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public ItemsToUpdateBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public ItemsToUpdateBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public ItemsToUpdateBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public ItemsToUpdateBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public ItemsToUpdateBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public ItemsToUpdateBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public ItemsToUpdateBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public ItemsToUpdateBuilder chargeOnOption(ChargeOnOption value) { - this.chargeOnOption = value; - return this; - } - - public ItemsToUpdateParams build() { - return new ItemsToUpdateParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnOption { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnOption enumValue : ChargeOnOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemTiersParams { - - private final String itemPriceId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private String itemPriceId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CouponsToAddParams { - - private final String couponId; - - private final Timestamp applyTill; - - private CouponsToAddParams(CouponsToAddBuilder builder) { - - this.couponId = builder.couponId; - - this.applyTill = builder.applyTill; - } - - public String getCouponId() { - return couponId; - } - - public Timestamp getApplyTill() { - return applyTill; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.couponId != null) { - - formData.put("coupon_id", this.couponId); - } - - if (this.applyTill != null) { - - formData.put("apply_till", this.applyTill); - } - - return formData; - } - - /** Create a new builder for CouponsToAddParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CouponsToAddBuilder builder() { - return new CouponsToAddBuilder(); - } - - public static final class CouponsToAddBuilder { - - private String couponId; - - private Timestamp applyTill; - - private CouponsToAddBuilder() {} - - public CouponsToAddBuilder couponId(String value) { - this.couponId = value; - return this; - } - - public CouponsToAddBuilder applyTill(Timestamp value) { - this.applyTill = value; - return this; - } - - public CouponsToAddParams build() { - return new CouponsToAddParams(this); - } - } - } - - public static final class DiscountsToAddParams { - - private final ApplyOn applyOn; - - private final DurationType durationType; - - private final Number percentage; - - private final Long amount; - - private final Integer period; - - private final PeriodUnit periodUnit; - - private final Boolean includedInMrr; - - private final String itemPriceId; - - private DiscountsToAddParams(DiscountsToAddBuilder builder) { - - this.applyOn = builder.applyOn; - - this.durationType = builder.durationType; - - this.percentage = builder.percentage; - - this.amount = builder.amount; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - - this.includedInMrr = builder.includedInMrr; - - this.itemPriceId = builder.itemPriceId; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public DurationType getDurationType() { - return durationType; - } - - public Number getPercentage() { - return percentage; - } - - public Long getAmount() { - return amount; - } - - public Integer getPeriod() { - return period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public Boolean getIncludedInMrr() { - return includedInMrr; - } - - public String getItemPriceId() { - return itemPriceId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.durationType != null) { - - formData.put("duration_type", this.durationType); - } - - if (this.percentage != null) { - - formData.put("percentage", this.percentage); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.includedInMrr != null) { - - formData.put("included_in_mrr", this.includedInMrr); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - return formData; - } - - /** Create a new builder for DiscountsToAddParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsToAddBuilder builder() { - return new DiscountsToAddBuilder(); - } - - public static final class DiscountsToAddBuilder { - - private ApplyOn applyOn; - - private DurationType durationType; - - private Number percentage; - - private Long amount; - - private Integer period; - - private PeriodUnit periodUnit; - - private Boolean includedInMrr; - - private String itemPriceId; - - private DiscountsToAddBuilder() {} - - public DiscountsToAddBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public DiscountsToAddBuilder durationType(DurationType value) { - this.durationType = value; - return this; - } - - public DiscountsToAddBuilder percentage(Number value) { - this.percentage = value; - return this; - } - - public DiscountsToAddBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsToAddBuilder period(Integer value) { - this.period = value; - return this; - } - - public DiscountsToAddBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public DiscountsToAddBuilder includedInMrr(Boolean value) { - this.includedInMrr = value; - return this; - } - - public DiscountsToAddBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DiscountsToAddParams build() { - return new DiscountsToAddParams(this); - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIC_ITEM_PRICE("specific_item_price"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum DurationType { - ONE_TIME("one_time"), - - FOREVER("forever"), - - LIMITED_PERIOD("limited_period"), - - /** An enum member indicating that DurationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DurationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DurationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DurationType enumValue : DurationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/ramp/responses/CreateRampForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/ramp/responses/CreateRampForSubscriptionResponse.java deleted file mode 100644 index 8773bb9b..00000000 --- a/src/main/java/com/chargebee/v4/models/ramp/responses/CreateRampForSubscriptionResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.ramp.responses; - -import com.chargebee.v4.models.ramp.Ramp; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CreateRampForSubscription operation. Contains the response data - * from the API. - */ -public final class CreateRampForSubscriptionResponse extends BaseResponse { - private final Ramp ramp; - - private CreateRampForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.ramp = builder.ramp; - } - - /** Parse JSON response into CreateRampForSubscriptionResponse object. */ - public static CreateRampForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into CreateRampForSubscriptionResponse object with HTTP response. */ - public static CreateRampForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __rampJson = JsonUtil.getObject(json, "ramp"); - if (__rampJson != null) { - builder.ramp(Ramp.fromJson(__rampJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse CreateRampForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for CreateRampForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CreateRampForSubscriptionResponse. */ - public static class Builder { - - private Ramp ramp; - - private Response httpResponse; - - private Builder() {} - - public Builder ramp(Ramp ramp) { - this.ramp = ramp; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CreateRampForSubscriptionResponse build() { - return new CreateRampForSubscriptionResponse(this); - } - } - - /** Get the ramp from the response. */ - public Ramp getRamp() { - return ramp; - } -} diff --git a/src/main/java/com/chargebee/v4/models/ramp/responses/DeleteRampResponse.java b/src/main/java/com/chargebee/v4/models/ramp/responses/DeleteRampResponse.java deleted file mode 100644 index 7f6b6088..00000000 --- a/src/main/java/com/chargebee/v4/models/ramp/responses/DeleteRampResponse.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.chargebee.v4.models.ramp.responses; - -import com.chargebee.v4.models.ramp.Ramp; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** Immutable response object for DeleteRamp operation. Contains the response data from the API. */ -public final class DeleteRampResponse extends BaseResponse { - private final Ramp ramp; - - private DeleteRampResponse(Builder builder) { - super(builder.httpResponse); - - this.ramp = builder.ramp; - } - - /** Parse JSON response into DeleteRampResponse object. */ - public static DeleteRampResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteRampResponse object with HTTP response. */ - public static DeleteRampResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __rampJson = JsonUtil.getObject(json, "ramp"); - if (__rampJson != null) { - builder.ramp(Ramp.fromJson(__rampJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteRampResponse from JSON", e); - } - } - - /** Create a new builder for DeleteRampResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteRampResponse. */ - public static class Builder { - - private Ramp ramp; - - private Response httpResponse; - - private Builder() {} - - public Builder ramp(Ramp ramp) { - this.ramp = ramp; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteRampResponse build() { - return new DeleteRampResponse(this); - } - } - - /** Get the ramp from the response. */ - public Ramp getRamp() { - return ramp; - } -} diff --git a/src/main/java/com/chargebee/v4/models/ramp/responses/RampCreateForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/ramp/responses/RampCreateForSubscriptionResponse.java new file mode 100644 index 00000000..19449e7a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/ramp/responses/RampCreateForSubscriptionResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.ramp.responses; + +import com.chargebee.v4.models.ramp.Ramp; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for RampCreateForSubscription operation. Contains the response data + * from the API. + */ +public final class RampCreateForSubscriptionResponse extends BaseResponse { + private final Ramp ramp; + + private RampCreateForSubscriptionResponse(Builder builder) { + super(builder.httpResponse); + + this.ramp = builder.ramp; + } + + /** Parse JSON response into RampCreateForSubscriptionResponse object. */ + public static RampCreateForSubscriptionResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into RampCreateForSubscriptionResponse object with HTTP response. */ + public static RampCreateForSubscriptionResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __rampJson = JsonUtil.getObject(json, "ramp"); + if (__rampJson != null) { + builder.ramp(Ramp.fromJson(__rampJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse RampCreateForSubscriptionResponse from JSON", e); + } + } + + /** Create a new builder for RampCreateForSubscriptionResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for RampCreateForSubscriptionResponse. */ + public static class Builder { + + private Ramp ramp; + + private Response httpResponse; + + private Builder() {} + + public Builder ramp(Ramp ramp) { + this.ramp = ramp; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public RampCreateForSubscriptionResponse build() { + return new RampCreateForSubscriptionResponse(this); + } + } + + /** Get the ramp from the response. */ + public Ramp getRamp() { + return ramp; + } +} diff --git a/src/main/java/com/chargebee/v4/models/ramp/responses/RampDeleteResponse.java b/src/main/java/com/chargebee/v4/models/ramp/responses/RampDeleteResponse.java new file mode 100644 index 00000000..c12d8a61 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/ramp/responses/RampDeleteResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.ramp.responses; + +import com.chargebee.v4.models.ramp.Ramp; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for RampDelete operation. Contains the response data from the API. */ +public final class RampDeleteResponse extends BaseResponse { + private final Ramp ramp; + + private RampDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.ramp = builder.ramp; + } + + /** Parse JSON response into RampDeleteResponse object. */ + public static RampDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into RampDeleteResponse object with HTTP response. */ + public static RampDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __rampJson = JsonUtil.getObject(json, "ramp"); + if (__rampJson != null) { + builder.ramp(Ramp.fromJson(__rampJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse RampDeleteResponse from JSON", e); + } + } + + /** Create a new builder for RampDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for RampDeleteResponse. */ + public static class Builder { + + private Ramp ramp; + + private Response httpResponse; + + private Builder() {} + + public Builder ramp(Ramp ramp) { + this.ramp = ramp; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public RampDeleteResponse build() { + return new RampDeleteResponse(this); + } + } + + /** Get the ramp from the response. */ + public Ramp getRamp() { + return ramp; + } +} diff --git a/src/main/java/com/chargebee/v4/models/ramp/responses/RampListResponse.java b/src/main/java/com/chargebee/v4/models/ramp/responses/RampListResponse.java index fddf1094..aab359cb 100644 --- a/src/main/java/com/chargebee/v4/models/ramp/responses/RampListResponse.java +++ b/src/main/java/com/chargebee/v4/models/ramp/responses/RampListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.ramp.Ramp; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.RampService; @@ -95,9 +96,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public RampListResponse nextPage() throws Exception { + public RampListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/ramp/responses/RampUpdateResponse.java b/src/main/java/com/chargebee/v4/models/ramp/responses/RampUpdateResponse.java new file mode 100644 index 00000000..f7cbef23 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/ramp/responses/RampUpdateResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.ramp.responses; + +import com.chargebee.v4.models.ramp.Ramp; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for RampUpdate operation. Contains the response data from the API. */ +public final class RampUpdateResponse extends BaseResponse { + private final Ramp ramp; + + private RampUpdateResponse(Builder builder) { + super(builder.httpResponse); + + this.ramp = builder.ramp; + } + + /** Parse JSON response into RampUpdateResponse object. */ + public static RampUpdateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into RampUpdateResponse object with HTTP response. */ + public static RampUpdateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __rampJson = JsonUtil.getObject(json, "ramp"); + if (__rampJson != null) { + builder.ramp(Ramp.fromJson(__rampJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse RampUpdateResponse from JSON", e); + } + } + + /** Create a new builder for RampUpdateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for RampUpdateResponse. */ + public static class Builder { + + private Ramp ramp; + + private Response httpResponse; + + private Builder() {} + + public Builder ramp(Ramp ramp) { + this.ramp = ramp; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public RampUpdateResponse build() { + return new RampUpdateResponse(this); + } + } + + /** Get the ramp from the response. */ + public Ramp getRamp() { + return ramp; + } +} diff --git a/src/main/java/com/chargebee/v4/models/ramp/responses/UpdateRampResponse.java b/src/main/java/com/chargebee/v4/models/ramp/responses/UpdateRampResponse.java deleted file mode 100644 index e438aad5..00000000 --- a/src/main/java/com/chargebee/v4/models/ramp/responses/UpdateRampResponse.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.chargebee.v4.models.ramp.responses; - -import com.chargebee.v4.models.ramp.Ramp; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** Immutable response object for UpdateRamp operation. Contains the response data from the API. */ -public final class UpdateRampResponse extends BaseResponse { - private final Ramp ramp; - - private UpdateRampResponse(Builder builder) { - super(builder.httpResponse); - - this.ramp = builder.ramp; - } - - /** Parse JSON response into UpdateRampResponse object. */ - public static UpdateRampResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdateRampResponse object with HTTP response. */ - public static UpdateRampResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __rampJson = JsonUtil.getObject(json, "ramp"); - if (__rampJson != null) { - builder.ramp(Ramp.fromJson(__rampJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UpdateRampResponse from JSON", e); - } - } - - /** Create a new builder for UpdateRampResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateRampResponse. */ - public static class Builder { - - private Ramp ramp; - - private Response httpResponse; - - private Builder() {} - - public Builder ramp(Ramp ramp) { - this.ramp = ramp; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateRampResponse build() { - return new UpdateRampResponse(this); - } - } - - /** Get the ramp from the response. */ - public Ramp getRamp() { - return ramp; - } -} diff --git a/src/main/java/com/chargebee/v4/models/salesOrder/SalesOrder.java b/src/main/java/com/chargebee/v4/models/salesOrder/SalesOrder.java index 37797a9f..3fe79973 100644 --- a/src/main/java/com/chargebee/v4/models/salesOrder/SalesOrder.java +++ b/src/main/java/com/chargebee/v4/models/salesOrder/SalesOrder.java @@ -32,6 +32,7 @@ public class SalesOrder { @Deprecated private List invoiceIds; @Deprecated private List creditNoteIds; @Deprecated private List unbilledChargeIds; + private Boolean deleted; private List lineItems; private List billingAddresses; private List discounts; @@ -121,6 +122,10 @@ public List getUnbilledChargeIds() { return unbilledChargeIds; } + public Boolean getDeleted() { + return deleted; + } + public List getLineItems() { return lineItems; } @@ -227,6 +232,8 @@ public static SalesOrder fromJson(String json) { obj.unbilledChargeIds = JsonUtil.parseArrayOfString(JsonUtil.getArray(json, "unbilled_charge_ids")); + obj.deleted = JsonUtil.getBoolean(json, "deleted"); + obj.lineItems = JsonUtil.parseObjectArray(JsonUtil.getArray(json, "line_items")).stream() .map(LineItems::fromJson) diff --git a/src/main/java/com/chargebee/v4/models/siteMigrationDetail/responses/SiteMigrationDetailListResponse.java b/src/main/java/com/chargebee/v4/models/siteMigrationDetail/responses/SiteMigrationDetailListResponse.java index d2047308..6c91e188 100644 --- a/src/main/java/com/chargebee/v4/models/siteMigrationDetail/responses/SiteMigrationDetailListResponse.java +++ b/src/main/java/com/chargebee/v4/models/siteMigrationDetail/responses/SiteMigrationDetailListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.siteMigrationDetail.SiteMigrationDetail; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.SiteMigrationDetailService; @@ -101,9 +102,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public SiteMigrationDetailListResponse nextPage() throws Exception { + public SiteMigrationDetailListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/AddChargeAtTermEndForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/AddChargeAtTermEndForSubscriptionParams.java deleted file mode 100644 index 9a798171..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/AddChargeAtTermEndForSubscriptionParams.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class AddChargeAtTermEndForSubscriptionParams { - - private final Long amount; - - private final String description; - - private final String amountInDecimal; - - private final AvalaraSaleType avalaraSaleType; - - private final Integer avalaraTransactionType; - - private final Integer avalaraServiceType; - - private final Timestamp dateFrom; - - private final Timestamp dateTo; - - private AddChargeAtTermEndForSubscriptionParams( - AddChargeAtTermEndForSubscriptionBuilder builder) { - - this.amount = builder.amount; - - this.description = builder.description; - - this.amountInDecimal = builder.amountInDecimal; - - this.avalaraSaleType = builder.avalaraSaleType; - - this.avalaraTransactionType = builder.avalaraTransactionType; - - this.avalaraServiceType = builder.avalaraServiceType; - - this.dateFrom = builder.dateFrom; - - this.dateTo = builder.dateTo; - } - - public Long getAmount() { - return amount; - } - - public String getDescription() { - return description; - } - - public String getAmountInDecimal() { - return amountInDecimal; - } - - public AvalaraSaleType getAvalaraSaleType() { - return avalaraSaleType; - } - - public Integer getAvalaraTransactionType() { - return avalaraTransactionType; - } - - public Integer getAvalaraServiceType() { - return avalaraServiceType; - } - - public Timestamp getDateFrom() { - return dateFrom; - } - - public Timestamp getDateTo() { - return dateTo; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.amountInDecimal != null) { - - formData.put("amount_in_decimal", this.amountInDecimal); - } - - if (this.avalaraSaleType != null) { - - formData.put("avalara_sale_type", this.avalaraSaleType); - } - - if (this.avalaraTransactionType != null) { - - formData.put("avalara_transaction_type", this.avalaraTransactionType); - } - - if (this.avalaraServiceType != null) { - - formData.put("avalara_service_type", this.avalaraServiceType); - } - - if (this.dateFrom != null) { - - formData.put("date_from", this.dateFrom); - } - - if (this.dateTo != null) { - - formData.put("date_to", this.dateTo); - } - - return formData; - } - - /** Create a new builder for AddChargeAtTermEndForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddChargeAtTermEndForSubscriptionBuilder builder() { - return new AddChargeAtTermEndForSubscriptionBuilder(); - } - - public static final class AddChargeAtTermEndForSubscriptionBuilder { - - private Long amount; - - private String description; - - private String amountInDecimal; - - private AvalaraSaleType avalaraSaleType; - - private Integer avalaraTransactionType; - - private Integer avalaraServiceType; - - private Timestamp dateFrom; - - private Timestamp dateTo; - - private AddChargeAtTermEndForSubscriptionBuilder() {} - - public AddChargeAtTermEndForSubscriptionBuilder amount(Long value) { - this.amount = value; - return this; - } - - public AddChargeAtTermEndForSubscriptionBuilder description(String value) { - this.description = value; - return this; - } - - public AddChargeAtTermEndForSubscriptionBuilder amountInDecimal(String value) { - this.amountInDecimal = value; - return this; - } - - public AddChargeAtTermEndForSubscriptionBuilder avalaraSaleType(AvalaraSaleType value) { - this.avalaraSaleType = value; - return this; - } - - public AddChargeAtTermEndForSubscriptionBuilder avalaraTransactionType(Integer value) { - this.avalaraTransactionType = value; - return this; - } - - public AddChargeAtTermEndForSubscriptionBuilder avalaraServiceType(Integer value) { - this.avalaraServiceType = value; - return this; - } - - public AddChargeAtTermEndForSubscriptionBuilder dateFrom(Timestamp value) { - this.dateFrom = value; - return this; - } - - public AddChargeAtTermEndForSubscriptionBuilder dateTo(Timestamp value) { - this.dateTo = value; - return this; - } - - public AddChargeAtTermEndForSubscriptionParams build() { - return new AddChargeAtTermEndForSubscriptionParams(this); - } - } - - public enum AvalaraSaleType { - WHOLESALE("wholesale"), - - RETAIL("retail"), - - CONSUMED("consumed"), - - VENDOR_USE("vendor_use"), - - /** An enum member indicating that AvalaraSaleType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AvalaraSaleType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AvalaraSaleType fromString(String value) { - if (value == null) return _UNKNOWN; - for (AvalaraSaleType enumValue : AvalaraSaleType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/AddSubscriptionForCustomerParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/AddSubscriptionForCustomerParams.java deleted file mode 100644 index 56fda298..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/AddSubscriptionForCustomerParams.java +++ /dev/null @@ -1,2329 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class AddSubscriptionForCustomerParams { - - private final String id; - - private final String planId; - - private final Integer planQuantity; - - private final String planQuantityInDecimal; - - private final Long planUnitPrice; - - private final String planUnitPriceInDecimal; - - private final Long setupFee; - - private final Timestamp trialEnd; - - private final Integer billingCycles; - - private final List mandatoryAddonsToRemove; - - private final Timestamp startDate; - - private final String coupon; - - private final AutoCollection autoCollection; - - private final Integer termsToCharge; - - private final BillingAlignmentMode billingAlignmentMode; - - private final OfflinePaymentMethod offlinePaymentMethod; - - private final String poNumber; - - private final List couponIds; - - private final String paymentSourceId; - - private final Boolean overrideRelationship; - - private final String invoiceNotes; - - private final Timestamp invoiceDate; - - private final java.util.Map metaData; - - private final Boolean invoiceImmediately; - - private final Boolean replacePrimaryPaymentSource; - - private final Integer freePeriod; - - private final FreePeriodUnit freePeriodUnit; - - private final Integer contractTermBillingCycleOnRenewal; - - private final TrialEndAction trialEndAction; - - private final PaymentInitiator paymentInitiator; - - private final ShippingAddressParams shippingAddress; - - private final StatementDescriptorParams statementDescriptor; - - private final PaymentIntentParams paymentIntent; - - private final ContractTermParams contractTerm; - - private final List addons; - - private final List eventBasedAddons; - - private final List coupons; - - private final Map customFields; - - private AddSubscriptionForCustomerParams(AddSubscriptionForCustomerBuilder builder) { - - this.id = builder.id; - - this.planId = builder.planId; - - this.planQuantity = builder.planQuantity; - - this.planQuantityInDecimal = builder.planQuantityInDecimal; - - this.planUnitPrice = builder.planUnitPrice; - - this.planUnitPriceInDecimal = builder.planUnitPriceInDecimal; - - this.setupFee = builder.setupFee; - - this.trialEnd = builder.trialEnd; - - this.billingCycles = builder.billingCycles; - - this.mandatoryAddonsToRemove = builder.mandatoryAddonsToRemove; - - this.startDate = builder.startDate; - - this.coupon = builder.coupon; - - this.autoCollection = builder.autoCollection; - - this.termsToCharge = builder.termsToCharge; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.offlinePaymentMethod = builder.offlinePaymentMethod; - - this.poNumber = builder.poNumber; - - this.couponIds = builder.couponIds; - - this.paymentSourceId = builder.paymentSourceId; - - this.overrideRelationship = builder.overrideRelationship; - - this.invoiceNotes = builder.invoiceNotes; - - this.invoiceDate = builder.invoiceDate; - - this.metaData = builder.metaData; - - this.invoiceImmediately = builder.invoiceImmediately; - - this.replacePrimaryPaymentSource = builder.replacePrimaryPaymentSource; - - this.freePeriod = builder.freePeriod; - - this.freePeriodUnit = builder.freePeriodUnit; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - - this.trialEndAction = builder.trialEndAction; - - this.paymentInitiator = builder.paymentInitiator; - - this.shippingAddress = builder.shippingAddress; - - this.statementDescriptor = builder.statementDescriptor; - - this.paymentIntent = builder.paymentIntent; - - this.contractTerm = builder.contractTerm; - - this.addons = builder.addons; - - this.eventBasedAddons = builder.eventBasedAddons; - - this.coupons = builder.coupons; - - this.customFields = - builder.customFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); - } - - public String getId() { - return id; - } - - public String getPlanId() { - return planId; - } - - public Integer getPlanQuantity() { - return planQuantity; - } - - public String getPlanQuantityInDecimal() { - return planQuantityInDecimal; - } - - public Long getPlanUnitPrice() { - return planUnitPrice; - } - - public String getPlanUnitPriceInDecimal() { - return planUnitPriceInDecimal; - } - - public Long getSetupFee() { - return setupFee; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public List getMandatoryAddonsToRemove() { - return mandatoryAddonsToRemove; - } - - public Timestamp getStartDate() { - return startDate; - } - - public String getCoupon() { - return coupon; - } - - public AutoCollection getAutoCollection() { - return autoCollection; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public OfflinePaymentMethod getOfflinePaymentMethod() { - return offlinePaymentMethod; - } - - public String getPoNumber() { - return poNumber; - } - - public List getCouponIds() { - return couponIds; - } - - public String getPaymentSourceId() { - return paymentSourceId; - } - - public Boolean getOverrideRelationship() { - return overrideRelationship; - } - - public String getInvoiceNotes() { - return invoiceNotes; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public java.util.Map getMetaData() { - return metaData; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - public Boolean getReplacePrimaryPaymentSource() { - return replacePrimaryPaymentSource; - } - - public Integer getFreePeriod() { - return freePeriod; - } - - public FreePeriodUnit getFreePeriodUnit() { - return freePeriodUnit; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - public TrialEndAction getTrialEndAction() { - return trialEndAction; - } - - public PaymentInitiator getPaymentInitiator() { - return paymentInitiator; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public StatementDescriptorParams getStatementDescriptor() { - return statementDescriptor; - } - - public PaymentIntentParams getPaymentIntent() { - return paymentIntent; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public List getAddons() { - return addons; - } - - public List getEventBasedAddons() { - return eventBasedAddons; - } - - public List getCoupons() { - return coupons; - } - - public Map customFields() { - return customFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.planId != null) { - - formData.put("plan_id", this.planId); - } - - if (this.planQuantity != null) { - - formData.put("plan_quantity", this.planQuantity); - } - - if (this.planQuantityInDecimal != null) { - - formData.put("plan_quantity_in_decimal", this.planQuantityInDecimal); - } - - if (this.planUnitPrice != null) { - - formData.put("plan_unit_price", this.planUnitPrice); - } - - if (this.planUnitPriceInDecimal != null) { - - formData.put("plan_unit_price_in_decimal", this.planUnitPriceInDecimal); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.mandatoryAddonsToRemove != null) { - - formData.put("mandatory_addons_to_remove", this.mandatoryAddonsToRemove); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.coupon != null) { - - formData.put("coupon", this.coupon); - } - - if (this.autoCollection != null) { - - formData.put("auto_collection", this.autoCollection); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.offlinePaymentMethod != null) { - - formData.put("offline_payment_method", this.offlinePaymentMethod); - } - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.paymentSourceId != null) { - - formData.put("payment_source_id", this.paymentSourceId); - } - - if (this.overrideRelationship != null) { - - formData.put("override_relationship", this.overrideRelationship); - } - - if (this.invoiceNotes != null) { - - formData.put("invoice_notes", this.invoiceNotes); - } - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.metaData != null) { - - formData.put("meta_data", JsonUtil.toJson(this.metaData)); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - if (this.replacePrimaryPaymentSource != null) { - - formData.put("replace_primary_payment_source", this.replacePrimaryPaymentSource); - } - - if (this.freePeriod != null) { - - formData.put("free_period", this.freePeriod); - } - - if (this.freePeriodUnit != null) { - - formData.put("free_period_unit", this.freePeriodUnit); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - if (this.trialEndAction != null) { - - formData.put("trial_end_action", this.trialEndAction); - } - - if (this.paymentInitiator != null) { - - formData.put("payment_initiator", this.paymentInitiator); - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.statementDescriptor != null) { - - // Single object - Map nestedData = this.statementDescriptor.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "statement_descriptor[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.paymentIntent != null) { - - // Single object - Map nestedData = this.paymentIntent.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "payment_intent[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.addons != null) { - - // List of objects - for (int i = 0; i < this.addons.size(); i++) { - AddonsParams item = this.addons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.eventBasedAddons != null) { - - // List of objects - for (int i = 0; i < this.eventBasedAddons.size(); i++) { - EventBasedAddonsParams item = this.eventBasedAddons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.coupons != null) { - - // List of objects - for (int i = 0; i < this.coupons.size(); i++) { - CouponsParams item = this.coupons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(customFields); - - return formData; - } - - /** Create a new builder for AddSubscriptionForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddSubscriptionForCustomerBuilder builder() { - return new AddSubscriptionForCustomerBuilder(); - } - - public static final class AddSubscriptionForCustomerBuilder { - - private String id; - - private String planId; - - private Integer planQuantity; - - private String planQuantityInDecimal; - - private Long planUnitPrice; - - private String planUnitPriceInDecimal; - - private Long setupFee; - - private Timestamp trialEnd; - - private Integer billingCycles; - - private List mandatoryAddonsToRemove; - - private Timestamp startDate; - - private String coupon; - - private AutoCollection autoCollection; - - private Integer termsToCharge; - - private BillingAlignmentMode billingAlignmentMode; - - private OfflinePaymentMethod offlinePaymentMethod; - - private String poNumber; - - private List couponIds; - - private String paymentSourceId; - - private Boolean overrideRelationship; - - private String invoiceNotes; - - private Timestamp invoiceDate; - - private java.util.Map metaData; - - private Boolean invoiceImmediately; - - private Boolean replacePrimaryPaymentSource; - - private Integer freePeriod; - - private FreePeriodUnit freePeriodUnit; - - private Integer contractTermBillingCycleOnRenewal; - - private TrialEndAction trialEndAction; - - private PaymentInitiator paymentInitiator; - - private ShippingAddressParams shippingAddress; - - private StatementDescriptorParams statementDescriptor; - - private PaymentIntentParams paymentIntent; - - private ContractTermParams contractTerm; - - private List addons; - - private List eventBasedAddons; - - private List coupons; - - private Map customFields = new LinkedHashMap<>(); - - private AddSubscriptionForCustomerBuilder() {} - - public AddSubscriptionForCustomerBuilder id(String value) { - this.id = value; - return this; - } - - public AddSubscriptionForCustomerBuilder planId(String value) { - this.planId = value; - return this; - } - - public AddSubscriptionForCustomerBuilder planQuantity(Integer value) { - this.planQuantity = value; - return this; - } - - public AddSubscriptionForCustomerBuilder planQuantityInDecimal(String value) { - this.planQuantityInDecimal = value; - return this; - } - - public AddSubscriptionForCustomerBuilder planUnitPrice(Long value) { - this.planUnitPrice = value; - return this; - } - - public AddSubscriptionForCustomerBuilder planUnitPriceInDecimal(String value) { - this.planUnitPriceInDecimal = value; - return this; - } - - public AddSubscriptionForCustomerBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public AddSubscriptionForCustomerBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public AddSubscriptionForCustomerBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public AddSubscriptionForCustomerBuilder mandatoryAddonsToRemove(List value) { - this.mandatoryAddonsToRemove = value; - return this; - } - - public AddSubscriptionForCustomerBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - @Deprecated - public AddSubscriptionForCustomerBuilder coupon(String value) { - this.coupon = value; - return this; - } - - public AddSubscriptionForCustomerBuilder autoCollection(AutoCollection value) { - this.autoCollection = value; - return this; - } - - public AddSubscriptionForCustomerBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public AddSubscriptionForCustomerBuilder billingAlignmentMode(BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public AddSubscriptionForCustomerBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - this.offlinePaymentMethod = value; - return this; - } - - public AddSubscriptionForCustomerBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public AddSubscriptionForCustomerBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public AddSubscriptionForCustomerBuilder paymentSourceId(String value) { - this.paymentSourceId = value; - return this; - } - - public AddSubscriptionForCustomerBuilder overrideRelationship(Boolean value) { - this.overrideRelationship = value; - return this; - } - - public AddSubscriptionForCustomerBuilder invoiceNotes(String value) { - this.invoiceNotes = value; - return this; - } - - public AddSubscriptionForCustomerBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public AddSubscriptionForCustomerBuilder metaData(java.util.Map value) { - this.metaData = value; - return this; - } - - public AddSubscriptionForCustomerBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public AddSubscriptionForCustomerBuilder replacePrimaryPaymentSource(Boolean value) { - this.replacePrimaryPaymentSource = value; - return this; - } - - public AddSubscriptionForCustomerBuilder freePeriod(Integer value) { - this.freePeriod = value; - return this; - } - - public AddSubscriptionForCustomerBuilder freePeriodUnit(FreePeriodUnit value) { - this.freePeriodUnit = value; - return this; - } - - public AddSubscriptionForCustomerBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public AddSubscriptionForCustomerBuilder trialEndAction(TrialEndAction value) { - this.trialEndAction = value; - return this; - } - - public AddSubscriptionForCustomerBuilder paymentInitiator(PaymentInitiator value) { - this.paymentInitiator = value; - return this; - } - - public AddSubscriptionForCustomerBuilder shippingAddress(ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public AddSubscriptionForCustomerBuilder statementDescriptor(StatementDescriptorParams value) { - this.statementDescriptor = value; - return this; - } - - public AddSubscriptionForCustomerBuilder paymentIntent(PaymentIntentParams value) { - this.paymentIntent = value; - return this; - } - - public AddSubscriptionForCustomerBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public AddSubscriptionForCustomerBuilder addons(List value) { - this.addons = value; - return this; - } - - public AddSubscriptionForCustomerBuilder eventBasedAddons(List value) { - this.eventBasedAddons = value; - return this; - } - - @Deprecated - public AddSubscriptionForCustomerBuilder coupons(List value) { - this.coupons = value; - return this; - } - - /** - * Add a custom field to the request. Custom fields must start with "cf_". - * - * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") - * @param value the value of the custom field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cf_" - */ - public AddSubscriptionForCustomerBuilder customField(String fieldName, String value) { - if (fieldName == null || !fieldName.startsWith("cf_")) { - throw new IllegalArgumentException("Custom field name must start with 'cf_'"); - } - this.customFields.put(fieldName, value); - return this; - } - - /** - * Add multiple custom fields to the request. All field names must start with "cf_". - * - * @param customFields map of custom field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cf_" - */ - public AddSubscriptionForCustomerBuilder customFields(Map customFields) { - if (customFields != null) { - for (Map.Entry entry : customFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { - throw new IllegalArgumentException( - "Custom field name must start with 'cf_': " + entry.getKey()); - } - this.customFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public AddSubscriptionForCustomerParams build() { - return new AddSubscriptionForCustomerParams(this); - } - } - - public enum AutoCollection { - ON("on"), - - OFF("off"), - - /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AutoCollection(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AutoCollection fromString(String value) { - if (value == null) return _UNKNOWN; - for (AutoCollection enumValue : AutoCollection.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum FreePeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - FreePeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static FreePeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum TrialEndAction { - SITE_DEFAULT("site_default"), - - PLAN_DEFAULT("plan_default"), - - ACTIVATE_SUBSCRIPTION("activate_subscription"), - - CANCEL_SUBSCRIPTION("cancel_subscription"), - - /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - TrialEndAction(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static TrialEndAction fromString(String value) { - if (value == null) return _UNKNOWN; - for (TrialEndAction enumValue : TrialEndAction.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PaymentInitiator { - CUSTOMER("customer"), - - MERCHANT("merchant"), - - /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentInitiator(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentInitiator fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentInitiator enumValue : PaymentInitiator.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class StatementDescriptorParams { - - private final String descriptor; - - private StatementDescriptorParams(StatementDescriptorBuilder builder) { - - this.descriptor = builder.descriptor; - } - - public String getDescriptor() { - return descriptor; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.descriptor != null) { - - formData.put("descriptor", this.descriptor); - } - - return formData; - } - - /** Create a new builder for StatementDescriptorParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static StatementDescriptorBuilder builder() { - return new StatementDescriptorBuilder(); - } - - public static final class StatementDescriptorBuilder { - - private String descriptor; - - private StatementDescriptorBuilder() {} - - public StatementDescriptorBuilder descriptor(String value) { - this.descriptor = value; - return this; - } - - public StatementDescriptorParams build() { - return new StatementDescriptorParams(this); - } - } - } - - public static final class PaymentIntentParams { - - private final String id; - - private final String gatewayAccountId; - - private final String gwToken; - - private final PaymentMethodType paymentMethodType; - - private final String referenceId; - - private final String gwPaymentMethodId; - - private final java.util.Map additionalInformation; - - private PaymentIntentParams(PaymentIntentBuilder builder) { - - this.id = builder.id; - - this.gatewayAccountId = builder.gatewayAccountId; - - this.gwToken = builder.gwToken; - - this.paymentMethodType = builder.paymentMethodType; - - this.referenceId = builder.referenceId; - - this.gwPaymentMethodId = builder.gwPaymentMethodId; - - this.additionalInformation = builder.additionalInformation; - } - - public String getId() { - return id; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getGwToken() { - return gwToken; - } - - public PaymentMethodType getPaymentMethodType() { - return paymentMethodType; - } - - public String getReferenceId() { - return referenceId; - } - - public String getGwPaymentMethodId() { - return gwPaymentMethodId; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.gwToken != null) { - - formData.put("gw_token", this.gwToken); - } - - if (this.paymentMethodType != null) { - - formData.put("payment_method_type", this.paymentMethodType); - } - - if (this.referenceId != null) { - - formData.put("reference_id", this.referenceId); - } - - if (this.gwPaymentMethodId != null) { - - formData.put("gw_payment_method_id", this.gwPaymentMethodId); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for PaymentIntentParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PaymentIntentBuilder builder() { - return new PaymentIntentBuilder(); - } - - public static final class PaymentIntentBuilder { - - private String id; - - private String gatewayAccountId; - - private String gwToken; - - private PaymentMethodType paymentMethodType; - - private String referenceId; - - private String gwPaymentMethodId; - - private java.util.Map additionalInformation; - - private PaymentIntentBuilder() {} - - public PaymentIntentBuilder id(String value) { - this.id = value; - return this; - } - - public PaymentIntentBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public PaymentIntentBuilder gwToken(String value) { - this.gwToken = value; - return this; - } - - public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { - this.paymentMethodType = value; - return this; - } - - public PaymentIntentBuilder referenceId(String value) { - this.referenceId = value; - return this; - } - - @Deprecated - public PaymentIntentBuilder gwPaymentMethodId(String value) { - this.gwPaymentMethodId = value; - return this; - } - - public PaymentIntentBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public PaymentIntentParams build() { - return new PaymentIntentParams(this); - } - } - - public enum PaymentMethodType { - CARD("card"), - - IDEAL("ideal"), - - SOFORT("sofort"), - - BANCONTACT("bancontact"), - - GOOGLE_PAY("google_pay"), - - DOTPAY("dotpay"), - - GIROPAY("giropay"), - - APPLE_PAY("apple_pay"), - - UPI("upi"), - - NETBANKING_EMANDATES("netbanking_emandates"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - DIRECT_DEBIT("direct_debit"), - - BOLETO("boleto"), - - VENMO("venmo"), - - AMAZON_PAYMENTS("amazon_payments"), - - PAY_TO("pay_to"), - - FASTER_PAYMENTS("faster_payments"), - - SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), - - KLARNA_PAY_NOW("klarna_pay_now"), - - ONLINE_BANKING_POLAND("online_banking_poland"), - - PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), - - ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), - - KBC_PAYMENT_BUTTON("kbc_payment_button"), - - PAY_BY_BANK("pay_by_bank"), - - TRUSTLY("trustly"), - - STABLECOIN("stablecoin"), - - /** - * An enum member indicating that PaymentMethodType was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - PaymentMethodType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethodType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethodType enumValue : PaymentMethodType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class AddonsParams { - - private final String id; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Timestamp trialEnd; - - private AddonsParams(AddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.trialEnd = builder.trialEnd; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - return formData; - } - - /** Create a new builder for AddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddonsBuilder builder() { - return new AddonsBuilder(); - } - - public static final class AddonsBuilder { - - private String id; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Timestamp trialEnd; - - private AddonsBuilder() {} - - public AddonsBuilder id(String value) { - this.id = value; - return this; - } - - public AddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public AddonsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public AddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public AddonsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public AddonsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public AddonsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public AddonsParams build() { - return new AddonsParams(this); - } - } - } - - public static final class EventBasedAddonsParams { - - private final String id; - - private final Integer quantity; - - private final Long unitPrice; - - private final String quantityInDecimal; - - private final String unitPriceInDecimal; - - private final Integer servicePeriodInDays; - - private final OnEvent onEvent; - - private final Boolean chargeOnce; - - private final ChargeOn chargeOn; - - private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.unitPrice = builder.unitPrice; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.servicePeriodInDays = builder.servicePeriodInDays; - - this.onEvent = builder.onEvent; - - this.chargeOnce = builder.chargeOnce; - - this.chargeOn = builder.chargeOn; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getServicePeriodInDays() { - return servicePeriodInDays; - } - - public OnEvent getOnEvent() { - return onEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ChargeOn getChargeOn() { - return chargeOn; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.servicePeriodInDays != null) { - - formData.put("service_period_in_days", this.servicePeriodInDays); - } - - if (this.onEvent != null) { - - formData.put("on_event", this.onEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.chargeOn != null) { - - formData.put("charge_on", this.chargeOn); - } - - return formData; - } - - /** Create a new builder for EventBasedAddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EventBasedAddonsBuilder builder() { - return new EventBasedAddonsBuilder(); - } - - public static final class EventBasedAddonsBuilder { - - private String id; - - private Integer quantity; - - private Long unitPrice; - - private String quantityInDecimal; - - private String unitPriceInDecimal; - - private Integer servicePeriodInDays; - - private OnEvent onEvent; - - private Boolean chargeOnce; - - private ChargeOn chargeOn; - - private EventBasedAddonsBuilder() {} - - public EventBasedAddonsBuilder id(String value) { - this.id = value; - return this; - } - - public EventBasedAddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public EventBasedAddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public EventBasedAddonsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public EventBasedAddonsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { - this.servicePeriodInDays = value; - return this; - } - - public EventBasedAddonsBuilder onEvent(OnEvent value) { - this.onEvent = value; - return this; - } - - public EventBasedAddonsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public EventBasedAddonsBuilder chargeOn(ChargeOn value) { - this.chargeOn = value; - return this; - } - - public EventBasedAddonsParams build() { - return new EventBasedAddonsParams(this); - } - } - - public enum OnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that OnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - OnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (OnEvent enumValue : OnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOn { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOn enumValue : ChargeOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CouponsParams { - - private final String couponId; - - private final Timestamp applyTill; - - private CouponsParams(CouponsBuilder builder) { - - this.couponId = builder.couponId; - - this.applyTill = builder.applyTill; - } - - public String getCouponId() { - return couponId; - } - - public Timestamp getApplyTill() { - return applyTill; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.couponId != null) { - - formData.put("coupon_id", this.couponId); - } - - if (this.applyTill != null) { - - formData.put("apply_till", this.applyTill); - } - - return formData; - } - - /** Create a new builder for CouponsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CouponsBuilder builder() { - return new CouponsBuilder(); - } - - public static final class CouponsBuilder { - - private String couponId; - - private Timestamp applyTill; - - private CouponsBuilder() {} - - public CouponsBuilder couponId(String value) { - this.couponId = value; - return this; - } - - public CouponsBuilder applyTill(Timestamp value) { - this.applyTill = value; - return this; - } - - public CouponsParams build() { - return new CouponsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/CancelForItemsForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/CancelForItemsForSubscriptionParams.java deleted file mode 100644 index fc4ca6ee..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/CancelForItemsForSubscriptionParams.java +++ /dev/null @@ -1,621 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class CancelForItemsForSubscriptionParams { - - private final CancelOption cancelOption; - - private final Boolean endOfTerm; - - private final Timestamp cancelAt; - - private final CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; - - private final UnbilledChargesOption unbilledChargesOption; - - private final AccountReceivablesHandling accountReceivablesHandling; - - private final RefundableCreditsHandling refundableCreditsHandling; - - private final ContractTermCancelOption contractTermCancelOption; - - private final Timestamp invoiceDate; - - private final String cancelReasonCode; - - private final List subscriptionItems; - - private CancelForItemsForSubscriptionParams(CancelForItemsForSubscriptionBuilder builder) { - - this.cancelOption = builder.cancelOption; - - this.endOfTerm = builder.endOfTerm; - - this.cancelAt = builder.cancelAt; - - this.creditOptionForCurrentTermCharges = builder.creditOptionForCurrentTermCharges; - - this.unbilledChargesOption = builder.unbilledChargesOption; - - this.accountReceivablesHandling = builder.accountReceivablesHandling; - - this.refundableCreditsHandling = builder.refundableCreditsHandling; - - this.contractTermCancelOption = builder.contractTermCancelOption; - - this.invoiceDate = builder.invoiceDate; - - this.cancelReasonCode = builder.cancelReasonCode; - - this.subscriptionItems = builder.subscriptionItems; - } - - public CancelOption getCancelOption() { - return cancelOption; - } - - public Boolean getEndOfTerm() { - return endOfTerm; - } - - public Timestamp getCancelAt() { - return cancelAt; - } - - public CreditOptionForCurrentTermCharges getCreditOptionForCurrentTermCharges() { - return creditOptionForCurrentTermCharges; - } - - public UnbilledChargesOption getUnbilledChargesOption() { - return unbilledChargesOption; - } - - public AccountReceivablesHandling getAccountReceivablesHandling() { - return accountReceivablesHandling; - } - - public RefundableCreditsHandling getRefundableCreditsHandling() { - return refundableCreditsHandling; - } - - public ContractTermCancelOption getContractTermCancelOption() { - return contractTermCancelOption; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public String getCancelReasonCode() { - return cancelReasonCode; - } - - public List getSubscriptionItems() { - return subscriptionItems; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.cancelOption != null) { - - formData.put("cancel_option", this.cancelOption); - } - - if (this.endOfTerm != null) { - - formData.put("end_of_term", this.endOfTerm); - } - - if (this.cancelAt != null) { - - formData.put("cancel_at", this.cancelAt); - } - - if (this.creditOptionForCurrentTermCharges != null) { - - formData.put( - "credit_option_for_current_term_charges", this.creditOptionForCurrentTermCharges); - } - - if (this.unbilledChargesOption != null) { - - formData.put("unbilled_charges_option", this.unbilledChargesOption); - } - - if (this.accountReceivablesHandling != null) { - - formData.put("account_receivables_handling", this.accountReceivablesHandling); - } - - if (this.refundableCreditsHandling != null) { - - formData.put("refundable_credits_handling", this.refundableCreditsHandling); - } - - if (this.contractTermCancelOption != null) { - - formData.put("contract_term_cancel_option", this.contractTermCancelOption); - } - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.cancelReasonCode != null) { - - formData.put("cancel_reason_code", this.cancelReasonCode); - } - - if (this.subscriptionItems != null) { - - // List of objects - for (int i = 0; i < this.subscriptionItems.size(); i++) { - SubscriptionItemsParams item = this.subscriptionItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for CancelForItemsForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CancelForItemsForSubscriptionBuilder builder() { - return new CancelForItemsForSubscriptionBuilder(); - } - - public static final class CancelForItemsForSubscriptionBuilder { - - private CancelOption cancelOption; - - private Boolean endOfTerm; - - private Timestamp cancelAt; - - private CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; - - private UnbilledChargesOption unbilledChargesOption; - - private AccountReceivablesHandling accountReceivablesHandling; - - private RefundableCreditsHandling refundableCreditsHandling; - - private ContractTermCancelOption contractTermCancelOption; - - private Timestamp invoiceDate; - - private String cancelReasonCode; - - private List subscriptionItems; - - private CancelForItemsForSubscriptionBuilder() {} - - public CancelForItemsForSubscriptionBuilder cancelOption(CancelOption value) { - this.cancelOption = value; - return this; - } - - public CancelForItemsForSubscriptionBuilder endOfTerm(Boolean value) { - this.endOfTerm = value; - return this; - } - - public CancelForItemsForSubscriptionBuilder cancelAt(Timestamp value) { - this.cancelAt = value; - return this; - } - - public CancelForItemsForSubscriptionBuilder creditOptionForCurrentTermCharges( - CreditOptionForCurrentTermCharges value) { - this.creditOptionForCurrentTermCharges = value; - return this; - } - - public CancelForItemsForSubscriptionBuilder unbilledChargesOption(UnbilledChargesOption value) { - this.unbilledChargesOption = value; - return this; - } - - public CancelForItemsForSubscriptionBuilder accountReceivablesHandling( - AccountReceivablesHandling value) { - this.accountReceivablesHandling = value; - return this; - } - - public CancelForItemsForSubscriptionBuilder refundableCreditsHandling( - RefundableCreditsHandling value) { - this.refundableCreditsHandling = value; - return this; - } - - public CancelForItemsForSubscriptionBuilder contractTermCancelOption( - ContractTermCancelOption value) { - this.contractTermCancelOption = value; - return this; - } - - public CancelForItemsForSubscriptionBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public CancelForItemsForSubscriptionBuilder cancelReasonCode(String value) { - this.cancelReasonCode = value; - return this; - } - - public CancelForItemsForSubscriptionBuilder subscriptionItems( - List value) { - this.subscriptionItems = value; - return this; - } - - public CancelForItemsForSubscriptionParams build() { - return new CancelForItemsForSubscriptionParams(this); - } - } - - public enum CancelOption { - IMMEDIATELY("immediately"), - - END_OF_TERM("end_of_term"), - - SPECIFIC_DATE("specific_date"), - - END_OF_BILLING_TERM("end_of_billing_term"), - - /** An enum member indicating that CancelOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - CancelOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CancelOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (CancelOption enumValue : CancelOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum CreditOptionForCurrentTermCharges { - NONE("none"), - - PRORATE("prorate"), - - FULL("full"), - - /** - * An enum member indicating that CreditOptionForCurrentTermCharges was instantiated with an - * unknown value. - */ - _UNKNOWN(null); - private final String value; - - CreditOptionForCurrentTermCharges(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CreditOptionForCurrentTermCharges fromString(String value) { - if (value == null) return _UNKNOWN; - for (CreditOptionForCurrentTermCharges enumValue : - CreditOptionForCurrentTermCharges.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum UnbilledChargesOption { - INVOICE("invoice"), - - DELETE("delete"), - - /** - * An enum member indicating that UnbilledChargesOption was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - UnbilledChargesOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static UnbilledChargesOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (UnbilledChargesOption enumValue : UnbilledChargesOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum AccountReceivablesHandling { - NO_ACTION("no_action"), - - SCHEDULE_PAYMENT_COLLECTION("schedule_payment_collection"), - - WRITE_OFF("write_off"), - - /** - * An enum member indicating that AccountReceivablesHandling was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - AccountReceivablesHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AccountReceivablesHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (AccountReceivablesHandling enumValue : AccountReceivablesHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum RefundableCreditsHandling { - NO_ACTION("no_action"), - - SCHEDULE_REFUND("schedule_refund"), - - /** - * An enum member indicating that RefundableCreditsHandling was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - RefundableCreditsHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static RefundableCreditsHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (RefundableCreditsHandling enumValue : RefundableCreditsHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ContractTermCancelOption { - TERMINATE_IMMEDIATELY("terminate_immediately"), - - END_OF_CONTRACT_TERM("end_of_contract_term"), - - SPECIFIC_DATE("specific_date"), - - END_OF_SUBSCRIPTION_BILLING_TERM("end_of_subscription_billing_term"), - - /** - * An enum member indicating that ContractTermCancelOption was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - ContractTermCancelOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ContractTermCancelOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ContractTermCancelOption enumValue : ContractTermCancelOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class SubscriptionItemsParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer servicePeriodDays; - - private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.servicePeriodDays = builder.servicePeriodDays; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - return formData; - } - - /** Create a new builder for SubscriptionItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionItemsBuilder builder() { - return new SubscriptionItemsBuilder(); - } - - public static final class SubscriptionItemsBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer servicePeriodDays; - - private SubscriptionItemsBuilder() {} - - public SubscriptionItemsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public SubscriptionItemsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public SubscriptionItemsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public SubscriptionItemsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public SubscriptionItemsParams build() { - return new SubscriptionItemsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/CancelForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/CancelForSubscriptionParams.java deleted file mode 100644 index 29c122cb..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/CancelForSubscriptionParams.java +++ /dev/null @@ -1,578 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class CancelForSubscriptionParams { - - private final CancelOption cancelOption; - - private final Boolean endOfTerm; - - private final Timestamp cancelAt; - - private final CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; - - private final UnbilledChargesOption unbilledChargesOption; - - private final AccountReceivablesHandling accountReceivablesHandling; - - private final RefundableCreditsHandling refundableCreditsHandling; - - private final ContractTermCancelOption contractTermCancelOption; - - private final Timestamp invoiceDate; - - private final String cancelReasonCode; - - private final List eventBasedAddons; - - private CancelForSubscriptionParams(CancelForSubscriptionBuilder builder) { - - this.cancelOption = builder.cancelOption; - - this.endOfTerm = builder.endOfTerm; - - this.cancelAt = builder.cancelAt; - - this.creditOptionForCurrentTermCharges = builder.creditOptionForCurrentTermCharges; - - this.unbilledChargesOption = builder.unbilledChargesOption; - - this.accountReceivablesHandling = builder.accountReceivablesHandling; - - this.refundableCreditsHandling = builder.refundableCreditsHandling; - - this.contractTermCancelOption = builder.contractTermCancelOption; - - this.invoiceDate = builder.invoiceDate; - - this.cancelReasonCode = builder.cancelReasonCode; - - this.eventBasedAddons = builder.eventBasedAddons; - } - - public CancelOption getCancelOption() { - return cancelOption; - } - - public Boolean getEndOfTerm() { - return endOfTerm; - } - - public Timestamp getCancelAt() { - return cancelAt; - } - - public CreditOptionForCurrentTermCharges getCreditOptionForCurrentTermCharges() { - return creditOptionForCurrentTermCharges; - } - - public UnbilledChargesOption getUnbilledChargesOption() { - return unbilledChargesOption; - } - - public AccountReceivablesHandling getAccountReceivablesHandling() { - return accountReceivablesHandling; - } - - public RefundableCreditsHandling getRefundableCreditsHandling() { - return refundableCreditsHandling; - } - - public ContractTermCancelOption getContractTermCancelOption() { - return contractTermCancelOption; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public String getCancelReasonCode() { - return cancelReasonCode; - } - - public List getEventBasedAddons() { - return eventBasedAddons; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.cancelOption != null) { - - formData.put("cancel_option", this.cancelOption); - } - - if (this.endOfTerm != null) { - - formData.put("end_of_term", this.endOfTerm); - } - - if (this.cancelAt != null) { - - formData.put("cancel_at", this.cancelAt); - } - - if (this.creditOptionForCurrentTermCharges != null) { - - formData.put( - "credit_option_for_current_term_charges", this.creditOptionForCurrentTermCharges); - } - - if (this.unbilledChargesOption != null) { - - formData.put("unbilled_charges_option", this.unbilledChargesOption); - } - - if (this.accountReceivablesHandling != null) { - - formData.put("account_receivables_handling", this.accountReceivablesHandling); - } - - if (this.refundableCreditsHandling != null) { - - formData.put("refundable_credits_handling", this.refundableCreditsHandling); - } - - if (this.contractTermCancelOption != null) { - - formData.put("contract_term_cancel_option", this.contractTermCancelOption); - } - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.cancelReasonCode != null) { - - formData.put("cancel_reason_code", this.cancelReasonCode); - } - - if (this.eventBasedAddons != null) { - - // List of objects - for (int i = 0; i < this.eventBasedAddons.size(); i++) { - EventBasedAddonsParams item = this.eventBasedAddons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for CancelForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CancelForSubscriptionBuilder builder() { - return new CancelForSubscriptionBuilder(); - } - - public static final class CancelForSubscriptionBuilder { - - private CancelOption cancelOption; - - private Boolean endOfTerm; - - private Timestamp cancelAt; - - private CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; - - private UnbilledChargesOption unbilledChargesOption; - - private AccountReceivablesHandling accountReceivablesHandling; - - private RefundableCreditsHandling refundableCreditsHandling; - - private ContractTermCancelOption contractTermCancelOption; - - private Timestamp invoiceDate; - - private String cancelReasonCode; - - private List eventBasedAddons; - - private CancelForSubscriptionBuilder() {} - - public CancelForSubscriptionBuilder cancelOption(CancelOption value) { - this.cancelOption = value; - return this; - } - - public CancelForSubscriptionBuilder endOfTerm(Boolean value) { - this.endOfTerm = value; - return this; - } - - public CancelForSubscriptionBuilder cancelAt(Timestamp value) { - this.cancelAt = value; - return this; - } - - public CancelForSubscriptionBuilder creditOptionForCurrentTermCharges( - CreditOptionForCurrentTermCharges value) { - this.creditOptionForCurrentTermCharges = value; - return this; - } - - public CancelForSubscriptionBuilder unbilledChargesOption(UnbilledChargesOption value) { - this.unbilledChargesOption = value; - return this; - } - - public CancelForSubscriptionBuilder accountReceivablesHandling( - AccountReceivablesHandling value) { - this.accountReceivablesHandling = value; - return this; - } - - public CancelForSubscriptionBuilder refundableCreditsHandling(RefundableCreditsHandling value) { - this.refundableCreditsHandling = value; - return this; - } - - public CancelForSubscriptionBuilder contractTermCancelOption(ContractTermCancelOption value) { - this.contractTermCancelOption = value; - return this; - } - - public CancelForSubscriptionBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public CancelForSubscriptionBuilder cancelReasonCode(String value) { - this.cancelReasonCode = value; - return this; - } - - public CancelForSubscriptionBuilder eventBasedAddons(List value) { - this.eventBasedAddons = value; - return this; - } - - public CancelForSubscriptionParams build() { - return new CancelForSubscriptionParams(this); - } - } - - public enum CancelOption { - IMMEDIATELY("immediately"), - - END_OF_TERM("end_of_term"), - - SPECIFIC_DATE("specific_date"), - - END_OF_BILLING_TERM("end_of_billing_term"), - - /** An enum member indicating that CancelOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - CancelOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CancelOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (CancelOption enumValue : CancelOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum CreditOptionForCurrentTermCharges { - NONE("none"), - - PRORATE("prorate"), - - FULL("full"), - - /** - * An enum member indicating that CreditOptionForCurrentTermCharges was instantiated with an - * unknown value. - */ - _UNKNOWN(null); - private final String value; - - CreditOptionForCurrentTermCharges(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static CreditOptionForCurrentTermCharges fromString(String value) { - if (value == null) return _UNKNOWN; - for (CreditOptionForCurrentTermCharges enumValue : - CreditOptionForCurrentTermCharges.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum UnbilledChargesOption { - INVOICE("invoice"), - - DELETE("delete"), - - /** - * An enum member indicating that UnbilledChargesOption was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - UnbilledChargesOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static UnbilledChargesOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (UnbilledChargesOption enumValue : UnbilledChargesOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum AccountReceivablesHandling { - NO_ACTION("no_action"), - - SCHEDULE_PAYMENT_COLLECTION("schedule_payment_collection"), - - WRITE_OFF("write_off"), - - /** - * An enum member indicating that AccountReceivablesHandling was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - AccountReceivablesHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AccountReceivablesHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (AccountReceivablesHandling enumValue : AccountReceivablesHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum RefundableCreditsHandling { - NO_ACTION("no_action"), - - SCHEDULE_REFUND("schedule_refund"), - - /** - * An enum member indicating that RefundableCreditsHandling was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - RefundableCreditsHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static RefundableCreditsHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (RefundableCreditsHandling enumValue : RefundableCreditsHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ContractTermCancelOption { - TERMINATE_IMMEDIATELY("terminate_immediately"), - - END_OF_CONTRACT_TERM("end_of_contract_term"), - - SPECIFIC_DATE("specific_date"), - - END_OF_SUBSCRIPTION_BILLING_TERM("end_of_subscription_billing_term"), - - /** - * An enum member indicating that ContractTermCancelOption was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - ContractTermCancelOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ContractTermCancelOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ContractTermCancelOption enumValue : ContractTermCancelOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class EventBasedAddonsParams { - - private final String id; - - private final Integer quantity; - - private final Long unitPrice; - - private final Integer servicePeriodInDays; - - private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.unitPrice = builder.unitPrice; - - this.servicePeriodInDays = builder.servicePeriodInDays; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public Integer getServicePeriodInDays() { - return servicePeriodInDays; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.servicePeriodInDays != null) { - - formData.put("service_period_in_days", this.servicePeriodInDays); - } - - return formData; - } - - /** Create a new builder for EventBasedAddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EventBasedAddonsBuilder builder() { - return new EventBasedAddonsBuilder(); - } - - public static final class EventBasedAddonsBuilder { - - private String id; - - private Integer quantity; - - private Long unitPrice; - - private Integer servicePeriodInDays; - - private EventBasedAddonsBuilder() {} - - public EventBasedAddonsBuilder id(String value) { - this.id = value; - return this; - } - - public EventBasedAddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public EventBasedAddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { - this.servicePeriodInDays = value; - return this; - } - - public EventBasedAddonsParams build() { - return new EventBasedAddonsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/ChangeTermEndForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/ChangeTermEndForSubscriptionParams.java deleted file mode 100644 index 010536f5..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/ChangeTermEndForSubscriptionParams.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class ChangeTermEndForSubscriptionParams { - - private final Timestamp termEndsAt; - - private final Boolean prorate; - - private final Boolean invoiceImmediately; - - private ChangeTermEndForSubscriptionParams(ChangeTermEndForSubscriptionBuilder builder) { - - this.termEndsAt = builder.termEndsAt; - - this.prorate = builder.prorate; - - this.invoiceImmediately = builder.invoiceImmediately; - } - - public Timestamp getTermEndsAt() { - return termEndsAt; - } - - public Boolean getProrate() { - return prorate; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.termEndsAt != null) { - - formData.put("term_ends_at", this.termEndsAt); - } - - if (this.prorate != null) { - - formData.put("prorate", this.prorate); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - return formData; - } - - /** Create a new builder for ChangeTermEndForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ChangeTermEndForSubscriptionBuilder builder() { - return new ChangeTermEndForSubscriptionBuilder(); - } - - public static final class ChangeTermEndForSubscriptionBuilder { - - private Timestamp termEndsAt; - - private Boolean prorate; - - private Boolean invoiceImmediately; - - private ChangeTermEndForSubscriptionBuilder() {} - - public ChangeTermEndForSubscriptionBuilder termEndsAt(Timestamp value) { - this.termEndsAt = value; - return this; - } - - public ChangeTermEndForSubscriptionBuilder prorate(Boolean value) { - this.prorate = value; - return this; - } - - public ChangeTermEndForSubscriptionBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public ChangeTermEndForSubscriptionParams build() { - return new ChangeTermEndForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/ChargeAddonAtTermEndForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/ChargeAddonAtTermEndForSubscriptionParams.java deleted file mode 100644 index 5ad62d5c..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/ChargeAddonAtTermEndForSubscriptionParams.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class ChargeAddonAtTermEndForSubscriptionParams { - - private final String addonId; - - private final Integer addonQuantity; - - private final Long addonUnitPrice; - - private final String addonQuantityInDecimal; - - private final String addonUnitPriceInDecimal; - - private final Timestamp dateFrom; - - private final Timestamp dateTo; - - private ChargeAddonAtTermEndForSubscriptionParams( - ChargeAddonAtTermEndForSubscriptionBuilder builder) { - - this.addonId = builder.addonId; - - this.addonQuantity = builder.addonQuantity; - - this.addonUnitPrice = builder.addonUnitPrice; - - this.addonQuantityInDecimal = builder.addonQuantityInDecimal; - - this.addonUnitPriceInDecimal = builder.addonUnitPriceInDecimal; - - this.dateFrom = builder.dateFrom; - - this.dateTo = builder.dateTo; - } - - public String getAddonId() { - return addonId; - } - - public Integer getAddonQuantity() { - return addonQuantity; - } - - public Long getAddonUnitPrice() { - return addonUnitPrice; - } - - public String getAddonQuantityInDecimal() { - return addonQuantityInDecimal; - } - - public String getAddonUnitPriceInDecimal() { - return addonUnitPriceInDecimal; - } - - public Timestamp getDateFrom() { - return dateFrom; - } - - public Timestamp getDateTo() { - return dateTo; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.addonId != null) { - - formData.put("addon_id", this.addonId); - } - - if (this.addonQuantity != null) { - - formData.put("addon_quantity", this.addonQuantity); - } - - if (this.addonUnitPrice != null) { - - formData.put("addon_unit_price", this.addonUnitPrice); - } - - if (this.addonQuantityInDecimal != null) { - - formData.put("addon_quantity_in_decimal", this.addonQuantityInDecimal); - } - - if (this.addonUnitPriceInDecimal != null) { - - formData.put("addon_unit_price_in_decimal", this.addonUnitPriceInDecimal); - } - - if (this.dateFrom != null) { - - formData.put("date_from", this.dateFrom); - } - - if (this.dateTo != null) { - - formData.put("date_to", this.dateTo); - } - - return formData; - } - - /** Create a new builder for ChargeAddonAtTermEndForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ChargeAddonAtTermEndForSubscriptionBuilder builder() { - return new ChargeAddonAtTermEndForSubscriptionBuilder(); - } - - public static final class ChargeAddonAtTermEndForSubscriptionBuilder { - - private String addonId; - - private Integer addonQuantity; - - private Long addonUnitPrice; - - private String addonQuantityInDecimal; - - private String addonUnitPriceInDecimal; - - private Timestamp dateFrom; - - private Timestamp dateTo; - - private ChargeAddonAtTermEndForSubscriptionBuilder() {} - - public ChargeAddonAtTermEndForSubscriptionBuilder addonId(String value) { - this.addonId = value; - return this; - } - - public ChargeAddonAtTermEndForSubscriptionBuilder addonQuantity(Integer value) { - this.addonQuantity = value; - return this; - } - - public ChargeAddonAtTermEndForSubscriptionBuilder addonUnitPrice(Long value) { - this.addonUnitPrice = value; - return this; - } - - public ChargeAddonAtTermEndForSubscriptionBuilder addonQuantityInDecimal(String value) { - this.addonQuantityInDecimal = value; - return this; - } - - public ChargeAddonAtTermEndForSubscriptionBuilder addonUnitPriceInDecimal(String value) { - this.addonUnitPriceInDecimal = value; - return this; - } - - public ChargeAddonAtTermEndForSubscriptionBuilder dateFrom(Timestamp value) { - this.dateFrom = value; - return this; - } - - public ChargeAddonAtTermEndForSubscriptionBuilder dateTo(Timestamp value) { - this.dateTo = value; - return this; - } - - public ChargeAddonAtTermEndForSubscriptionParams build() { - return new ChargeAddonAtTermEndForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/ChargeFutureRenewalsForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/ChargeFutureRenewalsForSubscriptionParams.java deleted file mode 100644 index e9ab0f62..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/ChargeFutureRenewalsForSubscriptionParams.java +++ /dev/null @@ -1,396 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class ChargeFutureRenewalsForSubscriptionParams { - - private final Integer termsToCharge; - - private final Boolean invoiceImmediately; - - private final ScheduleType scheduleType; - - private final FixedIntervalScheduleParams fixedIntervalSchedule; - - private final List specificDatesSchedule; - - private ChargeFutureRenewalsForSubscriptionParams( - ChargeFutureRenewalsForSubscriptionBuilder builder) { - - this.termsToCharge = builder.termsToCharge; - - this.invoiceImmediately = builder.invoiceImmediately; - - this.scheduleType = builder.scheduleType; - - this.fixedIntervalSchedule = builder.fixedIntervalSchedule; - - this.specificDatesSchedule = builder.specificDatesSchedule; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - public ScheduleType getScheduleType() { - return scheduleType; - } - - public FixedIntervalScheduleParams getFixedIntervalSchedule() { - return fixedIntervalSchedule; - } - - public List getSpecificDatesSchedule() { - return specificDatesSchedule; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - if (this.scheduleType != null) { - - formData.put("schedule_type", this.scheduleType); - } - - if (this.fixedIntervalSchedule != null) { - - // Single object - Map nestedData = this.fixedIntervalSchedule.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "fixed_interval_schedule[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.specificDatesSchedule != null) { - - // List of objects - for (int i = 0; i < this.specificDatesSchedule.size(); i++) { - SpecificDatesScheduleParams item = this.specificDatesSchedule.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "specific_dates_schedule[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for ChargeFutureRenewalsForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ChargeFutureRenewalsForSubscriptionBuilder builder() { - return new ChargeFutureRenewalsForSubscriptionBuilder(); - } - - public static final class ChargeFutureRenewalsForSubscriptionBuilder { - - private Integer termsToCharge; - - private Boolean invoiceImmediately; - - private ScheduleType scheduleType; - - private FixedIntervalScheduleParams fixedIntervalSchedule; - - private List specificDatesSchedule; - - private ChargeFutureRenewalsForSubscriptionBuilder() {} - - public ChargeFutureRenewalsForSubscriptionBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public ChargeFutureRenewalsForSubscriptionBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public ChargeFutureRenewalsForSubscriptionBuilder scheduleType(ScheduleType value) { - this.scheduleType = value; - return this; - } - - public ChargeFutureRenewalsForSubscriptionBuilder fixedIntervalSchedule( - FixedIntervalScheduleParams value) { - this.fixedIntervalSchedule = value; - return this; - } - - public ChargeFutureRenewalsForSubscriptionBuilder specificDatesSchedule( - List value) { - this.specificDatesSchedule = value; - return this; - } - - public ChargeFutureRenewalsForSubscriptionParams build() { - return new ChargeFutureRenewalsForSubscriptionParams(this); - } - } - - public enum ScheduleType { - IMMEDIATE("immediate"), - - SPECIFIC_DATES("specific_dates"), - - FIXED_INTERVALS("fixed_intervals"), - - /** An enum member indicating that ScheduleType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ScheduleType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ScheduleType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ScheduleType enumValue : ScheduleType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class FixedIntervalScheduleParams { - - private final Integer numberOfOccurrences; - - private final Integer daysBeforeRenewal; - - private final EndScheduleOn endScheduleOn; - - private final Timestamp endDate; - - private FixedIntervalScheduleParams(FixedIntervalScheduleBuilder builder) { - - this.numberOfOccurrences = builder.numberOfOccurrences; - - this.daysBeforeRenewal = builder.daysBeforeRenewal; - - this.endScheduleOn = builder.endScheduleOn; - - this.endDate = builder.endDate; - } - - public Integer getNumberOfOccurrences() { - return numberOfOccurrences; - } - - public Integer getDaysBeforeRenewal() { - return daysBeforeRenewal; - } - - public EndScheduleOn getEndScheduleOn() { - return endScheduleOn; - } - - public Timestamp getEndDate() { - return endDate; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.numberOfOccurrences != null) { - - formData.put("number_of_occurrences", this.numberOfOccurrences); - } - - if (this.daysBeforeRenewal != null) { - - formData.put("days_before_renewal", this.daysBeforeRenewal); - } - - if (this.endScheduleOn != null) { - - formData.put("end_schedule_on", this.endScheduleOn); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - return formData; - } - - /** Create a new builder for FixedIntervalScheduleParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static FixedIntervalScheduleBuilder builder() { - return new FixedIntervalScheduleBuilder(); - } - - public static final class FixedIntervalScheduleBuilder { - - private Integer numberOfOccurrences; - - private Integer daysBeforeRenewal; - - private EndScheduleOn endScheduleOn; - - private Timestamp endDate; - - private FixedIntervalScheduleBuilder() {} - - public FixedIntervalScheduleBuilder numberOfOccurrences(Integer value) { - this.numberOfOccurrences = value; - return this; - } - - public FixedIntervalScheduleBuilder daysBeforeRenewal(Integer value) { - this.daysBeforeRenewal = value; - return this; - } - - public FixedIntervalScheduleBuilder endScheduleOn(EndScheduleOn value) { - this.endScheduleOn = value; - return this; - } - - public FixedIntervalScheduleBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public FixedIntervalScheduleParams build() { - return new FixedIntervalScheduleParams(this); - } - } - - public enum EndScheduleOn { - AFTER_NUMBER_OF_INTERVALS("after_number_of_intervals"), - - SPECIFIC_DATE("specific_date"), - - SUBSCRIPTION_END("subscription_end"), - - /** An enum member indicating that EndScheduleOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - EndScheduleOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static EndScheduleOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (EndScheduleOn enumValue : EndScheduleOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class SpecificDatesScheduleParams { - - private final Integer termsToCharge; - - private final Timestamp date; - - private SpecificDatesScheduleParams(SpecificDatesScheduleBuilder builder) { - - this.termsToCharge = builder.termsToCharge; - - this.date = builder.date; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public Timestamp getDate() { - return date; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.date != null) { - - formData.put("date", this.date); - } - - return formData; - } - - /** Create a new builder for SpecificDatesScheduleParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SpecificDatesScheduleBuilder builder() { - return new SpecificDatesScheduleBuilder(); - } - - public static final class SpecificDatesScheduleBuilder { - - private Integer termsToCharge; - - private Timestamp date; - - private SpecificDatesScheduleBuilder() {} - - public SpecificDatesScheduleBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public SpecificDatesScheduleBuilder date(Timestamp value) { - this.date = value; - return this; - } - - public SpecificDatesScheduleParams build() { - return new SpecificDatesScheduleParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/DeleteSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/DeleteSubscriptionParams.java deleted file mode 100644 index 3935aa05..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/DeleteSubscriptionParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteSubscriptionParams { - - private DeleteSubscriptionParams(DeleteSubscriptionBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteSubscriptionBuilder builder() { - return new DeleteSubscriptionBuilder(); - } - - public static final class DeleteSubscriptionBuilder { - - private DeleteSubscriptionBuilder() {} - - public DeleteSubscriptionParams build() { - return new DeleteSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/DiscountsForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/DiscountsForSubscriptionParams.java deleted file mode 100644 index 1044df55..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/DiscountsForSubscriptionParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DiscountsForSubscriptionParams { - - private final Map queryParams; - - private DiscountsForSubscriptionParams(DiscountsForSubscriptionBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public DiscountsForSubscriptionBuilder toBuilder() { - DiscountsForSubscriptionBuilder builder = new DiscountsForSubscriptionBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for DiscountsForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsForSubscriptionBuilder builder() { - return new DiscountsForSubscriptionBuilder(); - } - - public static final class DiscountsForSubscriptionBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private DiscountsForSubscriptionBuilder() {} - - public DiscountsForSubscriptionBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public DiscountsForSubscriptionBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - public DiscountsForSubscriptionParams build() { - return new DiscountsForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/EditAdvanceInvoiceScheduleForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/EditAdvanceInvoiceScheduleForSubscriptionParams.java deleted file mode 100644 index d848e59f..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/EditAdvanceInvoiceScheduleForSubscriptionParams.java +++ /dev/null @@ -1,394 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class EditAdvanceInvoiceScheduleForSubscriptionParams { - - private final Integer termsToCharge; - - private final ScheduleType scheduleType; - - private final FixedIntervalScheduleParams fixedIntervalSchedule; - - private final List specificDatesSchedule; - - private EditAdvanceInvoiceScheduleForSubscriptionParams( - EditAdvanceInvoiceScheduleForSubscriptionBuilder builder) { - - this.termsToCharge = builder.termsToCharge; - - this.scheduleType = builder.scheduleType; - - this.fixedIntervalSchedule = builder.fixedIntervalSchedule; - - this.specificDatesSchedule = builder.specificDatesSchedule; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public ScheduleType getScheduleType() { - return scheduleType; - } - - public FixedIntervalScheduleParams getFixedIntervalSchedule() { - return fixedIntervalSchedule; - } - - public List getSpecificDatesSchedule() { - return specificDatesSchedule; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.scheduleType != null) { - - formData.put("schedule_type", this.scheduleType); - } - - if (this.fixedIntervalSchedule != null) { - - // Single object - Map nestedData = this.fixedIntervalSchedule.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "fixed_interval_schedule[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.specificDatesSchedule != null) { - - // List of objects - for (int i = 0; i < this.specificDatesSchedule.size(); i++) { - SpecificDatesScheduleParams item = this.specificDatesSchedule.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "specific_dates_schedule[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for EditAdvanceInvoiceScheduleForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EditAdvanceInvoiceScheduleForSubscriptionBuilder builder() { - return new EditAdvanceInvoiceScheduleForSubscriptionBuilder(); - } - - public static final class EditAdvanceInvoiceScheduleForSubscriptionBuilder { - - private Integer termsToCharge; - - private ScheduleType scheduleType; - - private FixedIntervalScheduleParams fixedIntervalSchedule; - - private List specificDatesSchedule; - - private EditAdvanceInvoiceScheduleForSubscriptionBuilder() {} - - public EditAdvanceInvoiceScheduleForSubscriptionBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public EditAdvanceInvoiceScheduleForSubscriptionBuilder scheduleType(ScheduleType value) { - this.scheduleType = value; - return this; - } - - public EditAdvanceInvoiceScheduleForSubscriptionBuilder fixedIntervalSchedule( - FixedIntervalScheduleParams value) { - this.fixedIntervalSchedule = value; - return this; - } - - public EditAdvanceInvoiceScheduleForSubscriptionBuilder specificDatesSchedule( - List value) { - this.specificDatesSchedule = value; - return this; - } - - public EditAdvanceInvoiceScheduleForSubscriptionParams build() { - return new EditAdvanceInvoiceScheduleForSubscriptionParams(this); - } - } - - public enum ScheduleType { - SPECIFIC_DATES("specific_dates"), - - FIXED_INTERVALS("fixed_intervals"), - - /** An enum member indicating that ScheduleType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ScheduleType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ScheduleType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ScheduleType enumValue : ScheduleType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class FixedIntervalScheduleParams { - - private final Integer numberOfOccurrences; - - private final Integer daysBeforeRenewal; - - private final EndScheduleOn endScheduleOn; - - private final Timestamp endDate; - - private FixedIntervalScheduleParams(FixedIntervalScheduleBuilder builder) { - - this.numberOfOccurrences = builder.numberOfOccurrences; - - this.daysBeforeRenewal = builder.daysBeforeRenewal; - - this.endScheduleOn = builder.endScheduleOn; - - this.endDate = builder.endDate; - } - - public Integer getNumberOfOccurrences() { - return numberOfOccurrences; - } - - public Integer getDaysBeforeRenewal() { - return daysBeforeRenewal; - } - - public EndScheduleOn getEndScheduleOn() { - return endScheduleOn; - } - - public Timestamp getEndDate() { - return endDate; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.numberOfOccurrences != null) { - - formData.put("number_of_occurrences", this.numberOfOccurrences); - } - - if (this.daysBeforeRenewal != null) { - - formData.put("days_before_renewal", this.daysBeforeRenewal); - } - - if (this.endScheduleOn != null) { - - formData.put("end_schedule_on", this.endScheduleOn); - } - - if (this.endDate != null) { - - formData.put("end_date", this.endDate); - } - - return formData; - } - - /** Create a new builder for FixedIntervalScheduleParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static FixedIntervalScheduleBuilder builder() { - return new FixedIntervalScheduleBuilder(); - } - - public static final class FixedIntervalScheduleBuilder { - - private Integer numberOfOccurrences; - - private Integer daysBeforeRenewal; - - private EndScheduleOn endScheduleOn; - - private Timestamp endDate; - - private FixedIntervalScheduleBuilder() {} - - public FixedIntervalScheduleBuilder numberOfOccurrences(Integer value) { - this.numberOfOccurrences = value; - return this; - } - - public FixedIntervalScheduleBuilder daysBeforeRenewal(Integer value) { - this.daysBeforeRenewal = value; - return this; - } - - public FixedIntervalScheduleBuilder endScheduleOn(EndScheduleOn value) { - this.endScheduleOn = value; - return this; - } - - public FixedIntervalScheduleBuilder endDate(Timestamp value) { - this.endDate = value; - return this; - } - - public FixedIntervalScheduleParams build() { - return new FixedIntervalScheduleParams(this); - } - } - - public enum EndScheduleOn { - AFTER_NUMBER_OF_INTERVALS("after_number_of_intervals"), - - SPECIFIC_DATE("specific_date"), - - SUBSCRIPTION_END("subscription_end"), - - /** An enum member indicating that EndScheduleOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - EndScheduleOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static EndScheduleOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (EndScheduleOn enumValue : EndScheduleOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class SpecificDatesScheduleParams { - - private final String id; - - private final Integer termsToCharge; - - private final Timestamp date; - - private SpecificDatesScheduleParams(SpecificDatesScheduleBuilder builder) { - - this.id = builder.id; - - this.termsToCharge = builder.termsToCharge; - - this.date = builder.date; - } - - public String getId() { - return id; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public Timestamp getDate() { - return date; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.date != null) { - - formData.put("date", this.date); - } - - return formData; - } - - /** Create a new builder for SpecificDatesScheduleParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SpecificDatesScheduleBuilder builder() { - return new SpecificDatesScheduleBuilder(); - } - - public static final class SpecificDatesScheduleBuilder { - - private String id; - - private Integer termsToCharge; - - private Timestamp date; - - private SpecificDatesScheduleBuilder() {} - - public SpecificDatesScheduleBuilder id(String value) { - this.id = value; - return this; - } - - public SpecificDatesScheduleBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public SpecificDatesScheduleBuilder date(Timestamp value) { - this.date = value; - return this; - } - - public SpecificDatesScheduleParams build() { - return new SpecificDatesScheduleParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/ImportContractTermForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/ImportContractTermForSubscriptionParams.java deleted file mode 100644 index 47404a59..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/ImportContractTermForSubscriptionParams.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class ImportContractTermForSubscriptionParams { - - private final Integer contractTermBillingCycleOnRenewal; - - private final ContractTermParams contractTerm; - - private ImportContractTermForSubscriptionParams( - ImportContractTermForSubscriptionBuilder builder) { - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - - this.contractTerm = builder.contractTerm; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for ImportContractTermForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ImportContractTermForSubscriptionBuilder builder() { - return new ImportContractTermForSubscriptionBuilder(); - } - - public static final class ImportContractTermForSubscriptionBuilder { - - private Integer contractTermBillingCycleOnRenewal; - - private ContractTermParams contractTerm; - - private ImportContractTermForSubscriptionBuilder() {} - - public ImportContractTermForSubscriptionBuilder contractTermBillingCycleOnRenewal( - Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public ImportContractTermForSubscriptionBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public ImportContractTermForSubscriptionParams build() { - return new ImportContractTermForSubscriptionParams(this); - } - } - - public static final class ContractTermParams { - - private final String id; - - private final Timestamp createdAt; - - private final Timestamp contractStart; - - private final Timestamp contractEnd; - - private final Status status; - - private final Long totalAmountRaised; - - private final Long totalAmountRaisedBeforeTax; - - private final Long totalContractValue; - - private final Long totalContractValueBeforeTax; - - private final Integer billingCycle; - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.id = builder.id; - - this.createdAt = builder.createdAt; - - this.contractStart = builder.contractStart; - - this.contractEnd = builder.contractEnd; - - this.status = builder.status; - - this.totalAmountRaised = builder.totalAmountRaised; - - this.totalAmountRaisedBeforeTax = builder.totalAmountRaisedBeforeTax; - - this.totalContractValue = builder.totalContractValue; - - this.totalContractValueBeforeTax = builder.totalContractValueBeforeTax; - - this.billingCycle = builder.billingCycle; - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public String getId() { - return id; - } - - public Timestamp getCreatedAt() { - return createdAt; - } - - public Timestamp getContractStart() { - return contractStart; - } - - public Timestamp getContractEnd() { - return contractEnd; - } - - public Status getStatus() { - return status; - } - - public Long getTotalAmountRaised() { - return totalAmountRaised; - } - - public Long getTotalAmountRaisedBeforeTax() { - return totalAmountRaisedBeforeTax; - } - - public Long getTotalContractValue() { - return totalContractValue; - } - - public Long getTotalContractValueBeforeTax() { - return totalContractValueBeforeTax; - } - - public Integer getBillingCycle() { - return billingCycle; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.createdAt != null) { - - formData.put("created_at", this.createdAt); - } - - if (this.contractStart != null) { - - formData.put("contract_start", this.contractStart); - } - - if (this.contractEnd != null) { - - formData.put("contract_end", this.contractEnd); - } - - if (this.status != null) { - - formData.put("status", this.status); - } - - if (this.totalAmountRaised != null) { - - formData.put("total_amount_raised", this.totalAmountRaised); - } - - if (this.totalAmountRaisedBeforeTax != null) { - - formData.put("total_amount_raised_before_tax", this.totalAmountRaisedBeforeTax); - } - - if (this.totalContractValue != null) { - - formData.put("total_contract_value", this.totalContractValue); - } - - if (this.totalContractValueBeforeTax != null) { - - formData.put("total_contract_value_before_tax", this.totalContractValueBeforeTax); - } - - if (this.billingCycle != null) { - - formData.put("billing_cycle", this.billingCycle); - } - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private String id; - - private Timestamp createdAt; - - private Timestamp contractStart; - - private Timestamp contractEnd; - - private Status status; - - private Long totalAmountRaised; - - private Long totalAmountRaisedBeforeTax; - - private Long totalContractValue; - - private Long totalContractValueBeforeTax; - - private Integer billingCycle; - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder id(String value) { - this.id = value; - return this; - } - - public ContractTermBuilder createdAt(Timestamp value) { - this.createdAt = value; - return this; - } - - public ContractTermBuilder contractStart(Timestamp value) { - this.contractStart = value; - return this; - } - - public ContractTermBuilder contractEnd(Timestamp value) { - this.contractEnd = value; - return this; - } - - public ContractTermBuilder status(Status value) { - this.status = value; - return this; - } - - public ContractTermBuilder totalAmountRaised(Long value) { - this.totalAmountRaised = value; - return this; - } - - public ContractTermBuilder totalAmountRaisedBeforeTax(Long value) { - this.totalAmountRaisedBeforeTax = value; - return this; - } - - public ContractTermBuilder totalContractValue(Long value) { - this.totalContractValue = value; - return this; - } - - public ContractTermBuilder totalContractValueBeforeTax(Long value) { - this.totalContractValueBeforeTax = value; - return this; - } - - public ContractTermBuilder billingCycle(Integer value) { - this.billingCycle = value; - return this; - } - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum Status { - ACTIVE("active"), - - COMPLETED("completed"), - - CANCELLED("cancelled"), - - TERMINATED("terminated"), - - /** An enum member indicating that Status was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Status(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Status fromString(String value) { - if (value == null) return _UNKNOWN; - for (Status enumValue : Status.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - RENEW_ONCE("renew_once"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/ImportSubscriptionForCustomerParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/ImportSubscriptionForCustomerParams.java deleted file mode 100644 index 52f005c2..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/ImportSubscriptionForCustomerParams.java +++ /dev/null @@ -1,2112 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class ImportSubscriptionForCustomerParams { - - private final String id; - - private final String planId; - - private final Integer planQuantity; - - private final String planQuantityInDecimal; - - private final Long planUnitPrice; - - private final String planUnitPriceInDecimal; - - private final Long setupFee; - - private final Timestamp trialEnd; - - private final Integer billingCycles; - - private final Timestamp startDate; - - private final AutoCollection autoCollection; - - private final String poNumber; - - private final List couponIds; - - private final String paymentSourceId; - - private final Status status; - - private final Timestamp currentTermEnd; - - private final Timestamp currentTermStart; - - private final Timestamp trialStart; - - private final Timestamp cancelledAt; - - private final Timestamp startedAt; - - private final Timestamp activatedAt; - - private final Timestamp pauseDate; - - private final Timestamp resumeDate; - - private final Integer contractTermBillingCycleOnRenewal; - - private final Boolean createCurrentTermInvoice; - - private final String invoiceNotes; - - private final java.util.Map metaData; - - private final ContractTermParams contractTerm; - - private final TransactionParams transaction; - - private final ShippingAddressParams shippingAddress; - - private final List addons; - - private final List eventBasedAddons; - - private final List chargedEventBasedAddons; - - private final List coupons; - - private final Map customFields; - - private ImportSubscriptionForCustomerParams(ImportSubscriptionForCustomerBuilder builder) { - - this.id = builder.id; - - this.planId = builder.planId; - - this.planQuantity = builder.planQuantity; - - this.planQuantityInDecimal = builder.planQuantityInDecimal; - - this.planUnitPrice = builder.planUnitPrice; - - this.planUnitPriceInDecimal = builder.planUnitPriceInDecimal; - - this.setupFee = builder.setupFee; - - this.trialEnd = builder.trialEnd; - - this.billingCycles = builder.billingCycles; - - this.startDate = builder.startDate; - - this.autoCollection = builder.autoCollection; - - this.poNumber = builder.poNumber; - - this.couponIds = builder.couponIds; - - this.paymentSourceId = builder.paymentSourceId; - - this.status = builder.status; - - this.currentTermEnd = builder.currentTermEnd; - - this.currentTermStart = builder.currentTermStart; - - this.trialStart = builder.trialStart; - - this.cancelledAt = builder.cancelledAt; - - this.startedAt = builder.startedAt; - - this.activatedAt = builder.activatedAt; - - this.pauseDate = builder.pauseDate; - - this.resumeDate = builder.resumeDate; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - - this.createCurrentTermInvoice = builder.createCurrentTermInvoice; - - this.invoiceNotes = builder.invoiceNotes; - - this.metaData = builder.metaData; - - this.contractTerm = builder.contractTerm; - - this.transaction = builder.transaction; - - this.shippingAddress = builder.shippingAddress; - - this.addons = builder.addons; - - this.eventBasedAddons = builder.eventBasedAddons; - - this.chargedEventBasedAddons = builder.chargedEventBasedAddons; - - this.coupons = builder.coupons; - - this.customFields = - builder.customFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); - } - - public String getId() { - return id; - } - - public String getPlanId() { - return planId; - } - - public Integer getPlanQuantity() { - return planQuantity; - } - - public String getPlanQuantityInDecimal() { - return planQuantityInDecimal; - } - - public Long getPlanUnitPrice() { - return planUnitPrice; - } - - public String getPlanUnitPriceInDecimal() { - return planUnitPriceInDecimal; - } - - public Long getSetupFee() { - return setupFee; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getStartDate() { - return startDate; - } - - public AutoCollection getAutoCollection() { - return autoCollection; - } - - public String getPoNumber() { - return poNumber; - } - - public List getCouponIds() { - return couponIds; - } - - public String getPaymentSourceId() { - return paymentSourceId; - } - - public Status getStatus() { - return status; - } - - public Timestamp getCurrentTermEnd() { - return currentTermEnd; - } - - public Timestamp getCurrentTermStart() { - return currentTermStart; - } - - public Timestamp getTrialStart() { - return trialStart; - } - - public Timestamp getCancelledAt() { - return cancelledAt; - } - - public Timestamp getStartedAt() { - return startedAt; - } - - public Timestamp getActivatedAt() { - return activatedAt; - } - - public Timestamp getPauseDate() { - return pauseDate; - } - - public Timestamp getResumeDate() { - return resumeDate; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - public Boolean getCreateCurrentTermInvoice() { - return createCurrentTermInvoice; - } - - public String getInvoiceNotes() { - return invoiceNotes; - } - - public java.util.Map getMetaData() { - return metaData; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public TransactionParams getTransaction() { - return transaction; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public List getAddons() { - return addons; - } - - public List getEventBasedAddons() { - return eventBasedAddons; - } - - public List getChargedEventBasedAddons() { - return chargedEventBasedAddons; - } - - public List getCoupons() { - return coupons; - } - - public Map customFields() { - return customFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.planId != null) { - - formData.put("plan_id", this.planId); - } - - if (this.planQuantity != null) { - - formData.put("plan_quantity", this.planQuantity); - } - - if (this.planQuantityInDecimal != null) { - - formData.put("plan_quantity_in_decimal", this.planQuantityInDecimal); - } - - if (this.planUnitPrice != null) { - - formData.put("plan_unit_price", this.planUnitPrice); - } - - if (this.planUnitPriceInDecimal != null) { - - formData.put("plan_unit_price_in_decimal", this.planUnitPriceInDecimal); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.autoCollection != null) { - - formData.put("auto_collection", this.autoCollection); - } - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.paymentSourceId != null) { - - formData.put("payment_source_id", this.paymentSourceId); - } - - if (this.status != null) { - - formData.put("status", this.status); - } - - if (this.currentTermEnd != null) { - - formData.put("current_term_end", this.currentTermEnd); - } - - if (this.currentTermStart != null) { - - formData.put("current_term_start", this.currentTermStart); - } - - if (this.trialStart != null) { - - formData.put("trial_start", this.trialStart); - } - - if (this.cancelledAt != null) { - - formData.put("cancelled_at", this.cancelledAt); - } - - if (this.startedAt != null) { - - formData.put("started_at", this.startedAt); - } - - if (this.activatedAt != null) { - - formData.put("activated_at", this.activatedAt); - } - - if (this.pauseDate != null) { - - formData.put("pause_date", this.pauseDate); - } - - if (this.resumeDate != null) { - - formData.put("resume_date", this.resumeDate); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - if (this.createCurrentTermInvoice != null) { - - formData.put("create_current_term_invoice", this.createCurrentTermInvoice); - } - - if (this.invoiceNotes != null) { - - formData.put("invoice_notes", this.invoiceNotes); - } - - if (this.metaData != null) { - - formData.put("meta_data", JsonUtil.toJson(this.metaData)); - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.transaction != null) { - - // Single object - Map nestedData = this.transaction.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "transaction[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.addons != null) { - - // List of objects - for (int i = 0; i < this.addons.size(); i++) { - AddonsParams item = this.addons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.eventBasedAddons != null) { - - // List of objects - for (int i = 0; i < this.eventBasedAddons.size(); i++) { - EventBasedAddonsParams item = this.eventBasedAddons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.chargedEventBasedAddons != null) { - - // List of objects - for (int i = 0; i < this.chargedEventBasedAddons.size(); i++) { - ChargedEventBasedAddonsParams item = this.chargedEventBasedAddons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "charged_event_based_addons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.coupons != null) { - - // List of objects - for (int i = 0; i < this.coupons.size(); i++) { - CouponsParams item = this.coupons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(customFields); - - return formData; - } - - /** Create a new builder for ImportSubscriptionForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ImportSubscriptionForCustomerBuilder builder() { - return new ImportSubscriptionForCustomerBuilder(); - } - - public static final class ImportSubscriptionForCustomerBuilder { - - private String id; - - private String planId; - - private Integer planQuantity; - - private String planQuantityInDecimal; - - private Long planUnitPrice; - - private String planUnitPriceInDecimal; - - private Long setupFee; - - private Timestamp trialEnd; - - private Integer billingCycles; - - private Timestamp startDate; - - private AutoCollection autoCollection; - - private String poNumber; - - private List couponIds; - - private String paymentSourceId; - - private Status status; - - private Timestamp currentTermEnd; - - private Timestamp currentTermStart; - - private Timestamp trialStart; - - private Timestamp cancelledAt; - - private Timestamp startedAt; - - private Timestamp activatedAt; - - private Timestamp pauseDate; - - private Timestamp resumeDate; - - private Integer contractTermBillingCycleOnRenewal; - - private Boolean createCurrentTermInvoice; - - private String invoiceNotes; - - private java.util.Map metaData; - - private ContractTermParams contractTerm; - - private TransactionParams transaction; - - private ShippingAddressParams shippingAddress; - - private List addons; - - private List eventBasedAddons; - - private List chargedEventBasedAddons; - - private List coupons; - - private Map customFields = new LinkedHashMap<>(); - - private ImportSubscriptionForCustomerBuilder() {} - - public ImportSubscriptionForCustomerBuilder id(String value) { - this.id = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder planId(String value) { - this.planId = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder planQuantity(Integer value) { - this.planQuantity = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder planQuantityInDecimal(String value) { - this.planQuantityInDecimal = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder planUnitPrice(Long value) { - this.planUnitPrice = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder planUnitPriceInDecimal(String value) { - this.planUnitPriceInDecimal = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder autoCollection(AutoCollection value) { - this.autoCollection = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder paymentSourceId(String value) { - this.paymentSourceId = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder status(Status value) { - this.status = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder currentTermEnd(Timestamp value) { - this.currentTermEnd = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder currentTermStart(Timestamp value) { - this.currentTermStart = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder trialStart(Timestamp value) { - this.trialStart = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder cancelledAt(Timestamp value) { - this.cancelledAt = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder startedAt(Timestamp value) { - this.startedAt = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder activatedAt(Timestamp value) { - this.activatedAt = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder pauseDate(Timestamp value) { - this.pauseDate = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder resumeDate(Timestamp value) { - this.resumeDate = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder createCurrentTermInvoice(Boolean value) { - this.createCurrentTermInvoice = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder invoiceNotes(String value) { - this.invoiceNotes = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder metaData(java.util.Map value) { - this.metaData = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder transaction(TransactionParams value) { - this.transaction = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder shippingAddress(ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder addons(List value) { - this.addons = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder eventBasedAddons( - List value) { - this.eventBasedAddons = value; - return this; - } - - public ImportSubscriptionForCustomerBuilder chargedEventBasedAddons( - List value) { - this.chargedEventBasedAddons = value; - return this; - } - - @Deprecated - public ImportSubscriptionForCustomerBuilder coupons(List value) { - this.coupons = value; - return this; - } - - /** - * Add a custom field to the request. Custom fields must start with "cf_". - * - * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") - * @param value the value of the custom field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cf_" - */ - public ImportSubscriptionForCustomerBuilder customField(String fieldName, String value) { - if (fieldName == null || !fieldName.startsWith("cf_")) { - throw new IllegalArgumentException("Custom field name must start with 'cf_'"); - } - this.customFields.put(fieldName, value); - return this; - } - - /** - * Add multiple custom fields to the request. All field names must start with "cf_". - * - * @param customFields map of custom field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cf_" - */ - public ImportSubscriptionForCustomerBuilder customFields(Map customFields) { - if (customFields != null) { - for (Map.Entry entry : customFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { - throw new IllegalArgumentException( - "Custom field name must start with 'cf_': " + entry.getKey()); - } - this.customFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public ImportSubscriptionForCustomerParams build() { - return new ImportSubscriptionForCustomerParams(this); - } - } - - public enum AutoCollection { - ON("on"), - - OFF("off"), - - /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AutoCollection(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AutoCollection fromString(String value) { - if (value == null) return _UNKNOWN; - for (AutoCollection enumValue : AutoCollection.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum Status { - FUTURE("future"), - - IN_TRIAL("in_trial"), - - ACTIVE("active"), - - NON_RENEWING("non_renewing"), - - PAUSED("paused"), - - CANCELLED("cancelled"), - - TRANSFERRED("transferred"), - - /** An enum member indicating that Status was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Status(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Status fromString(String value) { - if (value == null) return _UNKNOWN; - for (Status enumValue : Status.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class ContractTermParams { - - private final String id; - - private final Timestamp createdAt; - - private final Timestamp contractStart; - - private final Integer billingCycle; - - private final Long totalAmountRaised; - - private final Long totalAmountRaisedBeforeTax; - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.id = builder.id; - - this.createdAt = builder.createdAt; - - this.contractStart = builder.contractStart; - - this.billingCycle = builder.billingCycle; - - this.totalAmountRaised = builder.totalAmountRaised; - - this.totalAmountRaisedBeforeTax = builder.totalAmountRaisedBeforeTax; - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public String getId() { - return id; - } - - public Timestamp getCreatedAt() { - return createdAt; - } - - public Timestamp getContractStart() { - return contractStart; - } - - public Integer getBillingCycle() { - return billingCycle; - } - - public Long getTotalAmountRaised() { - return totalAmountRaised; - } - - public Long getTotalAmountRaisedBeforeTax() { - return totalAmountRaisedBeforeTax; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.createdAt != null) { - - formData.put("created_at", this.createdAt); - } - - if (this.contractStart != null) { - - formData.put("contract_start", this.contractStart); - } - - if (this.billingCycle != null) { - - formData.put("billing_cycle", this.billingCycle); - } - - if (this.totalAmountRaised != null) { - - formData.put("total_amount_raised", this.totalAmountRaised); - } - - if (this.totalAmountRaisedBeforeTax != null) { - - formData.put("total_amount_raised_before_tax", this.totalAmountRaisedBeforeTax); - } - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private String id; - - private Timestamp createdAt; - - private Timestamp contractStart; - - private Integer billingCycle; - - private Long totalAmountRaised; - - private Long totalAmountRaisedBeforeTax; - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder id(String value) { - this.id = value; - return this; - } - - public ContractTermBuilder createdAt(Timestamp value) { - this.createdAt = value; - return this; - } - - public ContractTermBuilder contractStart(Timestamp value) { - this.contractStart = value; - return this; - } - - public ContractTermBuilder billingCycle(Integer value) { - this.billingCycle = value; - return this; - } - - public ContractTermBuilder totalAmountRaised(Long value) { - this.totalAmountRaised = value; - return this; - } - - public ContractTermBuilder totalAmountRaisedBeforeTax(Long value) { - this.totalAmountRaisedBeforeTax = value; - return this; - } - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - RENEW_ONCE("renew_once"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class TransactionParams { - - private final Long amount; - - private final PaymentMethod paymentMethod; - - private final String referenceNumber; - - private final Timestamp date; - - private TransactionParams(TransactionBuilder builder) { - - this.amount = builder.amount; - - this.paymentMethod = builder.paymentMethod; - - this.referenceNumber = builder.referenceNumber; - - this.date = builder.date; - } - - public Long getAmount() { - return amount; - } - - public PaymentMethod getPaymentMethod() { - return paymentMethod; - } - - public String getReferenceNumber() { - return referenceNumber; - } - - public Timestamp getDate() { - return date; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.paymentMethod != null) { - - formData.put("payment_method", this.paymentMethod); - } - - if (this.referenceNumber != null) { - - formData.put("reference_number", this.referenceNumber); - } - - if (this.date != null) { - - formData.put("date", this.date); - } - - return formData; - } - - /** Create a new builder for TransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TransactionBuilder builder() { - return new TransactionBuilder(); - } - - public static final class TransactionBuilder { - - private Long amount; - - private PaymentMethod paymentMethod; - - private String referenceNumber; - - private Timestamp date; - - private TransactionBuilder() {} - - public TransactionBuilder amount(Long value) { - this.amount = value; - return this; - } - - public TransactionBuilder paymentMethod(PaymentMethod value) { - this.paymentMethod = value; - return this; - } - - public TransactionBuilder referenceNumber(String value) { - this.referenceNumber = value; - return this; - } - - public TransactionBuilder date(Timestamp value) { - this.date = value; - return this; - } - - public TransactionParams build() { - return new TransactionParams(this); - } - } - - public enum PaymentMethod { - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - OTHER("other"), - - APP_STORE("app_store"), - - PLAY_STORE("play_store"), - - CUSTOM("custom"), - - /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethod enumValue : PaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class AddonsParams { - - private final String id; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private AddonsParams(AddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - return formData; - } - - /** Create a new builder for AddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddonsBuilder builder() { - return new AddonsBuilder(); - } - - public static final class AddonsBuilder { - - private String id; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private AddonsBuilder() {} - - public AddonsBuilder id(String value) { - this.id = value; - return this; - } - - public AddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public AddonsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public AddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public AddonsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public AddonsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public AddonsParams build() { - return new AddonsParams(this); - } - } - } - - public static final class EventBasedAddonsParams { - - private final String id; - - private final Integer quantity; - - private final Long unitPrice; - - private final String quantityInDecimal; - - private final String unitPriceInDecimal; - - private final Integer servicePeriodInDays; - - private final OnEvent onEvent; - - private final Boolean chargeOnce; - - private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { - - this.id = builder.id; - - this.quantity = builder.quantity; - - this.unitPrice = builder.unitPrice; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.servicePeriodInDays = builder.servicePeriodInDays; - - this.onEvent = builder.onEvent; - - this.chargeOnce = builder.chargeOnce; - } - - public String getId() { - return id; - } - - public Integer getQuantity() { - return quantity; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getServicePeriodInDays() { - return servicePeriodInDays; - } - - public OnEvent getOnEvent() { - return onEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.servicePeriodInDays != null) { - - formData.put("service_period_in_days", this.servicePeriodInDays); - } - - if (this.onEvent != null) { - - formData.put("on_event", this.onEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - return formData; - } - - /** Create a new builder for EventBasedAddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EventBasedAddonsBuilder builder() { - return new EventBasedAddonsBuilder(); - } - - public static final class EventBasedAddonsBuilder { - - private String id; - - private Integer quantity; - - private Long unitPrice; - - private String quantityInDecimal; - - private String unitPriceInDecimal; - - private Integer servicePeriodInDays; - - private OnEvent onEvent; - - private Boolean chargeOnce; - - private EventBasedAddonsBuilder() {} - - public EventBasedAddonsBuilder id(String value) { - this.id = value; - return this; - } - - public EventBasedAddonsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public EventBasedAddonsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public EventBasedAddonsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public EventBasedAddonsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { - this.servicePeriodInDays = value; - return this; - } - - public EventBasedAddonsBuilder onEvent(OnEvent value) { - this.onEvent = value; - return this; - } - - public EventBasedAddonsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public EventBasedAddonsParams build() { - return new EventBasedAddonsParams(this); - } - } - - public enum OnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that OnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - OnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (OnEvent enumValue : OnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ChargedEventBasedAddonsParams { - - private final String id; - - private final Timestamp lastChargedAt; - - private ChargedEventBasedAddonsParams(ChargedEventBasedAddonsBuilder builder) { - - this.id = builder.id; - - this.lastChargedAt = builder.lastChargedAt; - } - - public String getId() { - return id; - } - - public Timestamp getLastChargedAt() { - return lastChargedAt; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.lastChargedAt != null) { - - formData.put("last_charged_at", this.lastChargedAt); - } - - return formData; - } - - /** Create a new builder for ChargedEventBasedAddonsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ChargedEventBasedAddonsBuilder builder() { - return new ChargedEventBasedAddonsBuilder(); - } - - public static final class ChargedEventBasedAddonsBuilder { - - private String id; - - private Timestamp lastChargedAt; - - private ChargedEventBasedAddonsBuilder() {} - - public ChargedEventBasedAddonsBuilder id(String value) { - this.id = value; - return this; - } - - public ChargedEventBasedAddonsBuilder lastChargedAt(Timestamp value) { - this.lastChargedAt = value; - return this; - } - - public ChargedEventBasedAddonsParams build() { - return new ChargedEventBasedAddonsParams(this); - } - } - } - - public static final class CouponsParams { - - private final String couponId; - - private final Timestamp applyTill; - - private CouponsParams(CouponsBuilder builder) { - - this.couponId = builder.couponId; - - this.applyTill = builder.applyTill; - } - - public String getCouponId() { - return couponId; - } - - public Timestamp getApplyTill() { - return applyTill; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.couponId != null) { - - formData.put("coupon_id", this.couponId); - } - - if (this.applyTill != null) { - - formData.put("apply_till", this.applyTill); - } - - return formData; - } - - /** Create a new builder for CouponsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CouponsBuilder builder() { - return new CouponsBuilder(); - } - - public static final class CouponsBuilder { - - private String couponId; - - private Timestamp applyTill; - - private CouponsBuilder() {} - - public CouponsBuilder couponId(String value) { - this.couponId = value; - return this; - } - - public CouponsBuilder applyTill(Timestamp value) { - this.applyTill = value; - return this; - } - - public CouponsParams build() { - return new CouponsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/ImportUnbilledChargesForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/ImportUnbilledChargesForSubscriptionParams.java deleted file mode 100644 index 9c825e8a..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/ImportUnbilledChargesForSubscriptionParams.java +++ /dev/null @@ -1,868 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class ImportUnbilledChargesForSubscriptionParams { - - private final List unbilledCharges; - - private final List discounts; - - private final List tiers; - - private ImportUnbilledChargesForSubscriptionParams( - ImportUnbilledChargesForSubscriptionBuilder builder) { - - this.unbilledCharges = builder.unbilledCharges; - - this.discounts = builder.discounts; - - this.tiers = builder.tiers; - } - - public List getUnbilledCharges() { - return unbilledCharges; - } - - public List getDiscounts() { - return discounts; - } - - public List getTiers() { - return tiers; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.unbilledCharges != null) { - - // List of objects - for (int i = 0; i < this.unbilledCharges.size(); i++) { - UnbilledChargesParams item = this.unbilledCharges.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "unbilled_charges[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discounts != null) { - - // List of objects - for (int i = 0; i < this.discounts.size(); i++) { - DiscountsParams item = this.discounts.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.tiers != null) { - - // List of objects - for (int i = 0; i < this.tiers.size(); i++) { - TiersParams item = this.tiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for ImportUnbilledChargesForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ImportUnbilledChargesForSubscriptionBuilder builder() { - return new ImportUnbilledChargesForSubscriptionBuilder(); - } - - public static final class ImportUnbilledChargesForSubscriptionBuilder { - - private List unbilledCharges; - - private List discounts; - - private List tiers; - - private ImportUnbilledChargesForSubscriptionBuilder() {} - - public ImportUnbilledChargesForSubscriptionBuilder unbilledCharges( - List value) { - this.unbilledCharges = value; - return this; - } - - public ImportUnbilledChargesForSubscriptionBuilder discounts(List value) { - this.discounts = value; - return this; - } - - public ImportUnbilledChargesForSubscriptionBuilder tiers(List value) { - this.tiers = value; - return this; - } - - public ImportUnbilledChargesForSubscriptionParams build() { - return new ImportUnbilledChargesForSubscriptionParams(this); - } - } - - public static final class UnbilledChargesParams { - - private final String id; - - private final Timestamp dateFrom; - - private final Timestamp dateTo; - - private final EntityType entityType; - - private final String entityId; - - private final String description; - - private final Long unitAmount; - - private final Integer quantity; - - private final Long amount; - - private final String unitAmountInDecimal; - - private final String quantityInDecimal; - - private final String amountInDecimal; - - private final Long discountAmount; - - private final Boolean useForProration; - - private final Boolean isAdvanceCharge; - - private UnbilledChargesParams(UnbilledChargesBuilder builder) { - - this.id = builder.id; - - this.dateFrom = builder.dateFrom; - - this.dateTo = builder.dateTo; - - this.entityType = builder.entityType; - - this.entityId = builder.entityId; - - this.description = builder.description; - - this.unitAmount = builder.unitAmount; - - this.quantity = builder.quantity; - - this.amount = builder.amount; - - this.unitAmountInDecimal = builder.unitAmountInDecimal; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.amountInDecimal = builder.amountInDecimal; - - this.discountAmount = builder.discountAmount; - - this.useForProration = builder.useForProration; - - this.isAdvanceCharge = builder.isAdvanceCharge; - } - - public String getId() { - return id; - } - - public Timestamp getDateFrom() { - return dateFrom; - } - - public Timestamp getDateTo() { - return dateTo; - } - - public EntityType getEntityType() { - return entityType; - } - - public String getEntityId() { - return entityId; - } - - public String getDescription() { - return description; - } - - public Long getUnitAmount() { - return unitAmount; - } - - public Integer getQuantity() { - return quantity; - } - - public Long getAmount() { - return amount; - } - - public String getUnitAmountInDecimal() { - return unitAmountInDecimal; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public String getAmountInDecimal() { - return amountInDecimal; - } - - public Long getDiscountAmount() { - return discountAmount; - } - - public Boolean getUseForProration() { - return useForProration; - } - - public Boolean getIsAdvanceCharge() { - return isAdvanceCharge; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.dateFrom != null) { - - formData.put("date_from", this.dateFrom); - } - - if (this.dateTo != null) { - - formData.put("date_to", this.dateTo); - } - - if (this.entityType != null) { - - formData.put("entity_type", this.entityType); - } - - if (this.entityId != null) { - - formData.put("entity_id", this.entityId); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.unitAmount != null) { - - formData.put("unit_amount", this.unitAmount); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.unitAmountInDecimal != null) { - - formData.put("unit_amount_in_decimal", this.unitAmountInDecimal); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.amountInDecimal != null) { - - formData.put("amount_in_decimal", this.amountInDecimal); - } - - if (this.discountAmount != null) { - - formData.put("discount_amount", this.discountAmount); - } - - if (this.useForProration != null) { - - formData.put("use_for_proration", this.useForProration); - } - - if (this.isAdvanceCharge != null) { - - formData.put("is_advance_charge", this.isAdvanceCharge); - } - - return formData; - } - - /** Create a new builder for UnbilledChargesParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UnbilledChargesBuilder builder() { - return new UnbilledChargesBuilder(); - } - - public static final class UnbilledChargesBuilder { - - private String id; - - private Timestamp dateFrom; - - private Timestamp dateTo; - - private EntityType entityType; - - private String entityId; - - private String description; - - private Long unitAmount; - - private Integer quantity; - - private Long amount; - - private String unitAmountInDecimal; - - private String quantityInDecimal; - - private String amountInDecimal; - - private Long discountAmount; - - private Boolean useForProration; - - private Boolean isAdvanceCharge; - - private UnbilledChargesBuilder() {} - - public UnbilledChargesBuilder id(String value) { - this.id = value; - return this; - } - - public UnbilledChargesBuilder dateFrom(Timestamp value) { - this.dateFrom = value; - return this; - } - - public UnbilledChargesBuilder dateTo(Timestamp value) { - this.dateTo = value; - return this; - } - - public UnbilledChargesBuilder entityType(EntityType value) { - this.entityType = value; - return this; - } - - public UnbilledChargesBuilder entityId(String value) { - this.entityId = value; - return this; - } - - public UnbilledChargesBuilder description(String value) { - this.description = value; - return this; - } - - public UnbilledChargesBuilder unitAmount(Long value) { - this.unitAmount = value; - return this; - } - - public UnbilledChargesBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public UnbilledChargesBuilder amount(Long value) { - this.amount = value; - return this; - } - - public UnbilledChargesBuilder unitAmountInDecimal(String value) { - this.unitAmountInDecimal = value; - return this; - } - - public UnbilledChargesBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public UnbilledChargesBuilder amountInDecimal(String value) { - this.amountInDecimal = value; - return this; - } - - public UnbilledChargesBuilder discountAmount(Long value) { - this.discountAmount = value; - return this; - } - - public UnbilledChargesBuilder useForProration(Boolean value) { - this.useForProration = value; - return this; - } - - public UnbilledChargesBuilder isAdvanceCharge(Boolean value) { - this.isAdvanceCharge = value; - return this; - } - - public UnbilledChargesParams build() { - return new UnbilledChargesParams(this); - } - } - - public enum EntityType { - ADHOC("adhoc"), - - PLAN_ITEM_PRICE("plan_item_price"), - - ADDON_ITEM_PRICE("addon_item_price"), - - CHARGE_ITEM_PRICE("charge_item_price"), - - PLAN_SETUP("plan_setup"), - - PLAN("plan"), - - ADDON("addon"), - - /** An enum member indicating that EntityType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - EntityType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static EntityType fromString(String value) { - if (value == null) return _UNKNOWN; - for (EntityType enumValue : EntityType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class DiscountsParams { - - private final String unbilledChargeId; - - private final EntityType entityType; - - private final String entityId; - - private final String description; - - private final Long amount; - - private DiscountsParams(DiscountsBuilder builder) { - - this.unbilledChargeId = builder.unbilledChargeId; - - this.entityType = builder.entityType; - - this.entityId = builder.entityId; - - this.description = builder.description; - - this.amount = builder.amount; - } - - public String getUnbilledChargeId() { - return unbilledChargeId; - } - - public EntityType getEntityType() { - return entityType; - } - - public String getEntityId() { - return entityId; - } - - public String getDescription() { - return description; - } - - public Long getAmount() { - return amount; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.unbilledChargeId != null) { - - formData.put("unbilled_charge_id", this.unbilledChargeId); - } - - if (this.entityType != null) { - - formData.put("entity_type", this.entityType); - } - - if (this.entityId != null) { - - formData.put("entity_id", this.entityId); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - return formData; - } - - /** Create a new builder for DiscountsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsBuilder builder() { - return new DiscountsBuilder(); - } - - public static final class DiscountsBuilder { - - private String unbilledChargeId; - - private EntityType entityType; - - private String entityId; - - private String description; - - private Long amount; - - private DiscountsBuilder() {} - - public DiscountsBuilder unbilledChargeId(String value) { - this.unbilledChargeId = value; - return this; - } - - public DiscountsBuilder entityType(EntityType value) { - this.entityType = value; - return this; - } - - public DiscountsBuilder entityId(String value) { - this.entityId = value; - return this; - } - - public DiscountsBuilder description(String value) { - this.description = value; - return this; - } - - public DiscountsBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsParams build() { - return new DiscountsParams(this); - } - } - - public enum EntityType { - ITEM_LEVEL_COUPON("item_level_coupon"), - - DOCUMENT_LEVEL_COUPON("document_level_coupon"), - - ITEM_LEVEL_DISCOUNT("item_level_discount"), - - DOCUMENT_LEVEL_DISCOUNT("document_level_discount"), - - /** An enum member indicating that EntityType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - EntityType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static EntityType fromString(String value) { - if (value == null) return _UNKNOWN; - for (EntityType enumValue : EntityType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class TiersParams { - - private final String unbilledChargeId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Integer quantityUsed; - - private final Long unitAmount; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String quantityUsedInDecimal; - - private final String unitAmountInDecimal; - - private TiersParams(TiersBuilder builder) { - - this.unbilledChargeId = builder.unbilledChargeId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.quantityUsed = builder.quantityUsed; - - this.unitAmount = builder.unitAmount; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.quantityUsedInDecimal = builder.quantityUsedInDecimal; - - this.unitAmountInDecimal = builder.unitAmountInDecimal; - } - - public String getUnbilledChargeId() { - return unbilledChargeId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Integer getQuantityUsed() { - return quantityUsed; - } - - public Long getUnitAmount() { - return unitAmount; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getQuantityUsedInDecimal() { - return quantityUsedInDecimal; - } - - public String getUnitAmountInDecimal() { - return unitAmountInDecimal; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.unbilledChargeId != null) { - - formData.put("unbilled_charge_id", this.unbilledChargeId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.quantityUsed != null) { - - formData.put("quantity_used", this.quantityUsed); - } - - if (this.unitAmount != null) { - - formData.put("unit_amount", this.unitAmount); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.quantityUsedInDecimal != null) { - - formData.put("quantity_used_in_decimal", this.quantityUsedInDecimal); - } - - if (this.unitAmountInDecimal != null) { - - formData.put("unit_amount_in_decimal", this.unitAmountInDecimal); - } - - return formData; - } - - /** Create a new builder for TiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TiersBuilder builder() { - return new TiersBuilder(); - } - - public static final class TiersBuilder { - - private String unbilledChargeId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Integer quantityUsed; - - private Long unitAmount; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String quantityUsedInDecimal; - - private String unitAmountInDecimal; - - private TiersBuilder() {} - - public TiersBuilder unbilledChargeId(String value) { - this.unbilledChargeId = value; - return this; - } - - public TiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public TiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public TiersBuilder quantityUsed(Integer value) { - this.quantityUsed = value; - return this; - } - - public TiersBuilder unitAmount(Long value) { - this.unitAmount = value; - return this; - } - - public TiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public TiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public TiersBuilder quantityUsedInDecimal(String value) { - this.quantityUsedInDecimal = value; - return this; - } - - public TiersBuilder unitAmountInDecimal(String value) { - this.unitAmountInDecimal = value; - return this; - } - - public TiersParams build() { - return new TiersParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/MoveForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/MoveForSubscriptionParams.java deleted file mode 100644 index 1b244d7e..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/MoveForSubscriptionParams.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class MoveForSubscriptionParams { - - private final String toCustomerId; - - private final Boolean copyPaymentSource; - - private MoveForSubscriptionParams(MoveForSubscriptionBuilder builder) { - - this.toCustomerId = builder.toCustomerId; - - this.copyPaymentSource = builder.copyPaymentSource; - } - - public String getToCustomerId() { - return toCustomerId; - } - - public Boolean getCopyPaymentSource() { - return copyPaymentSource; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.toCustomerId != null) { - - formData.put("to_customer_id", this.toCustomerId); - } - - if (this.copyPaymentSource != null) { - - formData.put("copy_payment_source", this.copyPaymentSource); - } - - return formData; - } - - /** Create a new builder for MoveForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static MoveForSubscriptionBuilder builder() { - return new MoveForSubscriptionBuilder(); - } - - public static final class MoveForSubscriptionBuilder { - - private String toCustomerId; - - private Boolean copyPaymentSource; - - private MoveForSubscriptionBuilder() {} - - public MoveForSubscriptionBuilder toCustomerId(String value) { - this.toCustomerId = value; - return this; - } - - public MoveForSubscriptionBuilder copyPaymentSource(Boolean value) { - this.copyPaymentSource = value; - return this; - } - - public MoveForSubscriptionParams build() { - return new MoveForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/OverrideBillingProfileForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/OverrideBillingProfileForSubscriptionParams.java deleted file mode 100644 index 20f1691b..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/OverrideBillingProfileForSubscriptionParams.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class OverrideBillingProfileForSubscriptionParams { - - private final String paymentSourceId; - - private final AutoCollection autoCollection; - - private OverrideBillingProfileForSubscriptionParams( - OverrideBillingProfileForSubscriptionBuilder builder) { - - this.paymentSourceId = builder.paymentSourceId; - - this.autoCollection = builder.autoCollection; - } - - public String getPaymentSourceId() { - return paymentSourceId; - } - - public AutoCollection getAutoCollection() { - return autoCollection; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.paymentSourceId != null) { - - formData.put("payment_source_id", this.paymentSourceId); - } - - if (this.autoCollection != null) { - - formData.put("auto_collection", this.autoCollection); - } - - return formData; - } - - /** Create a new builder for OverrideBillingProfileForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static OverrideBillingProfileForSubscriptionBuilder builder() { - return new OverrideBillingProfileForSubscriptionBuilder(); - } - - public static final class OverrideBillingProfileForSubscriptionBuilder { - - private String paymentSourceId; - - private AutoCollection autoCollection; - - private OverrideBillingProfileForSubscriptionBuilder() {} - - public OverrideBillingProfileForSubscriptionBuilder paymentSourceId(String value) { - this.paymentSourceId = value; - return this; - } - - public OverrideBillingProfileForSubscriptionBuilder autoCollection(AutoCollection value) { - this.autoCollection = value; - return this; - } - - public OverrideBillingProfileForSubscriptionParams build() { - return new OverrideBillingProfileForSubscriptionParams(this); - } - } - - public enum AutoCollection { - ON("on"), - - OFF("off"), - - /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AutoCollection(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AutoCollection fromString(String value) { - if (value == null) return _UNKNOWN; - for (AutoCollection enumValue : AutoCollection.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/PauseForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/PauseForSubscriptionParams.java deleted file mode 100644 index 6b4ee2e5..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/PauseForSubscriptionParams.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class PauseForSubscriptionParams { - - private final PauseOption pauseOption; - - private final Timestamp pauseDate; - - private final UnbilledChargesHandling unbilledChargesHandling; - - private final InvoiceDunningHandling invoiceDunningHandling; - - private final Integer skipBillingCycles; - - private final Timestamp resumeDate; - - private PauseForSubscriptionParams(PauseForSubscriptionBuilder builder) { - - this.pauseOption = builder.pauseOption; - - this.pauseDate = builder.pauseDate; - - this.unbilledChargesHandling = builder.unbilledChargesHandling; - - this.invoiceDunningHandling = builder.invoiceDunningHandling; - - this.skipBillingCycles = builder.skipBillingCycles; - - this.resumeDate = builder.resumeDate; - } - - public PauseOption getPauseOption() { - return pauseOption; - } - - public Timestamp getPauseDate() { - return pauseDate; - } - - public UnbilledChargesHandling getUnbilledChargesHandling() { - return unbilledChargesHandling; - } - - public InvoiceDunningHandling getInvoiceDunningHandling() { - return invoiceDunningHandling; - } - - public Integer getSkipBillingCycles() { - return skipBillingCycles; - } - - public Timestamp getResumeDate() { - return resumeDate; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.pauseOption != null) { - - formData.put("pause_option", this.pauseOption); - } - - if (this.pauseDate != null) { - - formData.put("pause_date", this.pauseDate); - } - - if (this.unbilledChargesHandling != null) { - - formData.put("unbilled_charges_handling", this.unbilledChargesHandling); - } - - if (this.invoiceDunningHandling != null) { - - formData.put("invoice_dunning_handling", this.invoiceDunningHandling); - } - - if (this.skipBillingCycles != null) { - - formData.put("skip_billing_cycles", this.skipBillingCycles); - } - - if (this.resumeDate != null) { - - formData.put("resume_date", this.resumeDate); - } - - return formData; - } - - /** Create a new builder for PauseForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PauseForSubscriptionBuilder builder() { - return new PauseForSubscriptionBuilder(); - } - - public static final class PauseForSubscriptionBuilder { - - private PauseOption pauseOption; - - private Timestamp pauseDate; - - private UnbilledChargesHandling unbilledChargesHandling; - - private InvoiceDunningHandling invoiceDunningHandling; - - private Integer skipBillingCycles; - - private Timestamp resumeDate; - - private PauseForSubscriptionBuilder() {} - - public PauseForSubscriptionBuilder pauseOption(PauseOption value) { - this.pauseOption = value; - return this; - } - - public PauseForSubscriptionBuilder pauseDate(Timestamp value) { - this.pauseDate = value; - return this; - } - - public PauseForSubscriptionBuilder unbilledChargesHandling(UnbilledChargesHandling value) { - this.unbilledChargesHandling = value; - return this; - } - - public PauseForSubscriptionBuilder invoiceDunningHandling(InvoiceDunningHandling value) { - this.invoiceDunningHandling = value; - return this; - } - - public PauseForSubscriptionBuilder skipBillingCycles(Integer value) { - this.skipBillingCycles = value; - return this; - } - - public PauseForSubscriptionBuilder resumeDate(Timestamp value) { - this.resumeDate = value; - return this; - } - - public PauseForSubscriptionParams build() { - return new PauseForSubscriptionParams(this); - } - } - - public enum PauseOption { - IMMEDIATELY("immediately"), - - END_OF_TERM("end_of_term"), - - SPECIFIC_DATE("specific_date"), - - BILLING_CYCLES("billing_cycles"), - - /** An enum member indicating that PauseOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PauseOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PauseOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (PauseOption enumValue : PauseOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum UnbilledChargesHandling { - NO_ACTION("no_action"), - - INVOICE("invoice"), - - /** - * An enum member indicating that UnbilledChargesHandling was instantiated with an unknown - * value. - */ - _UNKNOWN(null); - private final String value; - - UnbilledChargesHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static UnbilledChargesHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (UnbilledChargesHandling enumValue : UnbilledChargesHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum InvoiceDunningHandling { - CONTINUE("continue"), - - STOP("stop"), - - /** - * An enum member indicating that InvoiceDunningHandling was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - InvoiceDunningHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static InvoiceDunningHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (InvoiceDunningHandling enumValue : InvoiceDunningHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/ReactivateForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/ReactivateForSubscriptionParams.java deleted file mode 100644 index 3a467ef6..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/ReactivateForSubscriptionParams.java +++ /dev/null @@ -1,770 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class ReactivateForSubscriptionParams { - - private final Timestamp trialEnd; - - private final Integer billingCycles; - - private final Integer trialPeriodDays; - - private final Timestamp reactivateFrom; - - private final Boolean invoiceImmediately; - - private final BillingAlignmentMode billingAlignmentMode; - - private final Integer termsToCharge; - - private final Timestamp invoiceDate; - - private final Integer contractTermBillingCycleOnRenewal; - - private final PaymentInitiator paymentInitiator; - - private final ContractTermParams contractTerm; - - private final StatementDescriptorParams statementDescriptor; - - private final PaymentIntentParams paymentIntent; - - private ReactivateForSubscriptionParams(ReactivateForSubscriptionBuilder builder) { - - this.trialEnd = builder.trialEnd; - - this.billingCycles = builder.billingCycles; - - this.trialPeriodDays = builder.trialPeriodDays; - - this.reactivateFrom = builder.reactivateFrom; - - this.invoiceImmediately = builder.invoiceImmediately; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.termsToCharge = builder.termsToCharge; - - this.invoiceDate = builder.invoiceDate; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - - this.paymentInitiator = builder.paymentInitiator; - - this.contractTerm = builder.contractTerm; - - this.statementDescriptor = builder.statementDescriptor; - - this.paymentIntent = builder.paymentIntent; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Integer getTrialPeriodDays() { - return trialPeriodDays; - } - - public Timestamp getReactivateFrom() { - return reactivateFrom; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - public PaymentInitiator getPaymentInitiator() { - return paymentInitiator; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public StatementDescriptorParams getStatementDescriptor() { - return statementDescriptor; - } - - public PaymentIntentParams getPaymentIntent() { - return paymentIntent; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialPeriodDays != null) { - - formData.put("trial_period_days", this.trialPeriodDays); - } - - if (this.reactivateFrom != null) { - - formData.put("reactivate_from", this.reactivateFrom); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - if (this.paymentInitiator != null) { - - formData.put("payment_initiator", this.paymentInitiator); - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.statementDescriptor != null) { - - // Single object - Map nestedData = this.statementDescriptor.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "statement_descriptor[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.paymentIntent != null) { - - // Single object - Map nestedData = this.paymentIntent.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "payment_intent[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for ReactivateForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ReactivateForSubscriptionBuilder builder() { - return new ReactivateForSubscriptionBuilder(); - } - - public static final class ReactivateForSubscriptionBuilder { - - private Timestamp trialEnd; - - private Integer billingCycles; - - private Integer trialPeriodDays; - - private Timestamp reactivateFrom; - - private Boolean invoiceImmediately; - - private BillingAlignmentMode billingAlignmentMode; - - private Integer termsToCharge; - - private Timestamp invoiceDate; - - private Integer contractTermBillingCycleOnRenewal; - - private PaymentInitiator paymentInitiator; - - private ContractTermParams contractTerm; - - private StatementDescriptorParams statementDescriptor; - - private PaymentIntentParams paymentIntent; - - private ReactivateForSubscriptionBuilder() {} - - public ReactivateForSubscriptionBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public ReactivateForSubscriptionBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - @Deprecated - public ReactivateForSubscriptionBuilder trialPeriodDays(Integer value) { - this.trialPeriodDays = value; - return this; - } - - public ReactivateForSubscriptionBuilder reactivateFrom(Timestamp value) { - this.reactivateFrom = value; - return this; - } - - public ReactivateForSubscriptionBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public ReactivateForSubscriptionBuilder billingAlignmentMode(BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public ReactivateForSubscriptionBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public ReactivateForSubscriptionBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public ReactivateForSubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public ReactivateForSubscriptionBuilder paymentInitiator(PaymentInitiator value) { - this.paymentInitiator = value; - return this; - } - - public ReactivateForSubscriptionBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public ReactivateForSubscriptionBuilder statementDescriptor(StatementDescriptorParams value) { - this.statementDescriptor = value; - return this; - } - - public ReactivateForSubscriptionBuilder paymentIntent(PaymentIntentParams value) { - this.paymentIntent = value; - return this; - } - - public ReactivateForSubscriptionParams build() { - return new ReactivateForSubscriptionParams(this); - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PaymentInitiator { - CUSTOMER("customer"), - - MERCHANT("merchant"), - - /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentInitiator(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentInitiator fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentInitiator enumValue : PaymentInitiator.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class StatementDescriptorParams { - - private final String descriptor; - - private StatementDescriptorParams(StatementDescriptorBuilder builder) { - - this.descriptor = builder.descriptor; - } - - public String getDescriptor() { - return descriptor; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.descriptor != null) { - - formData.put("descriptor", this.descriptor); - } - - return formData; - } - - /** Create a new builder for StatementDescriptorParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static StatementDescriptorBuilder builder() { - return new StatementDescriptorBuilder(); - } - - public static final class StatementDescriptorBuilder { - - private String descriptor; - - private StatementDescriptorBuilder() {} - - public StatementDescriptorBuilder descriptor(String value) { - this.descriptor = value; - return this; - } - - public StatementDescriptorParams build() { - return new StatementDescriptorParams(this); - } - } - } - - public static final class PaymentIntentParams { - - private final String id; - - private final String gatewayAccountId; - - private final String gwToken; - - private final PaymentMethodType paymentMethodType; - - private final String referenceId; - - private final String gwPaymentMethodId; - - private final java.util.Map additionalInformation; - - private PaymentIntentParams(PaymentIntentBuilder builder) { - - this.id = builder.id; - - this.gatewayAccountId = builder.gatewayAccountId; - - this.gwToken = builder.gwToken; - - this.paymentMethodType = builder.paymentMethodType; - - this.referenceId = builder.referenceId; - - this.gwPaymentMethodId = builder.gwPaymentMethodId; - - this.additionalInformation = builder.additionalInformation; - } - - public String getId() { - return id; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getGwToken() { - return gwToken; - } - - public PaymentMethodType getPaymentMethodType() { - return paymentMethodType; - } - - public String getReferenceId() { - return referenceId; - } - - public String getGwPaymentMethodId() { - return gwPaymentMethodId; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.gwToken != null) { - - formData.put("gw_token", this.gwToken); - } - - if (this.paymentMethodType != null) { - - formData.put("payment_method_type", this.paymentMethodType); - } - - if (this.referenceId != null) { - - formData.put("reference_id", this.referenceId); - } - - if (this.gwPaymentMethodId != null) { - - formData.put("gw_payment_method_id", this.gwPaymentMethodId); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for PaymentIntentParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PaymentIntentBuilder builder() { - return new PaymentIntentBuilder(); - } - - public static final class PaymentIntentBuilder { - - private String id; - - private String gatewayAccountId; - - private String gwToken; - - private PaymentMethodType paymentMethodType; - - private String referenceId; - - private String gwPaymentMethodId; - - private java.util.Map additionalInformation; - - private PaymentIntentBuilder() {} - - public PaymentIntentBuilder id(String value) { - this.id = value; - return this; - } - - public PaymentIntentBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public PaymentIntentBuilder gwToken(String value) { - this.gwToken = value; - return this; - } - - public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { - this.paymentMethodType = value; - return this; - } - - public PaymentIntentBuilder referenceId(String value) { - this.referenceId = value; - return this; - } - - @Deprecated - public PaymentIntentBuilder gwPaymentMethodId(String value) { - this.gwPaymentMethodId = value; - return this; - } - - public PaymentIntentBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public PaymentIntentParams build() { - return new PaymentIntentParams(this); - } - } - - public enum PaymentMethodType { - CARD("card"), - - IDEAL("ideal"), - - SOFORT("sofort"), - - BANCONTACT("bancontact"), - - GOOGLE_PAY("google_pay"), - - DOTPAY("dotpay"), - - GIROPAY("giropay"), - - APPLE_PAY("apple_pay"), - - UPI("upi"), - - NETBANKING_EMANDATES("netbanking_emandates"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - DIRECT_DEBIT("direct_debit"), - - BOLETO("boleto"), - - VENMO("venmo"), - - AMAZON_PAYMENTS("amazon_payments"), - - PAY_TO("pay_to"), - - FASTER_PAYMENTS("faster_payments"), - - SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), - - KLARNA_PAY_NOW("klarna_pay_now"), - - ONLINE_BANKING_POLAND("online_banking_poland"), - - PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), - - ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), - - KBC_PAYMENT_BUTTON("kbc_payment_button"), - - PAY_BY_BANK("pay_by_bank"), - - TRUSTLY("trustly"), - - STABLECOIN("stablecoin"), - - /** - * An enum member indicating that PaymentMethodType was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - PaymentMethodType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethodType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethodType enumValue : PaymentMethodType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/RegenerateInvoiceForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/RegenerateInvoiceForSubscriptionParams.java deleted file mode 100644 index f09e3e71..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/RegenerateInvoiceForSubscriptionParams.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class RegenerateInvoiceForSubscriptionParams { - - private final Timestamp dateFrom; - - private final Timestamp dateTo; - - private final Boolean prorate; - - private final Boolean invoiceImmediately; - - private RegenerateInvoiceForSubscriptionParams(RegenerateInvoiceForSubscriptionBuilder builder) { - - this.dateFrom = builder.dateFrom; - - this.dateTo = builder.dateTo; - - this.prorate = builder.prorate; - - this.invoiceImmediately = builder.invoiceImmediately; - } - - public Timestamp getDateFrom() { - return dateFrom; - } - - public Timestamp getDateTo() { - return dateTo; - } - - public Boolean getProrate() { - return prorate; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.dateFrom != null) { - - formData.put("date_from", this.dateFrom); - } - - if (this.dateTo != null) { - - formData.put("date_to", this.dateTo); - } - - if (this.prorate != null) { - - formData.put("prorate", this.prorate); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - return formData; - } - - /** Create a new builder for RegenerateInvoiceForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RegenerateInvoiceForSubscriptionBuilder builder() { - return new RegenerateInvoiceForSubscriptionBuilder(); - } - - public static final class RegenerateInvoiceForSubscriptionBuilder { - - private Timestamp dateFrom; - - private Timestamp dateTo; - - private Boolean prorate; - - private Boolean invoiceImmediately; - - private RegenerateInvoiceForSubscriptionBuilder() {} - - public RegenerateInvoiceForSubscriptionBuilder dateFrom(Timestamp value) { - this.dateFrom = value; - return this; - } - - public RegenerateInvoiceForSubscriptionBuilder dateTo(Timestamp value) { - this.dateTo = value; - return this; - } - - public RegenerateInvoiceForSubscriptionBuilder prorate(Boolean value) { - this.prorate = value; - return this; - } - - public RegenerateInvoiceForSubscriptionBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public RegenerateInvoiceForSubscriptionParams build() { - return new RegenerateInvoiceForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveAdvanceInvoiceScheduleForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/RemoveAdvanceInvoiceScheduleForSubscriptionParams.java deleted file mode 100644 index 6bd09aaa..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveAdvanceInvoiceScheduleForSubscriptionParams.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class RemoveAdvanceInvoiceScheduleForSubscriptionParams { - - private final List specificDatesSchedule; - - private RemoveAdvanceInvoiceScheduleForSubscriptionParams( - RemoveAdvanceInvoiceScheduleForSubscriptionBuilder builder) { - - this.specificDatesSchedule = builder.specificDatesSchedule; - } - - public List getSpecificDatesSchedule() { - return specificDatesSchedule; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.specificDatesSchedule != null) { - - // List of objects - for (int i = 0; i < this.specificDatesSchedule.size(); i++) { - SpecificDatesScheduleParams item = this.specificDatesSchedule.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "specific_dates_schedule[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for RemoveAdvanceInvoiceScheduleForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RemoveAdvanceInvoiceScheduleForSubscriptionBuilder builder() { - return new RemoveAdvanceInvoiceScheduleForSubscriptionBuilder(); - } - - public static final class RemoveAdvanceInvoiceScheduleForSubscriptionBuilder { - - private List specificDatesSchedule; - - private RemoveAdvanceInvoiceScheduleForSubscriptionBuilder() {} - - public RemoveAdvanceInvoiceScheduleForSubscriptionBuilder specificDatesSchedule( - List value) { - this.specificDatesSchedule = value; - return this; - } - - public RemoveAdvanceInvoiceScheduleForSubscriptionParams build() { - return new RemoveAdvanceInvoiceScheduleForSubscriptionParams(this); - } - } - - public static final class SpecificDatesScheduleParams { - - private final String id; - - private SpecificDatesScheduleParams(SpecificDatesScheduleBuilder builder) { - - this.id = builder.id; - } - - public String getId() { - return id; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - return formData; - } - - /** Create a new builder for SpecificDatesScheduleParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SpecificDatesScheduleBuilder builder() { - return new SpecificDatesScheduleBuilder(); - } - - public static final class SpecificDatesScheduleBuilder { - - private String id; - - private SpecificDatesScheduleBuilder() {} - - public SpecificDatesScheduleBuilder id(String value) { - this.id = value; - return this; - } - - public SpecificDatesScheduleParams build() { - return new SpecificDatesScheduleParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveCouponsForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/RemoveCouponsForSubscriptionParams.java deleted file mode 100644 index 2a146ea4..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveCouponsForSubscriptionParams.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class RemoveCouponsForSubscriptionParams { - - private final List couponIds; - - private RemoveCouponsForSubscriptionParams(RemoveCouponsForSubscriptionBuilder builder) { - - this.couponIds = builder.couponIds; - } - - public List getCouponIds() { - return couponIds; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - return formData; - } - - /** Create a new builder for RemoveCouponsForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RemoveCouponsForSubscriptionBuilder builder() { - return new RemoveCouponsForSubscriptionBuilder(); - } - - public static final class RemoveCouponsForSubscriptionBuilder { - - private List couponIds; - - private RemoveCouponsForSubscriptionBuilder() {} - - public RemoveCouponsForSubscriptionBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public RemoveCouponsForSubscriptionParams build() { - return new RemoveCouponsForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledCancellationForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledCancellationForSubscriptionParams.java deleted file mode 100644 index e7c80663..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledCancellationForSubscriptionParams.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RemoveScheduledCancellationForSubscriptionParams { - - private final Integer billingCycles; - - private final Integer contractTermBillingCycleOnRenewal; - - private final ContractTermParams contractTerm; - - private RemoveScheduledCancellationForSubscriptionParams( - RemoveScheduledCancellationForSubscriptionBuilder builder) { - - this.billingCycles = builder.billingCycles; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - - this.contractTerm = builder.contractTerm; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for RemoveScheduledCancellationForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RemoveScheduledCancellationForSubscriptionBuilder builder() { - return new RemoveScheduledCancellationForSubscriptionBuilder(); - } - - public static final class RemoveScheduledCancellationForSubscriptionBuilder { - - private Integer billingCycles; - - private Integer contractTermBillingCycleOnRenewal; - - private ContractTermParams contractTerm; - - private RemoveScheduledCancellationForSubscriptionBuilder() {} - - public RemoveScheduledCancellationForSubscriptionBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public RemoveScheduledCancellationForSubscriptionBuilder contractTermBillingCycleOnRenewal( - Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public RemoveScheduledCancellationForSubscriptionBuilder contractTerm( - ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public RemoveScheduledCancellationForSubscriptionParams build() { - return new RemoveScheduledCancellationForSubscriptionParams(this); - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledChangesForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledChangesForSubscriptionParams.java deleted file mode 100644 index ed2d5b1c..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledChangesForSubscriptionParams.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RemoveScheduledChangesForSubscriptionParams { - - private RemoveScheduledChangesForSubscriptionParams( - RemoveScheduledChangesForSubscriptionBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for RemoveScheduledChangesForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RemoveScheduledChangesForSubscriptionBuilder builder() { - return new RemoveScheduledChangesForSubscriptionBuilder(); - } - - public static final class RemoveScheduledChangesForSubscriptionBuilder { - - private RemoveScheduledChangesForSubscriptionBuilder() {} - - public RemoveScheduledChangesForSubscriptionParams build() { - return new RemoveScheduledChangesForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledPauseForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledPauseForSubscriptionParams.java deleted file mode 100644 index 4e149ec3..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledPauseForSubscriptionParams.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RemoveScheduledPauseForSubscriptionParams { - - private RemoveScheduledPauseForSubscriptionParams( - RemoveScheduledPauseForSubscriptionBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for RemoveScheduledPauseForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RemoveScheduledPauseForSubscriptionBuilder builder() { - return new RemoveScheduledPauseForSubscriptionBuilder(); - } - - public static final class RemoveScheduledPauseForSubscriptionBuilder { - - private RemoveScheduledPauseForSubscriptionBuilder() {} - - public RemoveScheduledPauseForSubscriptionParams build() { - return new RemoveScheduledPauseForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledResumptionForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledResumptionForSubscriptionParams.java deleted file mode 100644 index 01fa300c..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/RemoveScheduledResumptionForSubscriptionParams.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RemoveScheduledResumptionForSubscriptionParams { - - private RemoveScheduledResumptionForSubscriptionParams( - RemoveScheduledResumptionForSubscriptionBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for RemoveScheduledResumptionForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RemoveScheduledResumptionForSubscriptionBuilder builder() { - return new RemoveScheduledResumptionForSubscriptionBuilder(); - } - - public static final class RemoveScheduledResumptionForSubscriptionBuilder { - - private RemoveScheduledResumptionForSubscriptionBuilder() {} - - public RemoveScheduledResumptionForSubscriptionParams build() { - return new RemoveScheduledResumptionForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/ResumeForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/ResumeForSubscriptionParams.java deleted file mode 100644 index 2fde5453..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/ResumeForSubscriptionParams.java +++ /dev/null @@ -1,528 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class ResumeForSubscriptionParams { - - private final ResumeOption resumeOption; - - private final Timestamp resumeDate; - - private final ChargesHandling chargesHandling; - - private final UnpaidInvoicesHandling unpaidInvoicesHandling; - - private final PaymentInitiator paymentInitiator; - - private final PaymentIntentParams paymentIntent; - - private ResumeForSubscriptionParams(ResumeForSubscriptionBuilder builder) { - - this.resumeOption = builder.resumeOption; - - this.resumeDate = builder.resumeDate; - - this.chargesHandling = builder.chargesHandling; - - this.unpaidInvoicesHandling = builder.unpaidInvoicesHandling; - - this.paymentInitiator = builder.paymentInitiator; - - this.paymentIntent = builder.paymentIntent; - } - - public ResumeOption getResumeOption() { - return resumeOption; - } - - public Timestamp getResumeDate() { - return resumeDate; - } - - public ChargesHandling getChargesHandling() { - return chargesHandling; - } - - public UnpaidInvoicesHandling getUnpaidInvoicesHandling() { - return unpaidInvoicesHandling; - } - - public PaymentInitiator getPaymentInitiator() { - return paymentInitiator; - } - - public PaymentIntentParams getPaymentIntent() { - return paymentIntent; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.resumeOption != null) { - - formData.put("resume_option", this.resumeOption); - } - - if (this.resumeDate != null) { - - formData.put("resume_date", this.resumeDate); - } - - if (this.chargesHandling != null) { - - formData.put("charges_handling", this.chargesHandling); - } - - if (this.unpaidInvoicesHandling != null) { - - formData.put("unpaid_invoices_handling", this.unpaidInvoicesHandling); - } - - if (this.paymentInitiator != null) { - - formData.put("payment_initiator", this.paymentInitiator); - } - - if (this.paymentIntent != null) { - - // Single object - Map nestedData = this.paymentIntent.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "payment_intent[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - return formData; - } - - /** Create a new builder for ResumeForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ResumeForSubscriptionBuilder builder() { - return new ResumeForSubscriptionBuilder(); - } - - public static final class ResumeForSubscriptionBuilder { - - private ResumeOption resumeOption; - - private Timestamp resumeDate; - - private ChargesHandling chargesHandling; - - private UnpaidInvoicesHandling unpaidInvoicesHandling; - - private PaymentInitiator paymentInitiator; - - private PaymentIntentParams paymentIntent; - - private ResumeForSubscriptionBuilder() {} - - public ResumeForSubscriptionBuilder resumeOption(ResumeOption value) { - this.resumeOption = value; - return this; - } - - public ResumeForSubscriptionBuilder resumeDate(Timestamp value) { - this.resumeDate = value; - return this; - } - - public ResumeForSubscriptionBuilder chargesHandling(ChargesHandling value) { - this.chargesHandling = value; - return this; - } - - public ResumeForSubscriptionBuilder unpaidInvoicesHandling(UnpaidInvoicesHandling value) { - this.unpaidInvoicesHandling = value; - return this; - } - - public ResumeForSubscriptionBuilder paymentInitiator(PaymentInitiator value) { - this.paymentInitiator = value; - return this; - } - - public ResumeForSubscriptionBuilder paymentIntent(PaymentIntentParams value) { - this.paymentIntent = value; - return this; - } - - public ResumeForSubscriptionParams build() { - return new ResumeForSubscriptionParams(this); - } - } - - public enum ResumeOption { - IMMEDIATELY("immediately"), - - SPECIFIC_DATE("specific_date"), - - /** An enum member indicating that ResumeOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ResumeOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ResumeOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ResumeOption enumValue : ResumeOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargesHandling { - INVOICE_IMMEDIATELY("invoice_immediately"), - - ADD_TO_UNBILLED_CHARGES("add_to_unbilled_charges"), - - /** An enum member indicating that ChargesHandling was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargesHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargesHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargesHandling enumValue : ChargesHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum UnpaidInvoicesHandling { - NO_ACTION("no_action"), - - SCHEDULE_PAYMENT_COLLECTION("schedule_payment_collection"), - - /** - * An enum member indicating that UnpaidInvoicesHandling was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - UnpaidInvoicesHandling(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static UnpaidInvoicesHandling fromString(String value) { - if (value == null) return _UNKNOWN; - for (UnpaidInvoicesHandling enumValue : UnpaidInvoicesHandling.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PaymentInitiator { - CUSTOMER("customer"), - - MERCHANT("merchant"), - - /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentInitiator(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentInitiator fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentInitiator enumValue : PaymentInitiator.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class PaymentIntentParams { - - private final String id; - - private final String gatewayAccountId; - - private final String gwToken; - - private final PaymentMethodType paymentMethodType; - - private final String referenceId; - - private final String gwPaymentMethodId; - - private final java.util.Map additionalInformation; - - private PaymentIntentParams(PaymentIntentBuilder builder) { - - this.id = builder.id; - - this.gatewayAccountId = builder.gatewayAccountId; - - this.gwToken = builder.gwToken; - - this.paymentMethodType = builder.paymentMethodType; - - this.referenceId = builder.referenceId; - - this.gwPaymentMethodId = builder.gwPaymentMethodId; - - this.additionalInformation = builder.additionalInformation; - } - - public String getId() { - return id; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getGwToken() { - return gwToken; - } - - public PaymentMethodType getPaymentMethodType() { - return paymentMethodType; - } - - public String getReferenceId() { - return referenceId; - } - - public String getGwPaymentMethodId() { - return gwPaymentMethodId; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.gwToken != null) { - - formData.put("gw_token", this.gwToken); - } - - if (this.paymentMethodType != null) { - - formData.put("payment_method_type", this.paymentMethodType); - } - - if (this.referenceId != null) { - - formData.put("reference_id", this.referenceId); - } - - if (this.gwPaymentMethodId != null) { - - formData.put("gw_payment_method_id", this.gwPaymentMethodId); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for PaymentIntentParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PaymentIntentBuilder builder() { - return new PaymentIntentBuilder(); - } - - public static final class PaymentIntentBuilder { - - private String id; - - private String gatewayAccountId; - - private String gwToken; - - private PaymentMethodType paymentMethodType; - - private String referenceId; - - private String gwPaymentMethodId; - - private java.util.Map additionalInformation; - - private PaymentIntentBuilder() {} - - public PaymentIntentBuilder id(String value) { - this.id = value; - return this; - } - - public PaymentIntentBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public PaymentIntentBuilder gwToken(String value) { - this.gwToken = value; - return this; - } - - public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { - this.paymentMethodType = value; - return this; - } - - public PaymentIntentBuilder referenceId(String value) { - this.referenceId = value; - return this; - } - - @Deprecated - public PaymentIntentBuilder gwPaymentMethodId(String value) { - this.gwPaymentMethodId = value; - return this; - } - - public PaymentIntentBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public PaymentIntentParams build() { - return new PaymentIntentParams(this); - } - } - - public enum PaymentMethodType { - CARD("card"), - - IDEAL("ideal"), - - SOFORT("sofort"), - - BANCONTACT("bancontact"), - - GOOGLE_PAY("google_pay"), - - DOTPAY("dotpay"), - - GIROPAY("giropay"), - - APPLE_PAY("apple_pay"), - - UPI("upi"), - - NETBANKING_EMANDATES("netbanking_emandates"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - DIRECT_DEBIT("direct_debit"), - - BOLETO("boleto"), - - VENMO("venmo"), - - AMAZON_PAYMENTS("amazon_payments"), - - PAY_TO("pay_to"), - - FASTER_PAYMENTS("faster_payments"), - - SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), - - KLARNA_PAY_NOW("klarna_pay_now"), - - ONLINE_BANKING_POLAND("online_banking_poland"), - - PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), - - ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), - - KBC_PAYMENT_BUTTON("kbc_payment_button"), - - PAY_BY_BANK("pay_by_bank"), - - TRUSTLY("trustly"), - - STABLECOIN("stablecoin"), - - /** - * An enum member indicating that PaymentMethodType was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - PaymentMethodType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethodType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethodType enumValue : PaymentMethodType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/RetrieveAdvanceInvoiceScheduleForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/RetrieveAdvanceInvoiceScheduleForSubscriptionParams.java deleted file mode 100644 index 690dc3e6..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/RetrieveAdvanceInvoiceScheduleForSubscriptionParams.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RetrieveAdvanceInvoiceScheduleForSubscriptionParams { - - private final Map queryParams; - - private RetrieveAdvanceInvoiceScheduleForSubscriptionParams( - RetrieveAdvanceInvoiceScheduleForSubscriptionBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public RetrieveAdvanceInvoiceScheduleForSubscriptionBuilder toBuilder() { - RetrieveAdvanceInvoiceScheduleForSubscriptionBuilder builder = - new RetrieveAdvanceInvoiceScheduleForSubscriptionBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for RetrieveAdvanceInvoiceScheduleForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RetrieveAdvanceInvoiceScheduleForSubscriptionBuilder builder() { - return new RetrieveAdvanceInvoiceScheduleForSubscriptionBuilder(); - } - - public static final class RetrieveAdvanceInvoiceScheduleForSubscriptionBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private RetrieveAdvanceInvoiceScheduleForSubscriptionBuilder() {} - - public RetrieveAdvanceInvoiceScheduleForSubscriptionParams build() { - return new RetrieveAdvanceInvoiceScheduleForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/RetrieveWithScheduledChangesForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/RetrieveWithScheduledChangesForSubscriptionParams.java deleted file mode 100644 index f6e7fd3e..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/RetrieveWithScheduledChangesForSubscriptionParams.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RetrieveWithScheduledChangesForSubscriptionParams { - - private final Map queryParams; - - private RetrieveWithScheduledChangesForSubscriptionParams( - RetrieveWithScheduledChangesForSubscriptionBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public RetrieveWithScheduledChangesForSubscriptionBuilder toBuilder() { - RetrieveWithScheduledChangesForSubscriptionBuilder builder = - new RetrieveWithScheduledChangesForSubscriptionBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for RetrieveWithScheduledChangesForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RetrieveWithScheduledChangesForSubscriptionBuilder builder() { - return new RetrieveWithScheduledChangesForSubscriptionBuilder(); - } - - public static final class RetrieveWithScheduledChangesForSubscriptionBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private RetrieveWithScheduledChangesForSubscriptionBuilder() {} - - public RetrieveWithScheduledChangesForSubscriptionParams build() { - return new RetrieveWithScheduledChangesForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionAddChargeAtTermEndParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionAddChargeAtTermEndParams.java new file mode 100644 index 00000000..c4a8e0e4 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionAddChargeAtTermEndParams.java @@ -0,0 +1,233 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class SubscriptionAddChargeAtTermEndParams { + + private final Long amount; + + private final String description; + + private final String amountInDecimal; + + private final AvalaraSaleType avalaraSaleType; + + private final Integer avalaraTransactionType; + + private final Integer avalaraServiceType; + + private final Timestamp dateFrom; + + private final Timestamp dateTo; + + private SubscriptionAddChargeAtTermEndParams(SubscriptionAddChargeAtTermEndBuilder builder) { + + this.amount = builder.amount; + + this.description = builder.description; + + this.amountInDecimal = builder.amountInDecimal; + + this.avalaraSaleType = builder.avalaraSaleType; + + this.avalaraTransactionType = builder.avalaraTransactionType; + + this.avalaraServiceType = builder.avalaraServiceType; + + this.dateFrom = builder.dateFrom; + + this.dateTo = builder.dateTo; + } + + public Long getAmount() { + return amount; + } + + public String getDescription() { + return description; + } + + public String getAmountInDecimal() { + return amountInDecimal; + } + + public AvalaraSaleType getAvalaraSaleType() { + return avalaraSaleType; + } + + public Integer getAvalaraTransactionType() { + return avalaraTransactionType; + } + + public Integer getAvalaraServiceType() { + return avalaraServiceType; + } + + public Timestamp getDateFrom() { + return dateFrom; + } + + public Timestamp getDateTo() { + return dateTo; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.amountInDecimal != null) { + + formData.put("amount_in_decimal", this.amountInDecimal); + } + + if (this.avalaraSaleType != null) { + + formData.put("avalara_sale_type", this.avalaraSaleType); + } + + if (this.avalaraTransactionType != null) { + + formData.put("avalara_transaction_type", this.avalaraTransactionType); + } + + if (this.avalaraServiceType != null) { + + formData.put("avalara_service_type", this.avalaraServiceType); + } + + if (this.dateFrom != null) { + + formData.put("date_from", this.dateFrom); + } + + if (this.dateTo != null) { + + formData.put("date_to", this.dateTo); + } + + return formData; + } + + /** Create a new builder for SubscriptionAddChargeAtTermEndParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionAddChargeAtTermEndBuilder builder() { + return new SubscriptionAddChargeAtTermEndBuilder(); + } + + public static final class SubscriptionAddChargeAtTermEndBuilder { + + private Long amount; + + private String description; + + private String amountInDecimal; + + private AvalaraSaleType avalaraSaleType; + + private Integer avalaraTransactionType; + + private Integer avalaraServiceType; + + private Timestamp dateFrom; + + private Timestamp dateTo; + + private SubscriptionAddChargeAtTermEndBuilder() {} + + public SubscriptionAddChargeAtTermEndBuilder amount(Long value) { + this.amount = value; + return this; + } + + public SubscriptionAddChargeAtTermEndBuilder description(String value) { + this.description = value; + return this; + } + + public SubscriptionAddChargeAtTermEndBuilder amountInDecimal(String value) { + this.amountInDecimal = value; + return this; + } + + public SubscriptionAddChargeAtTermEndBuilder avalaraSaleType(AvalaraSaleType value) { + this.avalaraSaleType = value; + return this; + } + + public SubscriptionAddChargeAtTermEndBuilder avalaraTransactionType(Integer value) { + this.avalaraTransactionType = value; + return this; + } + + public SubscriptionAddChargeAtTermEndBuilder avalaraServiceType(Integer value) { + this.avalaraServiceType = value; + return this; + } + + public SubscriptionAddChargeAtTermEndBuilder dateFrom(Timestamp value) { + this.dateFrom = value; + return this; + } + + public SubscriptionAddChargeAtTermEndBuilder dateTo(Timestamp value) { + this.dateTo = value; + return this; + } + + public SubscriptionAddChargeAtTermEndParams build() { + return new SubscriptionAddChargeAtTermEndParams(this); + } + } + + public enum AvalaraSaleType { + WHOLESALE("wholesale"), + + RETAIL("retail"), + + CONSUMED("consumed"), + + VENDOR_USE("vendor_use"), + + /** An enum member indicating that AvalaraSaleType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AvalaraSaleType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AvalaraSaleType fromString(String value) { + if (value == null) return _UNKNOWN; + for (AvalaraSaleType enumValue : AvalaraSaleType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCancelForItemsParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCancelForItemsParams.java new file mode 100644 index 00000000..ab0c442a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCancelForItemsParams.java @@ -0,0 +1,621 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class SubscriptionCancelForItemsParams { + + private final CancelOption cancelOption; + + private final Boolean endOfTerm; + + private final Timestamp cancelAt; + + private final CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; + + private final UnbilledChargesOption unbilledChargesOption; + + private final AccountReceivablesHandling accountReceivablesHandling; + + private final RefundableCreditsHandling refundableCreditsHandling; + + private final ContractTermCancelOption contractTermCancelOption; + + private final Timestamp invoiceDate; + + private final String cancelReasonCode; + + private final List subscriptionItems; + + private SubscriptionCancelForItemsParams(SubscriptionCancelForItemsBuilder builder) { + + this.cancelOption = builder.cancelOption; + + this.endOfTerm = builder.endOfTerm; + + this.cancelAt = builder.cancelAt; + + this.creditOptionForCurrentTermCharges = builder.creditOptionForCurrentTermCharges; + + this.unbilledChargesOption = builder.unbilledChargesOption; + + this.accountReceivablesHandling = builder.accountReceivablesHandling; + + this.refundableCreditsHandling = builder.refundableCreditsHandling; + + this.contractTermCancelOption = builder.contractTermCancelOption; + + this.invoiceDate = builder.invoiceDate; + + this.cancelReasonCode = builder.cancelReasonCode; + + this.subscriptionItems = builder.subscriptionItems; + } + + public CancelOption getCancelOption() { + return cancelOption; + } + + public Boolean getEndOfTerm() { + return endOfTerm; + } + + public Timestamp getCancelAt() { + return cancelAt; + } + + public CreditOptionForCurrentTermCharges getCreditOptionForCurrentTermCharges() { + return creditOptionForCurrentTermCharges; + } + + public UnbilledChargesOption getUnbilledChargesOption() { + return unbilledChargesOption; + } + + public AccountReceivablesHandling getAccountReceivablesHandling() { + return accountReceivablesHandling; + } + + public RefundableCreditsHandling getRefundableCreditsHandling() { + return refundableCreditsHandling; + } + + public ContractTermCancelOption getContractTermCancelOption() { + return contractTermCancelOption; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public String getCancelReasonCode() { + return cancelReasonCode; + } + + public List getSubscriptionItems() { + return subscriptionItems; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.cancelOption != null) { + + formData.put("cancel_option", this.cancelOption); + } + + if (this.endOfTerm != null) { + + formData.put("end_of_term", this.endOfTerm); + } + + if (this.cancelAt != null) { + + formData.put("cancel_at", this.cancelAt); + } + + if (this.creditOptionForCurrentTermCharges != null) { + + formData.put( + "credit_option_for_current_term_charges", this.creditOptionForCurrentTermCharges); + } + + if (this.unbilledChargesOption != null) { + + formData.put("unbilled_charges_option", this.unbilledChargesOption); + } + + if (this.accountReceivablesHandling != null) { + + formData.put("account_receivables_handling", this.accountReceivablesHandling); + } + + if (this.refundableCreditsHandling != null) { + + formData.put("refundable_credits_handling", this.refundableCreditsHandling); + } + + if (this.contractTermCancelOption != null) { + + formData.put("contract_term_cancel_option", this.contractTermCancelOption); + } + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.cancelReasonCode != null) { + + formData.put("cancel_reason_code", this.cancelReasonCode); + } + + if (this.subscriptionItems != null) { + + // List of objects + for (int i = 0; i < this.subscriptionItems.size(); i++) { + SubscriptionItemsParams item = this.subscriptionItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for SubscriptionCancelForItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionCancelForItemsBuilder builder() { + return new SubscriptionCancelForItemsBuilder(); + } + + public static final class SubscriptionCancelForItemsBuilder { + + private CancelOption cancelOption; + + private Boolean endOfTerm; + + private Timestamp cancelAt; + + private CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; + + private UnbilledChargesOption unbilledChargesOption; + + private AccountReceivablesHandling accountReceivablesHandling; + + private RefundableCreditsHandling refundableCreditsHandling; + + private ContractTermCancelOption contractTermCancelOption; + + private Timestamp invoiceDate; + + private String cancelReasonCode; + + private List subscriptionItems; + + private SubscriptionCancelForItemsBuilder() {} + + public SubscriptionCancelForItemsBuilder cancelOption(CancelOption value) { + this.cancelOption = value; + return this; + } + + public SubscriptionCancelForItemsBuilder endOfTerm(Boolean value) { + this.endOfTerm = value; + return this; + } + + public SubscriptionCancelForItemsBuilder cancelAt(Timestamp value) { + this.cancelAt = value; + return this; + } + + public SubscriptionCancelForItemsBuilder creditOptionForCurrentTermCharges( + CreditOptionForCurrentTermCharges value) { + this.creditOptionForCurrentTermCharges = value; + return this; + } + + public SubscriptionCancelForItemsBuilder unbilledChargesOption(UnbilledChargesOption value) { + this.unbilledChargesOption = value; + return this; + } + + public SubscriptionCancelForItemsBuilder accountReceivablesHandling( + AccountReceivablesHandling value) { + this.accountReceivablesHandling = value; + return this; + } + + public SubscriptionCancelForItemsBuilder refundableCreditsHandling( + RefundableCreditsHandling value) { + this.refundableCreditsHandling = value; + return this; + } + + public SubscriptionCancelForItemsBuilder contractTermCancelOption( + ContractTermCancelOption value) { + this.contractTermCancelOption = value; + return this; + } + + public SubscriptionCancelForItemsBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public SubscriptionCancelForItemsBuilder cancelReasonCode(String value) { + this.cancelReasonCode = value; + return this; + } + + public SubscriptionCancelForItemsBuilder subscriptionItems( + List value) { + this.subscriptionItems = value; + return this; + } + + public SubscriptionCancelForItemsParams build() { + return new SubscriptionCancelForItemsParams(this); + } + } + + public enum CancelOption { + IMMEDIATELY("immediately"), + + END_OF_TERM("end_of_term"), + + SPECIFIC_DATE("specific_date"), + + END_OF_BILLING_TERM("end_of_billing_term"), + + /** An enum member indicating that CancelOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + CancelOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CancelOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (CancelOption enumValue : CancelOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum CreditOptionForCurrentTermCharges { + NONE("none"), + + PRORATE("prorate"), + + FULL("full"), + + /** + * An enum member indicating that CreditOptionForCurrentTermCharges was instantiated with an + * unknown value. + */ + _UNKNOWN(null); + private final String value; + + CreditOptionForCurrentTermCharges(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CreditOptionForCurrentTermCharges fromString(String value) { + if (value == null) return _UNKNOWN; + for (CreditOptionForCurrentTermCharges enumValue : + CreditOptionForCurrentTermCharges.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum UnbilledChargesOption { + INVOICE("invoice"), + + DELETE("delete"), + + /** + * An enum member indicating that UnbilledChargesOption was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + UnbilledChargesOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static UnbilledChargesOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (UnbilledChargesOption enumValue : UnbilledChargesOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum AccountReceivablesHandling { + NO_ACTION("no_action"), + + SCHEDULE_PAYMENT_COLLECTION("schedule_payment_collection"), + + WRITE_OFF("write_off"), + + /** + * An enum member indicating that AccountReceivablesHandling was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + AccountReceivablesHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AccountReceivablesHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (AccountReceivablesHandling enumValue : AccountReceivablesHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum RefundableCreditsHandling { + NO_ACTION("no_action"), + + SCHEDULE_REFUND("schedule_refund"), + + /** + * An enum member indicating that RefundableCreditsHandling was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + RefundableCreditsHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static RefundableCreditsHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (RefundableCreditsHandling enumValue : RefundableCreditsHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ContractTermCancelOption { + TERMINATE_IMMEDIATELY("terminate_immediately"), + + END_OF_CONTRACT_TERM("end_of_contract_term"), + + SPECIFIC_DATE("specific_date"), + + END_OF_SUBSCRIPTION_BILLING_TERM("end_of_subscription_billing_term"), + + /** + * An enum member indicating that ContractTermCancelOption was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + ContractTermCancelOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ContractTermCancelOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ContractTermCancelOption enumValue : ContractTermCancelOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class SubscriptionItemsParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer servicePeriodDays; + + private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.servicePeriodDays = builder.servicePeriodDays; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + return formData; + } + + /** Create a new builder for SubscriptionItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionItemsBuilder builder() { + return new SubscriptionItemsBuilder(); + } + + public static final class SubscriptionItemsBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer servicePeriodDays; + + private SubscriptionItemsBuilder() {} + + public SubscriptionItemsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public SubscriptionItemsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public SubscriptionItemsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public SubscriptionItemsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public SubscriptionItemsParams build() { + return new SubscriptionItemsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCancelParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCancelParams.java new file mode 100644 index 00000000..90e69519 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCancelParams.java @@ -0,0 +1,577 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class SubscriptionCancelParams { + + private final CancelOption cancelOption; + + private final Boolean endOfTerm; + + private final Timestamp cancelAt; + + private final CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; + + private final UnbilledChargesOption unbilledChargesOption; + + private final AccountReceivablesHandling accountReceivablesHandling; + + private final RefundableCreditsHandling refundableCreditsHandling; + + private final ContractTermCancelOption contractTermCancelOption; + + private final Timestamp invoiceDate; + + private final String cancelReasonCode; + + private final List eventBasedAddons; + + private SubscriptionCancelParams(SubscriptionCancelBuilder builder) { + + this.cancelOption = builder.cancelOption; + + this.endOfTerm = builder.endOfTerm; + + this.cancelAt = builder.cancelAt; + + this.creditOptionForCurrentTermCharges = builder.creditOptionForCurrentTermCharges; + + this.unbilledChargesOption = builder.unbilledChargesOption; + + this.accountReceivablesHandling = builder.accountReceivablesHandling; + + this.refundableCreditsHandling = builder.refundableCreditsHandling; + + this.contractTermCancelOption = builder.contractTermCancelOption; + + this.invoiceDate = builder.invoiceDate; + + this.cancelReasonCode = builder.cancelReasonCode; + + this.eventBasedAddons = builder.eventBasedAddons; + } + + public CancelOption getCancelOption() { + return cancelOption; + } + + public Boolean getEndOfTerm() { + return endOfTerm; + } + + public Timestamp getCancelAt() { + return cancelAt; + } + + public CreditOptionForCurrentTermCharges getCreditOptionForCurrentTermCharges() { + return creditOptionForCurrentTermCharges; + } + + public UnbilledChargesOption getUnbilledChargesOption() { + return unbilledChargesOption; + } + + public AccountReceivablesHandling getAccountReceivablesHandling() { + return accountReceivablesHandling; + } + + public RefundableCreditsHandling getRefundableCreditsHandling() { + return refundableCreditsHandling; + } + + public ContractTermCancelOption getContractTermCancelOption() { + return contractTermCancelOption; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public String getCancelReasonCode() { + return cancelReasonCode; + } + + public List getEventBasedAddons() { + return eventBasedAddons; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.cancelOption != null) { + + formData.put("cancel_option", this.cancelOption); + } + + if (this.endOfTerm != null) { + + formData.put("end_of_term", this.endOfTerm); + } + + if (this.cancelAt != null) { + + formData.put("cancel_at", this.cancelAt); + } + + if (this.creditOptionForCurrentTermCharges != null) { + + formData.put( + "credit_option_for_current_term_charges", this.creditOptionForCurrentTermCharges); + } + + if (this.unbilledChargesOption != null) { + + formData.put("unbilled_charges_option", this.unbilledChargesOption); + } + + if (this.accountReceivablesHandling != null) { + + formData.put("account_receivables_handling", this.accountReceivablesHandling); + } + + if (this.refundableCreditsHandling != null) { + + formData.put("refundable_credits_handling", this.refundableCreditsHandling); + } + + if (this.contractTermCancelOption != null) { + + formData.put("contract_term_cancel_option", this.contractTermCancelOption); + } + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.cancelReasonCode != null) { + + formData.put("cancel_reason_code", this.cancelReasonCode); + } + + if (this.eventBasedAddons != null) { + + // List of objects + for (int i = 0; i < this.eventBasedAddons.size(); i++) { + EventBasedAddonsParams item = this.eventBasedAddons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for SubscriptionCancelParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionCancelBuilder builder() { + return new SubscriptionCancelBuilder(); + } + + public static final class SubscriptionCancelBuilder { + + private CancelOption cancelOption; + + private Boolean endOfTerm; + + private Timestamp cancelAt; + + private CreditOptionForCurrentTermCharges creditOptionForCurrentTermCharges; + + private UnbilledChargesOption unbilledChargesOption; + + private AccountReceivablesHandling accountReceivablesHandling; + + private RefundableCreditsHandling refundableCreditsHandling; + + private ContractTermCancelOption contractTermCancelOption; + + private Timestamp invoiceDate; + + private String cancelReasonCode; + + private List eventBasedAddons; + + private SubscriptionCancelBuilder() {} + + public SubscriptionCancelBuilder cancelOption(CancelOption value) { + this.cancelOption = value; + return this; + } + + public SubscriptionCancelBuilder endOfTerm(Boolean value) { + this.endOfTerm = value; + return this; + } + + public SubscriptionCancelBuilder cancelAt(Timestamp value) { + this.cancelAt = value; + return this; + } + + public SubscriptionCancelBuilder creditOptionForCurrentTermCharges( + CreditOptionForCurrentTermCharges value) { + this.creditOptionForCurrentTermCharges = value; + return this; + } + + public SubscriptionCancelBuilder unbilledChargesOption(UnbilledChargesOption value) { + this.unbilledChargesOption = value; + return this; + } + + public SubscriptionCancelBuilder accountReceivablesHandling(AccountReceivablesHandling value) { + this.accountReceivablesHandling = value; + return this; + } + + public SubscriptionCancelBuilder refundableCreditsHandling(RefundableCreditsHandling value) { + this.refundableCreditsHandling = value; + return this; + } + + public SubscriptionCancelBuilder contractTermCancelOption(ContractTermCancelOption value) { + this.contractTermCancelOption = value; + return this; + } + + public SubscriptionCancelBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public SubscriptionCancelBuilder cancelReasonCode(String value) { + this.cancelReasonCode = value; + return this; + } + + public SubscriptionCancelBuilder eventBasedAddons(List value) { + this.eventBasedAddons = value; + return this; + } + + public SubscriptionCancelParams build() { + return new SubscriptionCancelParams(this); + } + } + + public enum CancelOption { + IMMEDIATELY("immediately"), + + END_OF_TERM("end_of_term"), + + SPECIFIC_DATE("specific_date"), + + END_OF_BILLING_TERM("end_of_billing_term"), + + /** An enum member indicating that CancelOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + CancelOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CancelOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (CancelOption enumValue : CancelOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum CreditOptionForCurrentTermCharges { + NONE("none"), + + PRORATE("prorate"), + + FULL("full"), + + /** + * An enum member indicating that CreditOptionForCurrentTermCharges was instantiated with an + * unknown value. + */ + _UNKNOWN(null); + private final String value; + + CreditOptionForCurrentTermCharges(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static CreditOptionForCurrentTermCharges fromString(String value) { + if (value == null) return _UNKNOWN; + for (CreditOptionForCurrentTermCharges enumValue : + CreditOptionForCurrentTermCharges.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum UnbilledChargesOption { + INVOICE("invoice"), + + DELETE("delete"), + + /** + * An enum member indicating that UnbilledChargesOption was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + UnbilledChargesOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static UnbilledChargesOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (UnbilledChargesOption enumValue : UnbilledChargesOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum AccountReceivablesHandling { + NO_ACTION("no_action"), + + SCHEDULE_PAYMENT_COLLECTION("schedule_payment_collection"), + + WRITE_OFF("write_off"), + + /** + * An enum member indicating that AccountReceivablesHandling was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + AccountReceivablesHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AccountReceivablesHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (AccountReceivablesHandling enumValue : AccountReceivablesHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum RefundableCreditsHandling { + NO_ACTION("no_action"), + + SCHEDULE_REFUND("schedule_refund"), + + /** + * An enum member indicating that RefundableCreditsHandling was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + RefundableCreditsHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static RefundableCreditsHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (RefundableCreditsHandling enumValue : RefundableCreditsHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ContractTermCancelOption { + TERMINATE_IMMEDIATELY("terminate_immediately"), + + END_OF_CONTRACT_TERM("end_of_contract_term"), + + SPECIFIC_DATE("specific_date"), + + END_OF_SUBSCRIPTION_BILLING_TERM("end_of_subscription_billing_term"), + + /** + * An enum member indicating that ContractTermCancelOption was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + ContractTermCancelOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ContractTermCancelOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ContractTermCancelOption enumValue : ContractTermCancelOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class EventBasedAddonsParams { + + private final String id; + + private final Integer quantity; + + private final Long unitPrice; + + private final Integer servicePeriodInDays; + + private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.unitPrice = builder.unitPrice; + + this.servicePeriodInDays = builder.servicePeriodInDays; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public Integer getServicePeriodInDays() { + return servicePeriodInDays; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.servicePeriodInDays != null) { + + formData.put("service_period_in_days", this.servicePeriodInDays); + } + + return formData; + } + + /** Create a new builder for EventBasedAddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EventBasedAddonsBuilder builder() { + return new EventBasedAddonsBuilder(); + } + + public static final class EventBasedAddonsBuilder { + + private String id; + + private Integer quantity; + + private Long unitPrice; + + private Integer servicePeriodInDays; + + private EventBasedAddonsBuilder() {} + + public EventBasedAddonsBuilder id(String value) { + this.id = value; + return this; + } + + public EventBasedAddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public EventBasedAddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { + this.servicePeriodInDays = value; + return this; + } + + public EventBasedAddonsParams build() { + return new EventBasedAddonsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionChangeTermEndParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionChangeTermEndParams.java new file mode 100644 index 00000000..f3ef252a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionChangeTermEndParams.java @@ -0,0 +1,101 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class SubscriptionChangeTermEndParams { + + private final Timestamp termEndsAt; + + private final Boolean prorate; + + private final Boolean invoiceImmediately; + + private SubscriptionChangeTermEndParams(SubscriptionChangeTermEndBuilder builder) { + + this.termEndsAt = builder.termEndsAt; + + this.prorate = builder.prorate; + + this.invoiceImmediately = builder.invoiceImmediately; + } + + public Timestamp getTermEndsAt() { + return termEndsAt; + } + + public Boolean getProrate() { + return prorate; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.termEndsAt != null) { + + formData.put("term_ends_at", this.termEndsAt); + } + + if (this.prorate != null) { + + formData.put("prorate", this.prorate); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + return formData; + } + + /** Create a new builder for SubscriptionChangeTermEndParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionChangeTermEndBuilder builder() { + return new SubscriptionChangeTermEndBuilder(); + } + + public static final class SubscriptionChangeTermEndBuilder { + + private Timestamp termEndsAt; + + private Boolean prorate; + + private Boolean invoiceImmediately; + + private SubscriptionChangeTermEndBuilder() {} + + public SubscriptionChangeTermEndBuilder termEndsAt(Timestamp value) { + this.termEndsAt = value; + return this; + } + + public SubscriptionChangeTermEndBuilder prorate(Boolean value) { + this.prorate = value; + return this; + } + + public SubscriptionChangeTermEndBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public SubscriptionChangeTermEndParams build() { + return new SubscriptionChangeTermEndParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionChargeAddonAtTermEndParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionChargeAddonAtTermEndParams.java new file mode 100644 index 00000000..de9dd9d4 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionChargeAddonAtTermEndParams.java @@ -0,0 +1,181 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class SubscriptionChargeAddonAtTermEndParams { + + private final String addonId; + + private final Integer addonQuantity; + + private final Long addonUnitPrice; + + private final String addonQuantityInDecimal; + + private final String addonUnitPriceInDecimal; + + private final Timestamp dateFrom; + + private final Timestamp dateTo; + + private SubscriptionChargeAddonAtTermEndParams(SubscriptionChargeAddonAtTermEndBuilder builder) { + + this.addonId = builder.addonId; + + this.addonQuantity = builder.addonQuantity; + + this.addonUnitPrice = builder.addonUnitPrice; + + this.addonQuantityInDecimal = builder.addonQuantityInDecimal; + + this.addonUnitPriceInDecimal = builder.addonUnitPriceInDecimal; + + this.dateFrom = builder.dateFrom; + + this.dateTo = builder.dateTo; + } + + public String getAddonId() { + return addonId; + } + + public Integer getAddonQuantity() { + return addonQuantity; + } + + public Long getAddonUnitPrice() { + return addonUnitPrice; + } + + public String getAddonQuantityInDecimal() { + return addonQuantityInDecimal; + } + + public String getAddonUnitPriceInDecimal() { + return addonUnitPriceInDecimal; + } + + public Timestamp getDateFrom() { + return dateFrom; + } + + public Timestamp getDateTo() { + return dateTo; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.addonId != null) { + + formData.put("addon_id", this.addonId); + } + + if (this.addonQuantity != null) { + + formData.put("addon_quantity", this.addonQuantity); + } + + if (this.addonUnitPrice != null) { + + formData.put("addon_unit_price", this.addonUnitPrice); + } + + if (this.addonQuantityInDecimal != null) { + + formData.put("addon_quantity_in_decimal", this.addonQuantityInDecimal); + } + + if (this.addonUnitPriceInDecimal != null) { + + formData.put("addon_unit_price_in_decimal", this.addonUnitPriceInDecimal); + } + + if (this.dateFrom != null) { + + formData.put("date_from", this.dateFrom); + } + + if (this.dateTo != null) { + + formData.put("date_to", this.dateTo); + } + + return formData; + } + + /** Create a new builder for SubscriptionChargeAddonAtTermEndParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionChargeAddonAtTermEndBuilder builder() { + return new SubscriptionChargeAddonAtTermEndBuilder(); + } + + public static final class SubscriptionChargeAddonAtTermEndBuilder { + + private String addonId; + + private Integer addonQuantity; + + private Long addonUnitPrice; + + private String addonQuantityInDecimal; + + private String addonUnitPriceInDecimal; + + private Timestamp dateFrom; + + private Timestamp dateTo; + + private SubscriptionChargeAddonAtTermEndBuilder() {} + + public SubscriptionChargeAddonAtTermEndBuilder addonId(String value) { + this.addonId = value; + return this; + } + + public SubscriptionChargeAddonAtTermEndBuilder addonQuantity(Integer value) { + this.addonQuantity = value; + return this; + } + + public SubscriptionChargeAddonAtTermEndBuilder addonUnitPrice(Long value) { + this.addonUnitPrice = value; + return this; + } + + public SubscriptionChargeAddonAtTermEndBuilder addonQuantityInDecimal(String value) { + this.addonQuantityInDecimal = value; + return this; + } + + public SubscriptionChargeAddonAtTermEndBuilder addonUnitPriceInDecimal(String value) { + this.addonUnitPriceInDecimal = value; + return this; + } + + public SubscriptionChargeAddonAtTermEndBuilder dateFrom(Timestamp value) { + this.dateFrom = value; + return this; + } + + public SubscriptionChargeAddonAtTermEndBuilder dateTo(Timestamp value) { + this.dateTo = value; + return this; + } + + public SubscriptionChargeAddonAtTermEndParams build() { + return new SubscriptionChargeAddonAtTermEndParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionChargeFutureRenewalsParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionChargeFutureRenewalsParams.java new file mode 100644 index 00000000..19b281c1 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionChargeFutureRenewalsParams.java @@ -0,0 +1,395 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class SubscriptionChargeFutureRenewalsParams { + + private final Integer termsToCharge; + + private final Boolean invoiceImmediately; + + private final ScheduleType scheduleType; + + private final FixedIntervalScheduleParams fixedIntervalSchedule; + + private final List specificDatesSchedule; + + private SubscriptionChargeFutureRenewalsParams(SubscriptionChargeFutureRenewalsBuilder builder) { + + this.termsToCharge = builder.termsToCharge; + + this.invoiceImmediately = builder.invoiceImmediately; + + this.scheduleType = builder.scheduleType; + + this.fixedIntervalSchedule = builder.fixedIntervalSchedule; + + this.specificDatesSchedule = builder.specificDatesSchedule; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + public ScheduleType getScheduleType() { + return scheduleType; + } + + public FixedIntervalScheduleParams getFixedIntervalSchedule() { + return fixedIntervalSchedule; + } + + public List getSpecificDatesSchedule() { + return specificDatesSchedule; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + if (this.scheduleType != null) { + + formData.put("schedule_type", this.scheduleType); + } + + if (this.fixedIntervalSchedule != null) { + + // Single object + Map nestedData = this.fixedIntervalSchedule.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "fixed_interval_schedule[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.specificDatesSchedule != null) { + + // List of objects + for (int i = 0; i < this.specificDatesSchedule.size(); i++) { + SpecificDatesScheduleParams item = this.specificDatesSchedule.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "specific_dates_schedule[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for SubscriptionChargeFutureRenewalsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionChargeFutureRenewalsBuilder builder() { + return new SubscriptionChargeFutureRenewalsBuilder(); + } + + public static final class SubscriptionChargeFutureRenewalsBuilder { + + private Integer termsToCharge; + + private Boolean invoiceImmediately; + + private ScheduleType scheduleType; + + private FixedIntervalScheduleParams fixedIntervalSchedule; + + private List specificDatesSchedule; + + private SubscriptionChargeFutureRenewalsBuilder() {} + + public SubscriptionChargeFutureRenewalsBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public SubscriptionChargeFutureRenewalsBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public SubscriptionChargeFutureRenewalsBuilder scheduleType(ScheduleType value) { + this.scheduleType = value; + return this; + } + + public SubscriptionChargeFutureRenewalsBuilder fixedIntervalSchedule( + FixedIntervalScheduleParams value) { + this.fixedIntervalSchedule = value; + return this; + } + + public SubscriptionChargeFutureRenewalsBuilder specificDatesSchedule( + List value) { + this.specificDatesSchedule = value; + return this; + } + + public SubscriptionChargeFutureRenewalsParams build() { + return new SubscriptionChargeFutureRenewalsParams(this); + } + } + + public enum ScheduleType { + IMMEDIATE("immediate"), + + SPECIFIC_DATES("specific_dates"), + + FIXED_INTERVALS("fixed_intervals"), + + /** An enum member indicating that ScheduleType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ScheduleType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ScheduleType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ScheduleType enumValue : ScheduleType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class FixedIntervalScheduleParams { + + private final Integer numberOfOccurrences; + + private final Integer daysBeforeRenewal; + + private final EndScheduleOn endScheduleOn; + + private final Timestamp endDate; + + private FixedIntervalScheduleParams(FixedIntervalScheduleBuilder builder) { + + this.numberOfOccurrences = builder.numberOfOccurrences; + + this.daysBeforeRenewal = builder.daysBeforeRenewal; + + this.endScheduleOn = builder.endScheduleOn; + + this.endDate = builder.endDate; + } + + public Integer getNumberOfOccurrences() { + return numberOfOccurrences; + } + + public Integer getDaysBeforeRenewal() { + return daysBeforeRenewal; + } + + public EndScheduleOn getEndScheduleOn() { + return endScheduleOn; + } + + public Timestamp getEndDate() { + return endDate; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.numberOfOccurrences != null) { + + formData.put("number_of_occurrences", this.numberOfOccurrences); + } + + if (this.daysBeforeRenewal != null) { + + formData.put("days_before_renewal", this.daysBeforeRenewal); + } + + if (this.endScheduleOn != null) { + + formData.put("end_schedule_on", this.endScheduleOn); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + return formData; + } + + /** Create a new builder for FixedIntervalScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static FixedIntervalScheduleBuilder builder() { + return new FixedIntervalScheduleBuilder(); + } + + public static final class FixedIntervalScheduleBuilder { + + private Integer numberOfOccurrences; + + private Integer daysBeforeRenewal; + + private EndScheduleOn endScheduleOn; + + private Timestamp endDate; + + private FixedIntervalScheduleBuilder() {} + + public FixedIntervalScheduleBuilder numberOfOccurrences(Integer value) { + this.numberOfOccurrences = value; + return this; + } + + public FixedIntervalScheduleBuilder daysBeforeRenewal(Integer value) { + this.daysBeforeRenewal = value; + return this; + } + + public FixedIntervalScheduleBuilder endScheduleOn(EndScheduleOn value) { + this.endScheduleOn = value; + return this; + } + + public FixedIntervalScheduleBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public FixedIntervalScheduleParams build() { + return new FixedIntervalScheduleParams(this); + } + } + + public enum EndScheduleOn { + AFTER_NUMBER_OF_INTERVALS("after_number_of_intervals"), + + SPECIFIC_DATE("specific_date"), + + SUBSCRIPTION_END("subscription_end"), + + /** An enum member indicating that EndScheduleOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + EndScheduleOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EndScheduleOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (EndScheduleOn enumValue : EndScheduleOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class SpecificDatesScheduleParams { + + private final Integer termsToCharge; + + private final Timestamp date; + + private SpecificDatesScheduleParams(SpecificDatesScheduleBuilder builder) { + + this.termsToCharge = builder.termsToCharge; + + this.date = builder.date; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public Timestamp getDate() { + return date; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.date != null) { + + formData.put("date", this.date); + } + + return formData; + } + + /** Create a new builder for SpecificDatesScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SpecificDatesScheduleBuilder builder() { + return new SpecificDatesScheduleBuilder(); + } + + public static final class SpecificDatesScheduleBuilder { + + private Integer termsToCharge; + + private Timestamp date; + + private SpecificDatesScheduleBuilder() {} + + public SpecificDatesScheduleBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public SpecificDatesScheduleBuilder date(Timestamp value) { + this.date = value; + return this; + } + + public SpecificDatesScheduleParams build() { + return new SpecificDatesScheduleParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateForCustomerParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateForCustomerParams.java new file mode 100644 index 00000000..a6afa4ab --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateForCustomerParams.java @@ -0,0 +1,2331 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class SubscriptionCreateForCustomerParams { + + private final String id; + + private final String planId; + + private final Integer planQuantity; + + private final String planQuantityInDecimal; + + private final Long planUnitPrice; + + private final String planUnitPriceInDecimal; + + private final Long setupFee; + + private final Timestamp trialEnd; + + private final Integer billingCycles; + + private final List mandatoryAddonsToRemove; + + private final Timestamp startDate; + + private final String coupon; + + private final AutoCollection autoCollection; + + private final Integer termsToCharge; + + private final BillingAlignmentMode billingAlignmentMode; + + private final OfflinePaymentMethod offlinePaymentMethod; + + private final String poNumber; + + private final List couponIds; + + private final String paymentSourceId; + + private final Boolean overrideRelationship; + + private final String invoiceNotes; + + private final Timestamp invoiceDate; + + private final java.util.Map metaData; + + private final Boolean invoiceImmediately; + + private final Boolean replacePrimaryPaymentSource; + + private final Integer freePeriod; + + private final FreePeriodUnit freePeriodUnit; + + private final Integer contractTermBillingCycleOnRenewal; + + private final TrialEndAction trialEndAction; + + private final PaymentInitiator paymentInitiator; + + private final ShippingAddressParams shippingAddress; + + private final StatementDescriptorParams statementDescriptor; + + private final PaymentIntentParams paymentIntent; + + private final ContractTermParams contractTerm; + + private final List addons; + + private final List eventBasedAddons; + + private final List coupons; + + private final Map customFields; + + private SubscriptionCreateForCustomerParams(SubscriptionCreateForCustomerBuilder builder) { + + this.id = builder.id; + + this.planId = builder.planId; + + this.planQuantity = builder.planQuantity; + + this.planQuantityInDecimal = builder.planQuantityInDecimal; + + this.planUnitPrice = builder.planUnitPrice; + + this.planUnitPriceInDecimal = builder.planUnitPriceInDecimal; + + this.setupFee = builder.setupFee; + + this.trialEnd = builder.trialEnd; + + this.billingCycles = builder.billingCycles; + + this.mandatoryAddonsToRemove = builder.mandatoryAddonsToRemove; + + this.startDate = builder.startDate; + + this.coupon = builder.coupon; + + this.autoCollection = builder.autoCollection; + + this.termsToCharge = builder.termsToCharge; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.offlinePaymentMethod = builder.offlinePaymentMethod; + + this.poNumber = builder.poNumber; + + this.couponIds = builder.couponIds; + + this.paymentSourceId = builder.paymentSourceId; + + this.overrideRelationship = builder.overrideRelationship; + + this.invoiceNotes = builder.invoiceNotes; + + this.invoiceDate = builder.invoiceDate; + + this.metaData = builder.metaData; + + this.invoiceImmediately = builder.invoiceImmediately; + + this.replacePrimaryPaymentSource = builder.replacePrimaryPaymentSource; + + this.freePeriod = builder.freePeriod; + + this.freePeriodUnit = builder.freePeriodUnit; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + + this.trialEndAction = builder.trialEndAction; + + this.paymentInitiator = builder.paymentInitiator; + + this.shippingAddress = builder.shippingAddress; + + this.statementDescriptor = builder.statementDescriptor; + + this.paymentIntent = builder.paymentIntent; + + this.contractTerm = builder.contractTerm; + + this.addons = builder.addons; + + this.eventBasedAddons = builder.eventBasedAddons; + + this.coupons = builder.coupons; + + this.customFields = + builder.customFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); + } + + public String getId() { + return id; + } + + public String getPlanId() { + return planId; + } + + public Integer getPlanQuantity() { + return planQuantity; + } + + public String getPlanQuantityInDecimal() { + return planQuantityInDecimal; + } + + public Long getPlanUnitPrice() { + return planUnitPrice; + } + + public String getPlanUnitPriceInDecimal() { + return planUnitPriceInDecimal; + } + + public Long getSetupFee() { + return setupFee; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public List getMandatoryAddonsToRemove() { + return mandatoryAddonsToRemove; + } + + public Timestamp getStartDate() { + return startDate; + } + + public String getCoupon() { + return coupon; + } + + public AutoCollection getAutoCollection() { + return autoCollection; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public OfflinePaymentMethod getOfflinePaymentMethod() { + return offlinePaymentMethod; + } + + public String getPoNumber() { + return poNumber; + } + + public List getCouponIds() { + return couponIds; + } + + public String getPaymentSourceId() { + return paymentSourceId; + } + + public Boolean getOverrideRelationship() { + return overrideRelationship; + } + + public String getInvoiceNotes() { + return invoiceNotes; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public java.util.Map getMetaData() { + return metaData; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + public Boolean getReplacePrimaryPaymentSource() { + return replacePrimaryPaymentSource; + } + + public Integer getFreePeriod() { + return freePeriod; + } + + public FreePeriodUnit getFreePeriodUnit() { + return freePeriodUnit; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + public TrialEndAction getTrialEndAction() { + return trialEndAction; + } + + public PaymentInitiator getPaymentInitiator() { + return paymentInitiator; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public StatementDescriptorParams getStatementDescriptor() { + return statementDescriptor; + } + + public PaymentIntentParams getPaymentIntent() { + return paymentIntent; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public List getAddons() { + return addons; + } + + public List getEventBasedAddons() { + return eventBasedAddons; + } + + public List getCoupons() { + return coupons; + } + + public Map customFields() { + return customFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.planId != null) { + + formData.put("plan_id", this.planId); + } + + if (this.planQuantity != null) { + + formData.put("plan_quantity", this.planQuantity); + } + + if (this.planQuantityInDecimal != null) { + + formData.put("plan_quantity_in_decimal", this.planQuantityInDecimal); + } + + if (this.planUnitPrice != null) { + + formData.put("plan_unit_price", this.planUnitPrice); + } + + if (this.planUnitPriceInDecimal != null) { + + formData.put("plan_unit_price_in_decimal", this.planUnitPriceInDecimal); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.mandatoryAddonsToRemove != null) { + + formData.put("mandatory_addons_to_remove", this.mandatoryAddonsToRemove); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.coupon != null) { + + formData.put("coupon", this.coupon); + } + + if (this.autoCollection != null) { + + formData.put("auto_collection", this.autoCollection); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.offlinePaymentMethod != null) { + + formData.put("offline_payment_method", this.offlinePaymentMethod); + } + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.paymentSourceId != null) { + + formData.put("payment_source_id", this.paymentSourceId); + } + + if (this.overrideRelationship != null) { + + formData.put("override_relationship", this.overrideRelationship); + } + + if (this.invoiceNotes != null) { + + formData.put("invoice_notes", this.invoiceNotes); + } + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.metaData != null) { + + formData.put("meta_data", JsonUtil.toJson(this.metaData)); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + if (this.replacePrimaryPaymentSource != null) { + + formData.put("replace_primary_payment_source", this.replacePrimaryPaymentSource); + } + + if (this.freePeriod != null) { + + formData.put("free_period", this.freePeriod); + } + + if (this.freePeriodUnit != null) { + + formData.put("free_period_unit", this.freePeriodUnit); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + if (this.trialEndAction != null) { + + formData.put("trial_end_action", this.trialEndAction); + } + + if (this.paymentInitiator != null) { + + formData.put("payment_initiator", this.paymentInitiator); + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.statementDescriptor != null) { + + // Single object + Map nestedData = this.statementDescriptor.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "statement_descriptor[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.paymentIntent != null) { + + // Single object + Map nestedData = this.paymentIntent.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "payment_intent[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.addons != null) { + + // List of objects + for (int i = 0; i < this.addons.size(); i++) { + AddonsParams item = this.addons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.eventBasedAddons != null) { + + // List of objects + for (int i = 0; i < this.eventBasedAddons.size(); i++) { + EventBasedAddonsParams item = this.eventBasedAddons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.coupons != null) { + + // List of objects + for (int i = 0; i < this.coupons.size(); i++) { + CouponsParams item = this.coupons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(customFields); + + return formData; + } + + /** Create a new builder for SubscriptionCreateForCustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionCreateForCustomerBuilder builder() { + return new SubscriptionCreateForCustomerBuilder(); + } + + public static final class SubscriptionCreateForCustomerBuilder { + + private String id; + + private String planId; + + private Integer planQuantity; + + private String planQuantityInDecimal; + + private Long planUnitPrice; + + private String planUnitPriceInDecimal; + + private Long setupFee; + + private Timestamp trialEnd; + + private Integer billingCycles; + + private List mandatoryAddonsToRemove; + + private Timestamp startDate; + + private String coupon; + + private AutoCollection autoCollection; + + private Integer termsToCharge; + + private BillingAlignmentMode billingAlignmentMode; + + private OfflinePaymentMethod offlinePaymentMethod; + + private String poNumber; + + private List couponIds; + + private String paymentSourceId; + + private Boolean overrideRelationship; + + private String invoiceNotes; + + private Timestamp invoiceDate; + + private java.util.Map metaData; + + private Boolean invoiceImmediately; + + private Boolean replacePrimaryPaymentSource; + + private Integer freePeriod; + + private FreePeriodUnit freePeriodUnit; + + private Integer contractTermBillingCycleOnRenewal; + + private TrialEndAction trialEndAction; + + private PaymentInitiator paymentInitiator; + + private ShippingAddressParams shippingAddress; + + private StatementDescriptorParams statementDescriptor; + + private PaymentIntentParams paymentIntent; + + private ContractTermParams contractTerm; + + private List addons; + + private List eventBasedAddons; + + private List coupons; + + private Map customFields = new LinkedHashMap<>(); + + private SubscriptionCreateForCustomerBuilder() {} + + public SubscriptionCreateForCustomerBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder planId(String value) { + this.planId = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder planQuantity(Integer value) { + this.planQuantity = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder planQuantityInDecimal(String value) { + this.planQuantityInDecimal = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder planUnitPrice(Long value) { + this.planUnitPrice = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder planUnitPriceInDecimal(String value) { + this.planUnitPriceInDecimal = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder mandatoryAddonsToRemove(List value) { + this.mandatoryAddonsToRemove = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + @Deprecated + public SubscriptionCreateForCustomerBuilder coupon(String value) { + this.coupon = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder autoCollection(AutoCollection value) { + this.autoCollection = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder billingAlignmentMode(BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + this.offlinePaymentMethod = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder paymentSourceId(String value) { + this.paymentSourceId = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder overrideRelationship(Boolean value) { + this.overrideRelationship = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder invoiceNotes(String value) { + this.invoiceNotes = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder metaData(java.util.Map value) { + this.metaData = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder replacePrimaryPaymentSource(Boolean value) { + this.replacePrimaryPaymentSource = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder freePeriod(Integer value) { + this.freePeriod = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder freePeriodUnit(FreePeriodUnit value) { + this.freePeriodUnit = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder trialEndAction(TrialEndAction value) { + this.trialEndAction = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder paymentInitiator(PaymentInitiator value) { + this.paymentInitiator = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder statementDescriptor( + StatementDescriptorParams value) { + this.statementDescriptor = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder paymentIntent(PaymentIntentParams value) { + this.paymentIntent = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder addons(List value) { + this.addons = value; + return this; + } + + public SubscriptionCreateForCustomerBuilder eventBasedAddons( + List value) { + this.eventBasedAddons = value; + return this; + } + + @Deprecated + public SubscriptionCreateForCustomerBuilder coupons(List value) { + this.coupons = value; + return this; + } + + /** + * Add a custom field to the request. Custom fields must start with "cf_". + * + * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") + * @param value the value of the custom field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cf_" + */ + public SubscriptionCreateForCustomerBuilder customField(String fieldName, String value) { + if (fieldName == null || !fieldName.startsWith("cf_")) { + throw new IllegalArgumentException("Custom field name must start with 'cf_'"); + } + this.customFields.put(fieldName, value); + return this; + } + + /** + * Add multiple custom fields to the request. All field names must start with "cf_". + * + * @param customFields map of custom field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cf_" + */ + public SubscriptionCreateForCustomerBuilder customFields(Map customFields) { + if (customFields != null) { + for (Map.Entry entry : customFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { + throw new IllegalArgumentException( + "Custom field name must start with 'cf_': " + entry.getKey()); + } + this.customFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public SubscriptionCreateForCustomerParams build() { + return new SubscriptionCreateForCustomerParams(this); + } + } + + public enum AutoCollection { + ON("on"), + + OFF("off"), + + /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AutoCollection(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AutoCollection fromString(String value) { + if (value == null) return _UNKNOWN; + for (AutoCollection enumValue : AutoCollection.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum FreePeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + FreePeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static FreePeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum TrialEndAction { + SITE_DEFAULT("site_default"), + + PLAN_DEFAULT("plan_default"), + + ACTIVATE_SUBSCRIPTION("activate_subscription"), + + CANCEL_SUBSCRIPTION("cancel_subscription"), + + /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + TrialEndAction(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static TrialEndAction fromString(String value) { + if (value == null) return _UNKNOWN; + for (TrialEndAction enumValue : TrialEndAction.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PaymentInitiator { + CUSTOMER("customer"), + + MERCHANT("merchant"), + + /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentInitiator(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentInitiator fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentInitiator enumValue : PaymentInitiator.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class StatementDescriptorParams { + + private final String descriptor; + + private StatementDescriptorParams(StatementDescriptorBuilder builder) { + + this.descriptor = builder.descriptor; + } + + public String getDescriptor() { + return descriptor; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.descriptor != null) { + + formData.put("descriptor", this.descriptor); + } + + return formData; + } + + /** Create a new builder for StatementDescriptorParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static StatementDescriptorBuilder builder() { + return new StatementDescriptorBuilder(); + } + + public static final class StatementDescriptorBuilder { + + private String descriptor; + + private StatementDescriptorBuilder() {} + + public StatementDescriptorBuilder descriptor(String value) { + this.descriptor = value; + return this; + } + + public StatementDescriptorParams build() { + return new StatementDescriptorParams(this); + } + } + } + + public static final class PaymentIntentParams { + + private final String id; + + private final String gatewayAccountId; + + private final String gwToken; + + private final PaymentMethodType paymentMethodType; + + private final String referenceId; + + private final String gwPaymentMethodId; + + private final java.util.Map additionalInformation; + + private PaymentIntentParams(PaymentIntentBuilder builder) { + + this.id = builder.id; + + this.gatewayAccountId = builder.gatewayAccountId; + + this.gwToken = builder.gwToken; + + this.paymentMethodType = builder.paymentMethodType; + + this.referenceId = builder.referenceId; + + this.gwPaymentMethodId = builder.gwPaymentMethodId; + + this.additionalInformation = builder.additionalInformation; + } + + public String getId() { + return id; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getGwToken() { + return gwToken; + } + + public PaymentMethodType getPaymentMethodType() { + return paymentMethodType; + } + + public String getReferenceId() { + return referenceId; + } + + public String getGwPaymentMethodId() { + return gwPaymentMethodId; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.gwToken != null) { + + formData.put("gw_token", this.gwToken); + } + + if (this.paymentMethodType != null) { + + formData.put("payment_method_type", this.paymentMethodType); + } + + if (this.referenceId != null) { + + formData.put("reference_id", this.referenceId); + } + + if (this.gwPaymentMethodId != null) { + + formData.put("gw_payment_method_id", this.gwPaymentMethodId); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for PaymentIntentParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentIntentBuilder builder() { + return new PaymentIntentBuilder(); + } + + public static final class PaymentIntentBuilder { + + private String id; + + private String gatewayAccountId; + + private String gwToken; + + private PaymentMethodType paymentMethodType; + + private String referenceId; + + private String gwPaymentMethodId; + + private java.util.Map additionalInformation; + + private PaymentIntentBuilder() {} + + public PaymentIntentBuilder id(String value) { + this.id = value; + return this; + } + + public PaymentIntentBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public PaymentIntentBuilder gwToken(String value) { + this.gwToken = value; + return this; + } + + public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { + this.paymentMethodType = value; + return this; + } + + public PaymentIntentBuilder referenceId(String value) { + this.referenceId = value; + return this; + } + + @Deprecated + public PaymentIntentBuilder gwPaymentMethodId(String value) { + this.gwPaymentMethodId = value; + return this; + } + + public PaymentIntentBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public PaymentIntentParams build() { + return new PaymentIntentParams(this); + } + } + + public enum PaymentMethodType { + CARD("card"), + + IDEAL("ideal"), + + SOFORT("sofort"), + + BANCONTACT("bancontact"), + + GOOGLE_PAY("google_pay"), + + DOTPAY("dotpay"), + + GIROPAY("giropay"), + + APPLE_PAY("apple_pay"), + + UPI("upi"), + + NETBANKING_EMANDATES("netbanking_emandates"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + DIRECT_DEBIT("direct_debit"), + + BOLETO("boleto"), + + VENMO("venmo"), + + AMAZON_PAYMENTS("amazon_payments"), + + PAY_TO("pay_to"), + + FASTER_PAYMENTS("faster_payments"), + + SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), + + KLARNA_PAY_NOW("klarna_pay_now"), + + ONLINE_BANKING_POLAND("online_banking_poland"), + + PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), + + ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), + + KBC_PAYMENT_BUTTON("kbc_payment_button"), + + PAY_BY_BANK("pay_by_bank"), + + TRUSTLY("trustly"), + + STABLECOIN("stablecoin"), + + /** + * An enum member indicating that PaymentMethodType was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + PaymentMethodType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethodType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethodType enumValue : PaymentMethodType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class AddonsParams { + + private final String id; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Timestamp trialEnd; + + private AddonsParams(AddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.trialEnd = builder.trialEnd; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + return formData; + } + + /** Create a new builder for AddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddonsBuilder builder() { + return new AddonsBuilder(); + } + + public static final class AddonsBuilder { + + private String id; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Timestamp trialEnd; + + private AddonsBuilder() {} + + public AddonsBuilder id(String value) { + this.id = value; + return this; + } + + public AddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public AddonsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public AddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public AddonsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public AddonsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public AddonsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public AddonsParams build() { + return new AddonsParams(this); + } + } + } + + public static final class EventBasedAddonsParams { + + private final String id; + + private final Integer quantity; + + private final Long unitPrice; + + private final String quantityInDecimal; + + private final String unitPriceInDecimal; + + private final Integer servicePeriodInDays; + + private final OnEvent onEvent; + + private final Boolean chargeOnce; + + private final ChargeOn chargeOn; + + private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.unitPrice = builder.unitPrice; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.servicePeriodInDays = builder.servicePeriodInDays; + + this.onEvent = builder.onEvent; + + this.chargeOnce = builder.chargeOnce; + + this.chargeOn = builder.chargeOn; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getServicePeriodInDays() { + return servicePeriodInDays; + } + + public OnEvent getOnEvent() { + return onEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ChargeOn getChargeOn() { + return chargeOn; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.servicePeriodInDays != null) { + + formData.put("service_period_in_days", this.servicePeriodInDays); + } + + if (this.onEvent != null) { + + formData.put("on_event", this.onEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.chargeOn != null) { + + formData.put("charge_on", this.chargeOn); + } + + return formData; + } + + /** Create a new builder for EventBasedAddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EventBasedAddonsBuilder builder() { + return new EventBasedAddonsBuilder(); + } + + public static final class EventBasedAddonsBuilder { + + private String id; + + private Integer quantity; + + private Long unitPrice; + + private String quantityInDecimal; + + private String unitPriceInDecimal; + + private Integer servicePeriodInDays; + + private OnEvent onEvent; + + private Boolean chargeOnce; + + private ChargeOn chargeOn; + + private EventBasedAddonsBuilder() {} + + public EventBasedAddonsBuilder id(String value) { + this.id = value; + return this; + } + + public EventBasedAddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public EventBasedAddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public EventBasedAddonsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public EventBasedAddonsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { + this.servicePeriodInDays = value; + return this; + } + + public EventBasedAddonsBuilder onEvent(OnEvent value) { + this.onEvent = value; + return this; + } + + public EventBasedAddonsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public EventBasedAddonsBuilder chargeOn(ChargeOn value) { + this.chargeOn = value; + return this; + } + + public EventBasedAddonsParams build() { + return new EventBasedAddonsParams(this); + } + } + + public enum OnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that OnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + OnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (OnEvent enumValue : OnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOn { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOn enumValue : ChargeOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CouponsParams { + + private final String couponId; + + private final Timestamp applyTill; + + private CouponsParams(CouponsBuilder builder) { + + this.couponId = builder.couponId; + + this.applyTill = builder.applyTill; + } + + public String getCouponId() { + return couponId; + } + + public Timestamp getApplyTill() { + return applyTill; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.couponId != null) { + + formData.put("coupon_id", this.couponId); + } + + if (this.applyTill != null) { + + formData.put("apply_till", this.applyTill); + } + + return formData; + } + + /** Create a new builder for CouponsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponsBuilder builder() { + return new CouponsBuilder(); + } + + public static final class CouponsBuilder { + + private String couponId; + + private Timestamp applyTill; + + private CouponsBuilder() {} + + public CouponsBuilder couponId(String value) { + this.couponId = value; + return this; + } + + public CouponsBuilder applyTill(Timestamp value) { + this.applyTill = value; + return this; + } + + public CouponsParams build() { + return new CouponsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateWithItemsParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateWithItemsParams.java new file mode 100644 index 00000000..3ade7a23 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateWithItemsParams.java @@ -0,0 +1,2985 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class SubscriptionCreateWithItemsParams { + + private final String id; + + private final String businessEntityId; + + private final Timestamp trialEnd; + + private final Integer billingCycles; + + private final Long setupFee; + + private final List mandatoryItemsToRemove; + + private final Integer netTermDays; + + private final Timestamp startDate; + + private final String coupon; + + private final AutoCollection autoCollection; + + private final Integer termsToCharge; + + private final BillingAlignmentMode billingAlignmentMode; + + private final OfflinePaymentMethod offlinePaymentMethod; + + private final String poNumber; + + private final List couponIds; + + private final String paymentSourceId; + + private final Boolean overrideRelationship; + + private final String invoiceNotes; + + private final Timestamp invoiceDate; + + private final java.util.Map metaData; + + private final Boolean invoiceImmediately; + + private final Boolean replacePrimaryPaymentSource; + + private final Integer freePeriod; + + private final FreePeriodUnit freePeriodUnit; + + private final Integer contractTermBillingCycleOnRenewal; + + private final Boolean createPendingInvoices; + + private final Boolean autoCloseInvoices; + + private final Boolean firstInvoicePending; + + private final TrialEndAction trialEndAction; + + private final PaymentInitiator paymentInitiator; + + private final ShippingAddressParams shippingAddress; + + private final StatementDescriptorParams statementDescriptor; + + private final PaymentIntentParams paymentIntent; + + private final ContractTermParams contractTerm; + + private final BillingOverrideParams billingOverride; + + private final List subscriptionItems; + + private final List discounts; + + private final List itemTiers; + + private final List coupons; + + private final Map customFields; + + private SubscriptionCreateWithItemsParams(SubscriptionCreateWithItemsBuilder builder) { + + this.id = builder.id; + + this.businessEntityId = builder.businessEntityId; + + this.trialEnd = builder.trialEnd; + + this.billingCycles = builder.billingCycles; + + this.setupFee = builder.setupFee; + + this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; + + this.netTermDays = builder.netTermDays; + + this.startDate = builder.startDate; + + this.coupon = builder.coupon; + + this.autoCollection = builder.autoCollection; + + this.termsToCharge = builder.termsToCharge; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.offlinePaymentMethod = builder.offlinePaymentMethod; + + this.poNumber = builder.poNumber; + + this.couponIds = builder.couponIds; + + this.paymentSourceId = builder.paymentSourceId; + + this.overrideRelationship = builder.overrideRelationship; + + this.invoiceNotes = builder.invoiceNotes; + + this.invoiceDate = builder.invoiceDate; + + this.metaData = builder.metaData; + + this.invoiceImmediately = builder.invoiceImmediately; + + this.replacePrimaryPaymentSource = builder.replacePrimaryPaymentSource; + + this.freePeriod = builder.freePeriod; + + this.freePeriodUnit = builder.freePeriodUnit; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + + this.createPendingInvoices = builder.createPendingInvoices; + + this.autoCloseInvoices = builder.autoCloseInvoices; + + this.firstInvoicePending = builder.firstInvoicePending; + + this.trialEndAction = builder.trialEndAction; + + this.paymentInitiator = builder.paymentInitiator; + + this.shippingAddress = builder.shippingAddress; + + this.statementDescriptor = builder.statementDescriptor; + + this.paymentIntent = builder.paymentIntent; + + this.contractTerm = builder.contractTerm; + + this.billingOverride = builder.billingOverride; + + this.subscriptionItems = builder.subscriptionItems; + + this.discounts = builder.discounts; + + this.itemTiers = builder.itemTiers; + + this.coupons = builder.coupons; + + this.customFields = + builder.customFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); + } + + public String getId() { + return id; + } + + public String getBusinessEntityId() { + return businessEntityId; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Long getSetupFee() { + return setupFee; + } + + public List getMandatoryItemsToRemove() { + return mandatoryItemsToRemove; + } + + public Integer getNetTermDays() { + return netTermDays; + } + + public Timestamp getStartDate() { + return startDate; + } + + public String getCoupon() { + return coupon; + } + + public AutoCollection getAutoCollection() { + return autoCollection; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public OfflinePaymentMethod getOfflinePaymentMethod() { + return offlinePaymentMethod; + } + + public String getPoNumber() { + return poNumber; + } + + public List getCouponIds() { + return couponIds; + } + + public String getPaymentSourceId() { + return paymentSourceId; + } + + public Boolean getOverrideRelationship() { + return overrideRelationship; + } + + public String getInvoiceNotes() { + return invoiceNotes; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public java.util.Map getMetaData() { + return metaData; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + public Boolean getReplacePrimaryPaymentSource() { + return replacePrimaryPaymentSource; + } + + public Integer getFreePeriod() { + return freePeriod; + } + + public FreePeriodUnit getFreePeriodUnit() { + return freePeriodUnit; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + public Boolean getCreatePendingInvoices() { + return createPendingInvoices; + } + + public Boolean getAutoCloseInvoices() { + return autoCloseInvoices; + } + + public Boolean getFirstInvoicePending() { + return firstInvoicePending; + } + + public TrialEndAction getTrialEndAction() { + return trialEndAction; + } + + public PaymentInitiator getPaymentInitiator() { + return paymentInitiator; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public StatementDescriptorParams getStatementDescriptor() { + return statementDescriptor; + } + + public PaymentIntentParams getPaymentIntent() { + return paymentIntent; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public BillingOverrideParams getBillingOverride() { + return billingOverride; + } + + public List getSubscriptionItems() { + return subscriptionItems; + } + + public List getDiscounts() { + return discounts; + } + + public List getItemTiers() { + return itemTiers; + } + + public List getCoupons() { + return coupons; + } + + public Map customFields() { + return customFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.businessEntityId != null) { + + formData.put("business_entity_id", this.businessEntityId); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.mandatoryItemsToRemove != null) { + + formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); + } + + if (this.netTermDays != null) { + + formData.put("net_term_days", this.netTermDays); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.coupon != null) { + + formData.put("coupon", this.coupon); + } + + if (this.autoCollection != null) { + + formData.put("auto_collection", this.autoCollection); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.offlinePaymentMethod != null) { + + formData.put("offline_payment_method", this.offlinePaymentMethod); + } + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.paymentSourceId != null) { + + formData.put("payment_source_id", this.paymentSourceId); + } + + if (this.overrideRelationship != null) { + + formData.put("override_relationship", this.overrideRelationship); + } + + if (this.invoiceNotes != null) { + + formData.put("invoice_notes", this.invoiceNotes); + } + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.metaData != null) { + + formData.put("meta_data", JsonUtil.toJson(this.metaData)); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + if (this.replacePrimaryPaymentSource != null) { + + formData.put("replace_primary_payment_source", this.replacePrimaryPaymentSource); + } + + if (this.freePeriod != null) { + + formData.put("free_period", this.freePeriod); + } + + if (this.freePeriodUnit != null) { + + formData.put("free_period_unit", this.freePeriodUnit); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + if (this.createPendingInvoices != null) { + + formData.put("create_pending_invoices", this.createPendingInvoices); + } + + if (this.autoCloseInvoices != null) { + + formData.put("auto_close_invoices", this.autoCloseInvoices); + } + + if (this.firstInvoicePending != null) { + + formData.put("first_invoice_pending", this.firstInvoicePending); + } + + if (this.trialEndAction != null) { + + formData.put("trial_end_action", this.trialEndAction); + } + + if (this.paymentInitiator != null) { + + formData.put("payment_initiator", this.paymentInitiator); + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.statementDescriptor != null) { + + // Single object + Map nestedData = this.statementDescriptor.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "statement_descriptor[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.paymentIntent != null) { + + // Single object + Map nestedData = this.paymentIntent.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "payment_intent[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.billingOverride != null) { + + // Single object + Map nestedData = this.billingOverride.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_override[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.subscriptionItems != null) { + + // List of objects + for (int i = 0; i < this.subscriptionItems.size(); i++) { + SubscriptionItemsParams item = this.subscriptionItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discounts != null) { + + // List of objects + for (int i = 0; i < this.discounts.size(); i++) { + DiscountsParams item = this.discounts.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.coupons != null) { + + // List of objects + for (int i = 0; i < this.coupons.size(); i++) { + CouponsParams item = this.coupons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(customFields); + + return formData; + } + + /** Create a new builder for SubscriptionCreateWithItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionCreateWithItemsBuilder builder() { + return new SubscriptionCreateWithItemsBuilder(); + } + + public static final class SubscriptionCreateWithItemsBuilder { + + private String id; + + private String businessEntityId; + + private Timestamp trialEnd; + + private Integer billingCycles; + + private Long setupFee; + + private List mandatoryItemsToRemove; + + private Integer netTermDays; + + private Timestamp startDate; + + private String coupon; + + private AutoCollection autoCollection; + + private Integer termsToCharge; + + private BillingAlignmentMode billingAlignmentMode; + + private OfflinePaymentMethod offlinePaymentMethod; + + private String poNumber; + + private List couponIds; + + private String paymentSourceId; + + private Boolean overrideRelationship; + + private String invoiceNotes; + + private Timestamp invoiceDate; + + private java.util.Map metaData; + + private Boolean invoiceImmediately; + + private Boolean replacePrimaryPaymentSource; + + private Integer freePeriod; + + private FreePeriodUnit freePeriodUnit; + + private Integer contractTermBillingCycleOnRenewal; + + private Boolean createPendingInvoices; + + private Boolean autoCloseInvoices; + + private Boolean firstInvoicePending; + + private TrialEndAction trialEndAction; + + private PaymentInitiator paymentInitiator; + + private ShippingAddressParams shippingAddress; + + private StatementDescriptorParams statementDescriptor; + + private PaymentIntentParams paymentIntent; + + private ContractTermParams contractTerm; + + private BillingOverrideParams billingOverride; + + private List subscriptionItems; + + private List discounts; + + private List itemTiers; + + private List coupons; + + private Map customFields = new LinkedHashMap<>(); + + private SubscriptionCreateWithItemsBuilder() {} + + public SubscriptionCreateWithItemsBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder businessEntityId(String value) { + this.businessEntityId = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + @Deprecated + public SubscriptionCreateWithItemsBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder mandatoryItemsToRemove(List value) { + this.mandatoryItemsToRemove = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder netTermDays(Integer value) { + this.netTermDays = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + @Deprecated + public SubscriptionCreateWithItemsBuilder coupon(String value) { + this.coupon = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder autoCollection(AutoCollection value) { + this.autoCollection = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder billingAlignmentMode(BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + this.offlinePaymentMethod = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder paymentSourceId(String value) { + this.paymentSourceId = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder overrideRelationship(Boolean value) { + this.overrideRelationship = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder invoiceNotes(String value) { + this.invoiceNotes = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder metaData(java.util.Map value) { + this.metaData = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder replacePrimaryPaymentSource(Boolean value) { + this.replacePrimaryPaymentSource = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder freePeriod(Integer value) { + this.freePeriod = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder freePeriodUnit(FreePeriodUnit value) { + this.freePeriodUnit = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder createPendingInvoices(Boolean value) { + this.createPendingInvoices = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder autoCloseInvoices(Boolean value) { + this.autoCloseInvoices = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder firstInvoicePending(Boolean value) { + this.firstInvoicePending = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder trialEndAction(TrialEndAction value) { + this.trialEndAction = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder paymentInitiator(PaymentInitiator value) { + this.paymentInitiator = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder statementDescriptor(StatementDescriptorParams value) { + this.statementDescriptor = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder paymentIntent(PaymentIntentParams value) { + this.paymentIntent = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder billingOverride(BillingOverrideParams value) { + this.billingOverride = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder subscriptionItems( + List value) { + this.subscriptionItems = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder discounts(List value) { + this.discounts = value; + return this; + } + + public SubscriptionCreateWithItemsBuilder itemTiers(List value) { + this.itemTiers = value; + return this; + } + + @Deprecated + public SubscriptionCreateWithItemsBuilder coupons(List value) { + this.coupons = value; + return this; + } + + /** + * Add a custom field to the request. Custom fields must start with "cf_". + * + * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") + * @param value the value of the custom field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cf_" + */ + public SubscriptionCreateWithItemsBuilder customField(String fieldName, String value) { + if (fieldName == null || !fieldName.startsWith("cf_")) { + throw new IllegalArgumentException("Custom field name must start with 'cf_'"); + } + this.customFields.put(fieldName, value); + return this; + } + + /** + * Add multiple custom fields to the request. All field names must start with "cf_". + * + * @param customFields map of custom field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cf_" + */ + public SubscriptionCreateWithItemsBuilder customFields(Map customFields) { + if (customFields != null) { + for (Map.Entry entry : customFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { + throw new IllegalArgumentException( + "Custom field name must start with 'cf_': " + entry.getKey()); + } + this.customFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public SubscriptionCreateWithItemsParams build() { + return new SubscriptionCreateWithItemsParams(this); + } + } + + public enum AutoCollection { + ON("on"), + + OFF("off"), + + /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AutoCollection(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AutoCollection fromString(String value) { + if (value == null) return _UNKNOWN; + for (AutoCollection enumValue : AutoCollection.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum FreePeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + FreePeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static FreePeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum TrialEndAction { + SITE_DEFAULT("site_default"), + + PLAN_DEFAULT("plan_default"), + + ACTIVATE_SUBSCRIPTION("activate_subscription"), + + CANCEL_SUBSCRIPTION("cancel_subscription"), + + /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + TrialEndAction(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static TrialEndAction fromString(String value) { + if (value == null) return _UNKNOWN; + for (TrialEndAction enumValue : TrialEndAction.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PaymentInitiator { + CUSTOMER("customer"), + + MERCHANT("merchant"), + + /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentInitiator(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentInitiator fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentInitiator enumValue : PaymentInitiator.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class StatementDescriptorParams { + + private final String descriptor; + + private StatementDescriptorParams(StatementDescriptorBuilder builder) { + + this.descriptor = builder.descriptor; + } + + public String getDescriptor() { + return descriptor; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.descriptor != null) { + + formData.put("descriptor", this.descriptor); + } + + return formData; + } + + /** Create a new builder for StatementDescriptorParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static StatementDescriptorBuilder builder() { + return new StatementDescriptorBuilder(); + } + + public static final class StatementDescriptorBuilder { + + private String descriptor; + + private StatementDescriptorBuilder() {} + + public StatementDescriptorBuilder descriptor(String value) { + this.descriptor = value; + return this; + } + + public StatementDescriptorParams build() { + return new StatementDescriptorParams(this); + } + } + } + + public static final class PaymentIntentParams { + + private final String id; + + private final String gatewayAccountId; + + private final String gwToken; + + private final PaymentMethodType paymentMethodType; + + private final String referenceId; + + private final String gwPaymentMethodId; + + private final java.util.Map additionalInformation; + + private PaymentIntentParams(PaymentIntentBuilder builder) { + + this.id = builder.id; + + this.gatewayAccountId = builder.gatewayAccountId; + + this.gwToken = builder.gwToken; + + this.paymentMethodType = builder.paymentMethodType; + + this.referenceId = builder.referenceId; + + this.gwPaymentMethodId = builder.gwPaymentMethodId; + + this.additionalInformation = builder.additionalInformation; + } + + public String getId() { + return id; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getGwToken() { + return gwToken; + } + + public PaymentMethodType getPaymentMethodType() { + return paymentMethodType; + } + + public String getReferenceId() { + return referenceId; + } + + public String getGwPaymentMethodId() { + return gwPaymentMethodId; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.gwToken != null) { + + formData.put("gw_token", this.gwToken); + } + + if (this.paymentMethodType != null) { + + formData.put("payment_method_type", this.paymentMethodType); + } + + if (this.referenceId != null) { + + formData.put("reference_id", this.referenceId); + } + + if (this.gwPaymentMethodId != null) { + + formData.put("gw_payment_method_id", this.gwPaymentMethodId); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for PaymentIntentParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentIntentBuilder builder() { + return new PaymentIntentBuilder(); + } + + public static final class PaymentIntentBuilder { + + private String id; + + private String gatewayAccountId; + + private String gwToken; + + private PaymentMethodType paymentMethodType; + + private String referenceId; + + private String gwPaymentMethodId; + + private java.util.Map additionalInformation; + + private PaymentIntentBuilder() {} + + public PaymentIntentBuilder id(String value) { + this.id = value; + return this; + } + + public PaymentIntentBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public PaymentIntentBuilder gwToken(String value) { + this.gwToken = value; + return this; + } + + public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { + this.paymentMethodType = value; + return this; + } + + public PaymentIntentBuilder referenceId(String value) { + this.referenceId = value; + return this; + } + + @Deprecated + public PaymentIntentBuilder gwPaymentMethodId(String value) { + this.gwPaymentMethodId = value; + return this; + } + + public PaymentIntentBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public PaymentIntentParams build() { + return new PaymentIntentParams(this); + } + } + + public enum PaymentMethodType { + CARD("card"), + + IDEAL("ideal"), + + SOFORT("sofort"), + + BANCONTACT("bancontact"), + + GOOGLE_PAY("google_pay"), + + DOTPAY("dotpay"), + + GIROPAY("giropay"), + + APPLE_PAY("apple_pay"), + + UPI("upi"), + + NETBANKING_EMANDATES("netbanking_emandates"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + DIRECT_DEBIT("direct_debit"), + + BOLETO("boleto"), + + VENMO("venmo"), + + AMAZON_PAYMENTS("amazon_payments"), + + PAY_TO("pay_to"), + + FASTER_PAYMENTS("faster_payments"), + + SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), + + KLARNA_PAY_NOW("klarna_pay_now"), + + ONLINE_BANKING_POLAND("online_banking_poland"), + + PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), + + ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), + + KBC_PAYMENT_BUTTON("kbc_payment_button"), + + PAY_BY_BANK("pay_by_bank"), + + TRUSTLY("trustly"), + + STABLECOIN("stablecoin"), + + /** + * An enum member indicating that PaymentMethodType was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + PaymentMethodType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethodType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethodType enumValue : PaymentMethodType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Timestamp contractStart; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.contractStart = builder.contractStart; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Timestamp getContractStart() { + return contractStart; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.contractStart != null) { + + formData.put("contract_start", this.contractStart); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Timestamp contractStart; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + @Deprecated + public ContractTermBuilder contractStart(Timestamp value) { + this.contractStart = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class BillingOverrideParams { + + private final Long maxExcessPaymentUsage; + + private final Long maxRefundableCreditsUsage; + + private BillingOverrideParams(BillingOverrideBuilder builder) { + + this.maxExcessPaymentUsage = builder.maxExcessPaymentUsage; + + this.maxRefundableCreditsUsage = builder.maxRefundableCreditsUsage; + } + + public Long getMaxExcessPaymentUsage() { + return maxExcessPaymentUsage; + } + + public Long getMaxRefundableCreditsUsage() { + return maxRefundableCreditsUsage; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.maxExcessPaymentUsage != null) { + + formData.put("max_excess_payment_usage", this.maxExcessPaymentUsage); + } + + if (this.maxRefundableCreditsUsage != null) { + + formData.put("max_refundable_credits_usage", this.maxRefundableCreditsUsage); + } + + return formData; + } + + /** Create a new builder for BillingOverrideParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingOverrideBuilder builder() { + return new BillingOverrideBuilder(); + } + + public static final class BillingOverrideBuilder { + + private Long maxExcessPaymentUsage; + + private Long maxRefundableCreditsUsage; + + private BillingOverrideBuilder() {} + + public BillingOverrideBuilder maxExcessPaymentUsage(Long value) { + this.maxExcessPaymentUsage = value; + return this; + } + + public BillingOverrideBuilder maxRefundableCreditsUsage(Long value) { + this.maxRefundableCreditsUsage = value; + return this; + } + + public BillingOverrideParams build() { + return new BillingOverrideParams(this); + } + } + } + + public static final class SubscriptionItemsParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Timestamp trialEnd; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ItemType itemType; + + private final ChargeOnOption chargeOnOption; + + private final UsageAccumulationResetFrequency usageAccumulationResetFrequency; + + private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.trialEnd = builder.trialEnd; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.itemType = builder.itemType; + + this.chargeOnOption = builder.chargeOnOption; + + this.usageAccumulationResetFrequency = builder.usageAccumulationResetFrequency; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ItemType getItemType() { + return itemType; + } + + public ChargeOnOption getChargeOnOption() { + return chargeOnOption; + } + + public UsageAccumulationResetFrequency getUsageAccumulationResetFrequency() { + return usageAccumulationResetFrequency; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.itemType != null) { + + formData.put("item_type", this.itemType); + } + + if (this.chargeOnOption != null) { + + formData.put("charge_on_option", this.chargeOnOption); + } + + if (this.usageAccumulationResetFrequency != null) { + + formData.put("usage_accumulation_reset_frequency", this.usageAccumulationResetFrequency); + } + + return formData; + } + + /** Create a new builder for SubscriptionItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionItemsBuilder builder() { + return new SubscriptionItemsBuilder(); + } + + public static final class SubscriptionItemsBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Timestamp trialEnd; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ItemType itemType; + + private ChargeOnOption chargeOnOption; + + private UsageAccumulationResetFrequency usageAccumulationResetFrequency; + + private SubscriptionItemsBuilder() {} + + public SubscriptionItemsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public SubscriptionItemsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public SubscriptionItemsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public SubscriptionItemsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public SubscriptionItemsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionItemsBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public SubscriptionItemsBuilder itemType(ItemType value) { + this.itemType = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { + this.chargeOnOption = value; + return this; + } + + public SubscriptionItemsBuilder usageAccumulationResetFrequency( + UsageAccumulationResetFrequency value) { + this.usageAccumulationResetFrequency = value; + return this; + } + + public SubscriptionItemsParams build() { + return new SubscriptionItemsParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ItemType { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemType enumValue : ItemType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnOption { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnOption enumValue : ChargeOnOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum UsageAccumulationResetFrequency { + NEVER("never"), + + SUBSCRIPTION_BILLING_FREQUENCY("subscription_billing_frequency"), + + /** + * An enum member indicating that UsageAccumulationResetFrequency was instantiated with an + * unknown value. + */ + _UNKNOWN(null); + private final String value; + + UsageAccumulationResetFrequency(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static UsageAccumulationResetFrequency fromString(String value) { + if (value == null) return _UNKNOWN; + for (UsageAccumulationResetFrequency enumValue : UsageAccumulationResetFrequency.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class DiscountsParams { + + private final ApplyOn applyOn; + + private final DurationType durationType; + + private final Number percentage; + + private final Long amount; + + private final Integer period; + + private final PeriodUnit periodUnit; + + private final Boolean includedInMrr; + + private final String itemPriceId; + + private final Integer quantity; + + private DiscountsParams(DiscountsBuilder builder) { + + this.applyOn = builder.applyOn; + + this.durationType = builder.durationType; + + this.percentage = builder.percentage; + + this.amount = builder.amount; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + + this.includedInMrr = builder.includedInMrr; + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public DurationType getDurationType() { + return durationType; + } + + public Number getPercentage() { + return percentage; + } + + public Long getAmount() { + return amount; + } + + public Integer getPeriod() { + return period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public Boolean getIncludedInMrr() { + return includedInMrr; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.durationType != null) { + + formData.put("duration_type", this.durationType); + } + + if (this.percentage != null) { + + formData.put("percentage", this.percentage); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.includedInMrr != null) { + + formData.put("included_in_mrr", this.includedInMrr); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + return formData; + } + + /** Create a new builder for DiscountsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsBuilder builder() { + return new DiscountsBuilder(); + } + + public static final class DiscountsBuilder { + + private ApplyOn applyOn; + + private DurationType durationType; + + private Number percentage; + + private Long amount; + + private Integer period; + + private PeriodUnit periodUnit; + + private Boolean includedInMrr; + + private String itemPriceId; + + private Integer quantity; + + private DiscountsBuilder() {} + + public DiscountsBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public DiscountsBuilder durationType(DurationType value) { + this.durationType = value; + return this; + } + + public DiscountsBuilder percentage(Number value) { + this.percentage = value; + return this; + } + + public DiscountsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsBuilder period(Integer value) { + this.period = value; + return this; + } + + public DiscountsBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public DiscountsBuilder includedInMrr(Boolean value) { + this.includedInMrr = value; + return this; + } + + public DiscountsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DiscountsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public DiscountsParams build() { + return new DiscountsParams(this); + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIC_ITEM_PRICE("specific_item_price"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum DurationType { + ONE_TIME("one_time"), + + FOREVER("forever"), + + LIMITED_PERIOD("limited_period"), + + /** An enum member indicating that DurationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DurationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DurationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DurationType enumValue : DurationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemTiersParams { + + private final String itemPriceId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private String itemPriceId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CouponsParams { + + private final String couponId; + + private final Timestamp applyTill; + + private CouponsParams(CouponsBuilder builder) { + + this.couponId = builder.couponId; + + this.applyTill = builder.applyTill; + } + + public String getCouponId() { + return couponId; + } + + public Timestamp getApplyTill() { + return applyTill; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.couponId != null) { + + formData.put("coupon_id", this.couponId); + } + + if (this.applyTill != null) { + + formData.put("apply_till", this.applyTill); + } + + return formData; + } + + /** Create a new builder for CouponsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponsBuilder builder() { + return new CouponsBuilder(); + } + + public static final class CouponsBuilder { + + private String couponId; + + private Timestamp applyTill; + + private CouponsBuilder() {} + + public CouponsBuilder couponId(String value) { + this.couponId = value; + return this; + } + + public CouponsBuilder applyTill(Timestamp value) { + this.applyTill = value; + return this; + } + + public CouponsParams build() { + return new CouponsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionDeleteParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionDeleteParams.java new file mode 100644 index 00000000..3ce0c342 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SubscriptionDeleteParams { + + private SubscriptionDeleteParams(SubscriptionDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for SubscriptionDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionDeleteBuilder builder() { + return new SubscriptionDeleteBuilder(); + } + + public static final class SubscriptionDeleteBuilder { + + private SubscriptionDeleteBuilder() {} + + public SubscriptionDeleteParams build() { + return new SubscriptionDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionEditAdvanceInvoiceScheduleParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionEditAdvanceInvoiceScheduleParams.java new file mode 100644 index 00000000..e75530cf --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionEditAdvanceInvoiceScheduleParams.java @@ -0,0 +1,394 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class SubscriptionEditAdvanceInvoiceScheduleParams { + + private final Integer termsToCharge; + + private final ScheduleType scheduleType; + + private final FixedIntervalScheduleParams fixedIntervalSchedule; + + private final List specificDatesSchedule; + + private SubscriptionEditAdvanceInvoiceScheduleParams( + SubscriptionEditAdvanceInvoiceScheduleBuilder builder) { + + this.termsToCharge = builder.termsToCharge; + + this.scheduleType = builder.scheduleType; + + this.fixedIntervalSchedule = builder.fixedIntervalSchedule; + + this.specificDatesSchedule = builder.specificDatesSchedule; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public ScheduleType getScheduleType() { + return scheduleType; + } + + public FixedIntervalScheduleParams getFixedIntervalSchedule() { + return fixedIntervalSchedule; + } + + public List getSpecificDatesSchedule() { + return specificDatesSchedule; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.scheduleType != null) { + + formData.put("schedule_type", this.scheduleType); + } + + if (this.fixedIntervalSchedule != null) { + + // Single object + Map nestedData = this.fixedIntervalSchedule.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "fixed_interval_schedule[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.specificDatesSchedule != null) { + + // List of objects + for (int i = 0; i < this.specificDatesSchedule.size(); i++) { + SpecificDatesScheduleParams item = this.specificDatesSchedule.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "specific_dates_schedule[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for SubscriptionEditAdvanceInvoiceScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionEditAdvanceInvoiceScheduleBuilder builder() { + return new SubscriptionEditAdvanceInvoiceScheduleBuilder(); + } + + public static final class SubscriptionEditAdvanceInvoiceScheduleBuilder { + + private Integer termsToCharge; + + private ScheduleType scheduleType; + + private FixedIntervalScheduleParams fixedIntervalSchedule; + + private List specificDatesSchedule; + + private SubscriptionEditAdvanceInvoiceScheduleBuilder() {} + + public SubscriptionEditAdvanceInvoiceScheduleBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public SubscriptionEditAdvanceInvoiceScheduleBuilder scheduleType(ScheduleType value) { + this.scheduleType = value; + return this; + } + + public SubscriptionEditAdvanceInvoiceScheduleBuilder fixedIntervalSchedule( + FixedIntervalScheduleParams value) { + this.fixedIntervalSchedule = value; + return this; + } + + public SubscriptionEditAdvanceInvoiceScheduleBuilder specificDatesSchedule( + List value) { + this.specificDatesSchedule = value; + return this; + } + + public SubscriptionEditAdvanceInvoiceScheduleParams build() { + return new SubscriptionEditAdvanceInvoiceScheduleParams(this); + } + } + + public enum ScheduleType { + SPECIFIC_DATES("specific_dates"), + + FIXED_INTERVALS("fixed_intervals"), + + /** An enum member indicating that ScheduleType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ScheduleType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ScheduleType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ScheduleType enumValue : ScheduleType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class FixedIntervalScheduleParams { + + private final Integer numberOfOccurrences; + + private final Integer daysBeforeRenewal; + + private final EndScheduleOn endScheduleOn; + + private final Timestamp endDate; + + private FixedIntervalScheduleParams(FixedIntervalScheduleBuilder builder) { + + this.numberOfOccurrences = builder.numberOfOccurrences; + + this.daysBeforeRenewal = builder.daysBeforeRenewal; + + this.endScheduleOn = builder.endScheduleOn; + + this.endDate = builder.endDate; + } + + public Integer getNumberOfOccurrences() { + return numberOfOccurrences; + } + + public Integer getDaysBeforeRenewal() { + return daysBeforeRenewal; + } + + public EndScheduleOn getEndScheduleOn() { + return endScheduleOn; + } + + public Timestamp getEndDate() { + return endDate; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.numberOfOccurrences != null) { + + formData.put("number_of_occurrences", this.numberOfOccurrences); + } + + if (this.daysBeforeRenewal != null) { + + formData.put("days_before_renewal", this.daysBeforeRenewal); + } + + if (this.endScheduleOn != null) { + + formData.put("end_schedule_on", this.endScheduleOn); + } + + if (this.endDate != null) { + + formData.put("end_date", this.endDate); + } + + return formData; + } + + /** Create a new builder for FixedIntervalScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static FixedIntervalScheduleBuilder builder() { + return new FixedIntervalScheduleBuilder(); + } + + public static final class FixedIntervalScheduleBuilder { + + private Integer numberOfOccurrences; + + private Integer daysBeforeRenewal; + + private EndScheduleOn endScheduleOn; + + private Timestamp endDate; + + private FixedIntervalScheduleBuilder() {} + + public FixedIntervalScheduleBuilder numberOfOccurrences(Integer value) { + this.numberOfOccurrences = value; + return this; + } + + public FixedIntervalScheduleBuilder daysBeforeRenewal(Integer value) { + this.daysBeforeRenewal = value; + return this; + } + + public FixedIntervalScheduleBuilder endScheduleOn(EndScheduleOn value) { + this.endScheduleOn = value; + return this; + } + + public FixedIntervalScheduleBuilder endDate(Timestamp value) { + this.endDate = value; + return this; + } + + public FixedIntervalScheduleParams build() { + return new FixedIntervalScheduleParams(this); + } + } + + public enum EndScheduleOn { + AFTER_NUMBER_OF_INTERVALS("after_number_of_intervals"), + + SPECIFIC_DATE("specific_date"), + + SUBSCRIPTION_END("subscription_end"), + + /** An enum member indicating that EndScheduleOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + EndScheduleOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EndScheduleOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (EndScheduleOn enumValue : EndScheduleOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class SpecificDatesScheduleParams { + + private final String id; + + private final Integer termsToCharge; + + private final Timestamp date; + + private SpecificDatesScheduleParams(SpecificDatesScheduleBuilder builder) { + + this.id = builder.id; + + this.termsToCharge = builder.termsToCharge; + + this.date = builder.date; + } + + public String getId() { + return id; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public Timestamp getDate() { + return date; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.date != null) { + + formData.put("date", this.date); + } + + return formData; + } + + /** Create a new builder for SpecificDatesScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SpecificDatesScheduleBuilder builder() { + return new SpecificDatesScheduleBuilder(); + } + + public static final class SpecificDatesScheduleBuilder { + + private String id; + + private Integer termsToCharge; + + private Timestamp date; + + private SpecificDatesScheduleBuilder() {} + + public SpecificDatesScheduleBuilder id(String value) { + this.id = value; + return this; + } + + public SpecificDatesScheduleBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public SpecificDatesScheduleBuilder date(Timestamp value) { + this.date = value; + return this; + } + + public SpecificDatesScheduleParams build() { + return new SpecificDatesScheduleParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionForItemsForCustomerParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionForItemsForCustomerParams.java deleted file mode 100644 index a17a82d2..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionForItemsForCustomerParams.java +++ /dev/null @@ -1,2986 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class SubscriptionForItemsForCustomerParams { - - private final String id; - - private final String businessEntityId; - - private final Timestamp trialEnd; - - private final Integer billingCycles; - - private final Long setupFee; - - private final List mandatoryItemsToRemove; - - private final Integer netTermDays; - - private final Timestamp startDate; - - private final String coupon; - - private final AutoCollection autoCollection; - - private final Integer termsToCharge; - - private final BillingAlignmentMode billingAlignmentMode; - - private final OfflinePaymentMethod offlinePaymentMethod; - - private final String poNumber; - - private final List couponIds; - - private final String paymentSourceId; - - private final Boolean overrideRelationship; - - private final String invoiceNotes; - - private final Timestamp invoiceDate; - - private final java.util.Map metaData; - - private final Boolean invoiceImmediately; - - private final Boolean replacePrimaryPaymentSource; - - private final Integer freePeriod; - - private final FreePeriodUnit freePeriodUnit; - - private final Integer contractTermBillingCycleOnRenewal; - - private final Boolean createPendingInvoices; - - private final Boolean autoCloseInvoices; - - private final Boolean firstInvoicePending; - - private final TrialEndAction trialEndAction; - - private final PaymentInitiator paymentInitiator; - - private final ShippingAddressParams shippingAddress; - - private final StatementDescriptorParams statementDescriptor; - - private final PaymentIntentParams paymentIntent; - - private final ContractTermParams contractTerm; - - private final BillingOverrideParams billingOverride; - - private final List subscriptionItems; - - private final List discounts; - - private final List itemTiers; - - private final List coupons; - - private final Map customFields; - - private SubscriptionForItemsForCustomerParams(SubscriptionForItemsForCustomerBuilder builder) { - - this.id = builder.id; - - this.businessEntityId = builder.businessEntityId; - - this.trialEnd = builder.trialEnd; - - this.billingCycles = builder.billingCycles; - - this.setupFee = builder.setupFee; - - this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; - - this.netTermDays = builder.netTermDays; - - this.startDate = builder.startDate; - - this.coupon = builder.coupon; - - this.autoCollection = builder.autoCollection; - - this.termsToCharge = builder.termsToCharge; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.offlinePaymentMethod = builder.offlinePaymentMethod; - - this.poNumber = builder.poNumber; - - this.couponIds = builder.couponIds; - - this.paymentSourceId = builder.paymentSourceId; - - this.overrideRelationship = builder.overrideRelationship; - - this.invoiceNotes = builder.invoiceNotes; - - this.invoiceDate = builder.invoiceDate; - - this.metaData = builder.metaData; - - this.invoiceImmediately = builder.invoiceImmediately; - - this.replacePrimaryPaymentSource = builder.replacePrimaryPaymentSource; - - this.freePeriod = builder.freePeriod; - - this.freePeriodUnit = builder.freePeriodUnit; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - - this.createPendingInvoices = builder.createPendingInvoices; - - this.autoCloseInvoices = builder.autoCloseInvoices; - - this.firstInvoicePending = builder.firstInvoicePending; - - this.trialEndAction = builder.trialEndAction; - - this.paymentInitiator = builder.paymentInitiator; - - this.shippingAddress = builder.shippingAddress; - - this.statementDescriptor = builder.statementDescriptor; - - this.paymentIntent = builder.paymentIntent; - - this.contractTerm = builder.contractTerm; - - this.billingOverride = builder.billingOverride; - - this.subscriptionItems = builder.subscriptionItems; - - this.discounts = builder.discounts; - - this.itemTiers = builder.itemTiers; - - this.coupons = builder.coupons; - - this.customFields = - builder.customFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); - } - - public String getId() { - return id; - } - - public String getBusinessEntityId() { - return businessEntityId; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Long getSetupFee() { - return setupFee; - } - - public List getMandatoryItemsToRemove() { - return mandatoryItemsToRemove; - } - - public Integer getNetTermDays() { - return netTermDays; - } - - public Timestamp getStartDate() { - return startDate; - } - - public String getCoupon() { - return coupon; - } - - public AutoCollection getAutoCollection() { - return autoCollection; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public OfflinePaymentMethod getOfflinePaymentMethod() { - return offlinePaymentMethod; - } - - public String getPoNumber() { - return poNumber; - } - - public List getCouponIds() { - return couponIds; - } - - public String getPaymentSourceId() { - return paymentSourceId; - } - - public Boolean getOverrideRelationship() { - return overrideRelationship; - } - - public String getInvoiceNotes() { - return invoiceNotes; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public java.util.Map getMetaData() { - return metaData; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - public Boolean getReplacePrimaryPaymentSource() { - return replacePrimaryPaymentSource; - } - - public Integer getFreePeriod() { - return freePeriod; - } - - public FreePeriodUnit getFreePeriodUnit() { - return freePeriodUnit; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - public Boolean getCreatePendingInvoices() { - return createPendingInvoices; - } - - public Boolean getAutoCloseInvoices() { - return autoCloseInvoices; - } - - public Boolean getFirstInvoicePending() { - return firstInvoicePending; - } - - public TrialEndAction getTrialEndAction() { - return trialEndAction; - } - - public PaymentInitiator getPaymentInitiator() { - return paymentInitiator; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public StatementDescriptorParams getStatementDescriptor() { - return statementDescriptor; - } - - public PaymentIntentParams getPaymentIntent() { - return paymentIntent; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public BillingOverrideParams getBillingOverride() { - return billingOverride; - } - - public List getSubscriptionItems() { - return subscriptionItems; - } - - public List getDiscounts() { - return discounts; - } - - public List getItemTiers() { - return itemTiers; - } - - public List getCoupons() { - return coupons; - } - - public Map customFields() { - return customFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.businessEntityId != null) { - - formData.put("business_entity_id", this.businessEntityId); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.mandatoryItemsToRemove != null) { - - formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); - } - - if (this.netTermDays != null) { - - formData.put("net_term_days", this.netTermDays); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.coupon != null) { - - formData.put("coupon", this.coupon); - } - - if (this.autoCollection != null) { - - formData.put("auto_collection", this.autoCollection); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.offlinePaymentMethod != null) { - - formData.put("offline_payment_method", this.offlinePaymentMethod); - } - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.paymentSourceId != null) { - - formData.put("payment_source_id", this.paymentSourceId); - } - - if (this.overrideRelationship != null) { - - formData.put("override_relationship", this.overrideRelationship); - } - - if (this.invoiceNotes != null) { - - formData.put("invoice_notes", this.invoiceNotes); - } - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.metaData != null) { - - formData.put("meta_data", JsonUtil.toJson(this.metaData)); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - if (this.replacePrimaryPaymentSource != null) { - - formData.put("replace_primary_payment_source", this.replacePrimaryPaymentSource); - } - - if (this.freePeriod != null) { - - formData.put("free_period", this.freePeriod); - } - - if (this.freePeriodUnit != null) { - - formData.put("free_period_unit", this.freePeriodUnit); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - if (this.createPendingInvoices != null) { - - formData.put("create_pending_invoices", this.createPendingInvoices); - } - - if (this.autoCloseInvoices != null) { - - formData.put("auto_close_invoices", this.autoCloseInvoices); - } - - if (this.firstInvoicePending != null) { - - formData.put("first_invoice_pending", this.firstInvoicePending); - } - - if (this.trialEndAction != null) { - - formData.put("trial_end_action", this.trialEndAction); - } - - if (this.paymentInitiator != null) { - - formData.put("payment_initiator", this.paymentInitiator); - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.statementDescriptor != null) { - - // Single object - Map nestedData = this.statementDescriptor.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "statement_descriptor[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.paymentIntent != null) { - - // Single object - Map nestedData = this.paymentIntent.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "payment_intent[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.billingOverride != null) { - - // Single object - Map nestedData = this.billingOverride.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_override[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.subscriptionItems != null) { - - // List of objects - for (int i = 0; i < this.subscriptionItems.size(); i++) { - SubscriptionItemsParams item = this.subscriptionItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discounts != null) { - - // List of objects - for (int i = 0; i < this.discounts.size(); i++) { - DiscountsParams item = this.discounts.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.coupons != null) { - - // List of objects - for (int i = 0; i < this.coupons.size(); i++) { - CouponsParams item = this.coupons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(customFields); - - return formData; - } - - /** Create a new builder for SubscriptionForItemsForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionForItemsForCustomerBuilder builder() { - return new SubscriptionForItemsForCustomerBuilder(); - } - - public static final class SubscriptionForItemsForCustomerBuilder { - - private String id; - - private String businessEntityId; - - private Timestamp trialEnd; - - private Integer billingCycles; - - private Long setupFee; - - private List mandatoryItemsToRemove; - - private Integer netTermDays; - - private Timestamp startDate; - - private String coupon; - - private AutoCollection autoCollection; - - private Integer termsToCharge; - - private BillingAlignmentMode billingAlignmentMode; - - private OfflinePaymentMethod offlinePaymentMethod; - - private String poNumber; - - private List couponIds; - - private String paymentSourceId; - - private Boolean overrideRelationship; - - private String invoiceNotes; - - private Timestamp invoiceDate; - - private java.util.Map metaData; - - private Boolean invoiceImmediately; - - private Boolean replacePrimaryPaymentSource; - - private Integer freePeriod; - - private FreePeriodUnit freePeriodUnit; - - private Integer contractTermBillingCycleOnRenewal; - - private Boolean createPendingInvoices; - - private Boolean autoCloseInvoices; - - private Boolean firstInvoicePending; - - private TrialEndAction trialEndAction; - - private PaymentInitiator paymentInitiator; - - private ShippingAddressParams shippingAddress; - - private StatementDescriptorParams statementDescriptor; - - private PaymentIntentParams paymentIntent; - - private ContractTermParams contractTerm; - - private BillingOverrideParams billingOverride; - - private List subscriptionItems; - - private List discounts; - - private List itemTiers; - - private List coupons; - - private Map customFields = new LinkedHashMap<>(); - - private SubscriptionForItemsForCustomerBuilder() {} - - public SubscriptionForItemsForCustomerBuilder id(String value) { - this.id = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder businessEntityId(String value) { - this.businessEntityId = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - @Deprecated - public SubscriptionForItemsForCustomerBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder mandatoryItemsToRemove(List value) { - this.mandatoryItemsToRemove = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder netTermDays(Integer value) { - this.netTermDays = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - @Deprecated - public SubscriptionForItemsForCustomerBuilder coupon(String value) { - this.coupon = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder autoCollection(AutoCollection value) { - this.autoCollection = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder billingAlignmentMode(BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - this.offlinePaymentMethod = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder paymentSourceId(String value) { - this.paymentSourceId = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder overrideRelationship(Boolean value) { - this.overrideRelationship = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder invoiceNotes(String value) { - this.invoiceNotes = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder metaData(java.util.Map value) { - this.metaData = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder replacePrimaryPaymentSource(Boolean value) { - this.replacePrimaryPaymentSource = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder freePeriod(Integer value) { - this.freePeriod = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder freePeriodUnit(FreePeriodUnit value) { - this.freePeriodUnit = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder createPendingInvoices(Boolean value) { - this.createPendingInvoices = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder autoCloseInvoices(Boolean value) { - this.autoCloseInvoices = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder firstInvoicePending(Boolean value) { - this.firstInvoicePending = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder trialEndAction(TrialEndAction value) { - this.trialEndAction = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder paymentInitiator(PaymentInitiator value) { - this.paymentInitiator = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder shippingAddress(ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder statementDescriptor( - StatementDescriptorParams value) { - this.statementDescriptor = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder paymentIntent(PaymentIntentParams value) { - this.paymentIntent = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder billingOverride(BillingOverrideParams value) { - this.billingOverride = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder subscriptionItems( - List value) { - this.subscriptionItems = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder discounts(List value) { - this.discounts = value; - return this; - } - - public SubscriptionForItemsForCustomerBuilder itemTiers(List value) { - this.itemTiers = value; - return this; - } - - @Deprecated - public SubscriptionForItemsForCustomerBuilder coupons(List value) { - this.coupons = value; - return this; - } - - /** - * Add a custom field to the request. Custom fields must start with "cf_". - * - * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") - * @param value the value of the custom field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cf_" - */ - public SubscriptionForItemsForCustomerBuilder customField(String fieldName, String value) { - if (fieldName == null || !fieldName.startsWith("cf_")) { - throw new IllegalArgumentException("Custom field name must start with 'cf_'"); - } - this.customFields.put(fieldName, value); - return this; - } - - /** - * Add multiple custom fields to the request. All field names must start with "cf_". - * - * @param customFields map of custom field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cf_" - */ - public SubscriptionForItemsForCustomerBuilder customFields(Map customFields) { - if (customFields != null) { - for (Map.Entry entry : customFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { - throw new IllegalArgumentException( - "Custom field name must start with 'cf_': " + entry.getKey()); - } - this.customFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public SubscriptionForItemsForCustomerParams build() { - return new SubscriptionForItemsForCustomerParams(this); - } - } - - public enum AutoCollection { - ON("on"), - - OFF("off"), - - /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AutoCollection(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AutoCollection fromString(String value) { - if (value == null) return _UNKNOWN; - for (AutoCollection enumValue : AutoCollection.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum FreePeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - FreePeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static FreePeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum TrialEndAction { - SITE_DEFAULT("site_default"), - - PLAN_DEFAULT("plan_default"), - - ACTIVATE_SUBSCRIPTION("activate_subscription"), - - CANCEL_SUBSCRIPTION("cancel_subscription"), - - /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - TrialEndAction(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static TrialEndAction fromString(String value) { - if (value == null) return _UNKNOWN; - for (TrialEndAction enumValue : TrialEndAction.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PaymentInitiator { - CUSTOMER("customer"), - - MERCHANT("merchant"), - - /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentInitiator(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentInitiator fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentInitiator enumValue : PaymentInitiator.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class StatementDescriptorParams { - - private final String descriptor; - - private StatementDescriptorParams(StatementDescriptorBuilder builder) { - - this.descriptor = builder.descriptor; - } - - public String getDescriptor() { - return descriptor; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.descriptor != null) { - - formData.put("descriptor", this.descriptor); - } - - return formData; - } - - /** Create a new builder for StatementDescriptorParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static StatementDescriptorBuilder builder() { - return new StatementDescriptorBuilder(); - } - - public static final class StatementDescriptorBuilder { - - private String descriptor; - - private StatementDescriptorBuilder() {} - - public StatementDescriptorBuilder descriptor(String value) { - this.descriptor = value; - return this; - } - - public StatementDescriptorParams build() { - return new StatementDescriptorParams(this); - } - } - } - - public static final class PaymentIntentParams { - - private final String id; - - private final String gatewayAccountId; - - private final String gwToken; - - private final PaymentMethodType paymentMethodType; - - private final String referenceId; - - private final String gwPaymentMethodId; - - private final java.util.Map additionalInformation; - - private PaymentIntentParams(PaymentIntentBuilder builder) { - - this.id = builder.id; - - this.gatewayAccountId = builder.gatewayAccountId; - - this.gwToken = builder.gwToken; - - this.paymentMethodType = builder.paymentMethodType; - - this.referenceId = builder.referenceId; - - this.gwPaymentMethodId = builder.gwPaymentMethodId; - - this.additionalInformation = builder.additionalInformation; - } - - public String getId() { - return id; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getGwToken() { - return gwToken; - } - - public PaymentMethodType getPaymentMethodType() { - return paymentMethodType; - } - - public String getReferenceId() { - return referenceId; - } - - public String getGwPaymentMethodId() { - return gwPaymentMethodId; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.gwToken != null) { - - formData.put("gw_token", this.gwToken); - } - - if (this.paymentMethodType != null) { - - formData.put("payment_method_type", this.paymentMethodType); - } - - if (this.referenceId != null) { - - formData.put("reference_id", this.referenceId); - } - - if (this.gwPaymentMethodId != null) { - - formData.put("gw_payment_method_id", this.gwPaymentMethodId); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for PaymentIntentParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PaymentIntentBuilder builder() { - return new PaymentIntentBuilder(); - } - - public static final class PaymentIntentBuilder { - - private String id; - - private String gatewayAccountId; - - private String gwToken; - - private PaymentMethodType paymentMethodType; - - private String referenceId; - - private String gwPaymentMethodId; - - private java.util.Map additionalInformation; - - private PaymentIntentBuilder() {} - - public PaymentIntentBuilder id(String value) { - this.id = value; - return this; - } - - public PaymentIntentBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public PaymentIntentBuilder gwToken(String value) { - this.gwToken = value; - return this; - } - - public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { - this.paymentMethodType = value; - return this; - } - - public PaymentIntentBuilder referenceId(String value) { - this.referenceId = value; - return this; - } - - @Deprecated - public PaymentIntentBuilder gwPaymentMethodId(String value) { - this.gwPaymentMethodId = value; - return this; - } - - public PaymentIntentBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public PaymentIntentParams build() { - return new PaymentIntentParams(this); - } - } - - public enum PaymentMethodType { - CARD("card"), - - IDEAL("ideal"), - - SOFORT("sofort"), - - BANCONTACT("bancontact"), - - GOOGLE_PAY("google_pay"), - - DOTPAY("dotpay"), - - GIROPAY("giropay"), - - APPLE_PAY("apple_pay"), - - UPI("upi"), - - NETBANKING_EMANDATES("netbanking_emandates"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - DIRECT_DEBIT("direct_debit"), - - BOLETO("boleto"), - - VENMO("venmo"), - - AMAZON_PAYMENTS("amazon_payments"), - - PAY_TO("pay_to"), - - FASTER_PAYMENTS("faster_payments"), - - SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), - - KLARNA_PAY_NOW("klarna_pay_now"), - - ONLINE_BANKING_POLAND("online_banking_poland"), - - PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), - - ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), - - KBC_PAYMENT_BUTTON("kbc_payment_button"), - - PAY_BY_BANK("pay_by_bank"), - - TRUSTLY("trustly"), - - STABLECOIN("stablecoin"), - - /** - * An enum member indicating that PaymentMethodType was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - PaymentMethodType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethodType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethodType enumValue : PaymentMethodType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Timestamp contractStart; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.contractStart = builder.contractStart; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Timestamp getContractStart() { - return contractStart; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.contractStart != null) { - - formData.put("contract_start", this.contractStart); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Timestamp contractStart; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - @Deprecated - public ContractTermBuilder contractStart(Timestamp value) { - this.contractStart = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class BillingOverrideParams { - - private final Long maxExcessPaymentUsage; - - private final Long maxRefundableCreditsUsage; - - private BillingOverrideParams(BillingOverrideBuilder builder) { - - this.maxExcessPaymentUsage = builder.maxExcessPaymentUsage; - - this.maxRefundableCreditsUsage = builder.maxRefundableCreditsUsage; - } - - public Long getMaxExcessPaymentUsage() { - return maxExcessPaymentUsage; - } - - public Long getMaxRefundableCreditsUsage() { - return maxRefundableCreditsUsage; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.maxExcessPaymentUsage != null) { - - formData.put("max_excess_payment_usage", this.maxExcessPaymentUsage); - } - - if (this.maxRefundableCreditsUsage != null) { - - formData.put("max_refundable_credits_usage", this.maxRefundableCreditsUsage); - } - - return formData; - } - - /** Create a new builder for BillingOverrideParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingOverrideBuilder builder() { - return new BillingOverrideBuilder(); - } - - public static final class BillingOverrideBuilder { - - private Long maxExcessPaymentUsage; - - private Long maxRefundableCreditsUsage; - - private BillingOverrideBuilder() {} - - public BillingOverrideBuilder maxExcessPaymentUsage(Long value) { - this.maxExcessPaymentUsage = value; - return this; - } - - public BillingOverrideBuilder maxRefundableCreditsUsage(Long value) { - this.maxRefundableCreditsUsage = value; - return this; - } - - public BillingOverrideParams build() { - return new BillingOverrideParams(this); - } - } - } - - public static final class SubscriptionItemsParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Timestamp trialEnd; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ItemType itemType; - - private final ChargeOnOption chargeOnOption; - - private final UsageAccumulationResetFrequency usageAccumulationResetFrequency; - - private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.trialEnd = builder.trialEnd; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.itemType = builder.itemType; - - this.chargeOnOption = builder.chargeOnOption; - - this.usageAccumulationResetFrequency = builder.usageAccumulationResetFrequency; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ItemType getItemType() { - return itemType; - } - - public ChargeOnOption getChargeOnOption() { - return chargeOnOption; - } - - public UsageAccumulationResetFrequency getUsageAccumulationResetFrequency() { - return usageAccumulationResetFrequency; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.itemType != null) { - - formData.put("item_type", this.itemType); - } - - if (this.chargeOnOption != null) { - - formData.put("charge_on_option", this.chargeOnOption); - } - - if (this.usageAccumulationResetFrequency != null) { - - formData.put("usage_accumulation_reset_frequency", this.usageAccumulationResetFrequency); - } - - return formData; - } - - /** Create a new builder for SubscriptionItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionItemsBuilder builder() { - return new SubscriptionItemsBuilder(); - } - - public static final class SubscriptionItemsBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Timestamp trialEnd; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ItemType itemType; - - private ChargeOnOption chargeOnOption; - - private UsageAccumulationResetFrequency usageAccumulationResetFrequency; - - private SubscriptionItemsBuilder() {} - - public SubscriptionItemsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public SubscriptionItemsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public SubscriptionItemsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public SubscriptionItemsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public SubscriptionItemsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionItemsBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public SubscriptionItemsBuilder itemType(ItemType value) { - this.itemType = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { - this.chargeOnOption = value; - return this; - } - - public SubscriptionItemsBuilder usageAccumulationResetFrequency( - UsageAccumulationResetFrequency value) { - this.usageAccumulationResetFrequency = value; - return this; - } - - public SubscriptionItemsParams build() { - return new SubscriptionItemsParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ItemType { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemType enumValue : ItemType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnOption { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnOption enumValue : ChargeOnOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum UsageAccumulationResetFrequency { - NEVER("never"), - - SUBSCRIPTION_BILLING_FREQUENCY("subscription_billing_frequency"), - - /** - * An enum member indicating that UsageAccumulationResetFrequency was instantiated with an - * unknown value. - */ - _UNKNOWN(null); - private final String value; - - UsageAccumulationResetFrequency(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static UsageAccumulationResetFrequency fromString(String value) { - if (value == null) return _UNKNOWN; - for (UsageAccumulationResetFrequency enumValue : UsageAccumulationResetFrequency.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class DiscountsParams { - - private final ApplyOn applyOn; - - private final DurationType durationType; - - private final Number percentage; - - private final Long amount; - - private final Integer period; - - private final PeriodUnit periodUnit; - - private final Boolean includedInMrr; - - private final String itemPriceId; - - private final Integer quantity; - - private DiscountsParams(DiscountsBuilder builder) { - - this.applyOn = builder.applyOn; - - this.durationType = builder.durationType; - - this.percentage = builder.percentage; - - this.amount = builder.amount; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - - this.includedInMrr = builder.includedInMrr; - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public DurationType getDurationType() { - return durationType; - } - - public Number getPercentage() { - return percentage; - } - - public Long getAmount() { - return amount; - } - - public Integer getPeriod() { - return period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public Boolean getIncludedInMrr() { - return includedInMrr; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.durationType != null) { - - formData.put("duration_type", this.durationType); - } - - if (this.percentage != null) { - - formData.put("percentage", this.percentage); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.includedInMrr != null) { - - formData.put("included_in_mrr", this.includedInMrr); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - return formData; - } - - /** Create a new builder for DiscountsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsBuilder builder() { - return new DiscountsBuilder(); - } - - public static final class DiscountsBuilder { - - private ApplyOn applyOn; - - private DurationType durationType; - - private Number percentage; - - private Long amount; - - private Integer period; - - private PeriodUnit periodUnit; - - private Boolean includedInMrr; - - private String itemPriceId; - - private Integer quantity; - - private DiscountsBuilder() {} - - public DiscountsBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public DiscountsBuilder durationType(DurationType value) { - this.durationType = value; - return this; - } - - public DiscountsBuilder percentage(Number value) { - this.percentage = value; - return this; - } - - public DiscountsBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsBuilder period(Integer value) { - this.period = value; - return this; - } - - public DiscountsBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public DiscountsBuilder includedInMrr(Boolean value) { - this.includedInMrr = value; - return this; - } - - public DiscountsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DiscountsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public DiscountsParams build() { - return new DiscountsParams(this); - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIC_ITEM_PRICE("specific_item_price"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum DurationType { - ONE_TIME("one_time"), - - FOREVER("forever"), - - LIMITED_PERIOD("limited_period"), - - /** An enum member indicating that DurationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DurationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DurationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DurationType enumValue : DurationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemTiersParams { - - private final String itemPriceId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private String itemPriceId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CouponsParams { - - private final String couponId; - - private final Timestamp applyTill; - - private CouponsParams(CouponsBuilder builder) { - - this.couponId = builder.couponId; - - this.applyTill = builder.applyTill; - } - - public String getCouponId() { - return couponId; - } - - public Timestamp getApplyTill() { - return applyTill; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.couponId != null) { - - formData.put("coupon_id", this.couponId); - } - - if (this.applyTill != null) { - - formData.put("apply_till", this.applyTill); - } - - return formData; - } - - /** Create a new builder for CouponsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CouponsBuilder builder() { - return new CouponsBuilder(); - } - - public static final class CouponsBuilder { - - private String couponId; - - private Timestamp applyTill; - - private CouponsBuilder() {} - - public CouponsBuilder couponId(String value) { - this.couponId = value; - return this; - } - - public CouponsBuilder applyTill(Timestamp value) { - this.applyTill = value; - return this; - } - - public CouponsParams build() { - return new CouponsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportContractTermParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportContractTermParams.java new file mode 100644 index 00000000..49008c13 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportContractTermParams.java @@ -0,0 +1,419 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class SubscriptionImportContractTermParams { + + private final Integer contractTermBillingCycleOnRenewal; + + private final ContractTermParams contractTerm; + + private SubscriptionImportContractTermParams(SubscriptionImportContractTermBuilder builder) { + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + + this.contractTerm = builder.contractTerm; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for SubscriptionImportContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionImportContractTermBuilder builder() { + return new SubscriptionImportContractTermBuilder(); + } + + public static final class SubscriptionImportContractTermBuilder { + + private Integer contractTermBillingCycleOnRenewal; + + private ContractTermParams contractTerm; + + private SubscriptionImportContractTermBuilder() {} + + public SubscriptionImportContractTermBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionImportContractTermBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public SubscriptionImportContractTermParams build() { + return new SubscriptionImportContractTermParams(this); + } + } + + public static final class ContractTermParams { + + private final String id; + + private final Timestamp createdAt; + + private final Timestamp contractStart; + + private final Timestamp contractEnd; + + private final Status status; + + private final Long totalAmountRaised; + + private final Long totalAmountRaisedBeforeTax; + + private final Long totalContractValue; + + private final Long totalContractValueBeforeTax; + + private final Integer billingCycle; + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.id = builder.id; + + this.createdAt = builder.createdAt; + + this.contractStart = builder.contractStart; + + this.contractEnd = builder.contractEnd; + + this.status = builder.status; + + this.totalAmountRaised = builder.totalAmountRaised; + + this.totalAmountRaisedBeforeTax = builder.totalAmountRaisedBeforeTax; + + this.totalContractValue = builder.totalContractValue; + + this.totalContractValueBeforeTax = builder.totalContractValueBeforeTax; + + this.billingCycle = builder.billingCycle; + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public String getId() { + return id; + } + + public Timestamp getCreatedAt() { + return createdAt; + } + + public Timestamp getContractStart() { + return contractStart; + } + + public Timestamp getContractEnd() { + return contractEnd; + } + + public Status getStatus() { + return status; + } + + public Long getTotalAmountRaised() { + return totalAmountRaised; + } + + public Long getTotalAmountRaisedBeforeTax() { + return totalAmountRaisedBeforeTax; + } + + public Long getTotalContractValue() { + return totalContractValue; + } + + public Long getTotalContractValueBeforeTax() { + return totalContractValueBeforeTax; + } + + public Integer getBillingCycle() { + return billingCycle; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.createdAt != null) { + + formData.put("created_at", this.createdAt); + } + + if (this.contractStart != null) { + + formData.put("contract_start", this.contractStart); + } + + if (this.contractEnd != null) { + + formData.put("contract_end", this.contractEnd); + } + + if (this.status != null) { + + formData.put("status", this.status); + } + + if (this.totalAmountRaised != null) { + + formData.put("total_amount_raised", this.totalAmountRaised); + } + + if (this.totalAmountRaisedBeforeTax != null) { + + formData.put("total_amount_raised_before_tax", this.totalAmountRaisedBeforeTax); + } + + if (this.totalContractValue != null) { + + formData.put("total_contract_value", this.totalContractValue); + } + + if (this.totalContractValueBeforeTax != null) { + + formData.put("total_contract_value_before_tax", this.totalContractValueBeforeTax); + } + + if (this.billingCycle != null) { + + formData.put("billing_cycle", this.billingCycle); + } + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private String id; + + private Timestamp createdAt; + + private Timestamp contractStart; + + private Timestamp contractEnd; + + private Status status; + + private Long totalAmountRaised; + + private Long totalAmountRaisedBeforeTax; + + private Long totalContractValue; + + private Long totalContractValueBeforeTax; + + private Integer billingCycle; + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder id(String value) { + this.id = value; + return this; + } + + public ContractTermBuilder createdAt(Timestamp value) { + this.createdAt = value; + return this; + } + + public ContractTermBuilder contractStart(Timestamp value) { + this.contractStart = value; + return this; + } + + public ContractTermBuilder contractEnd(Timestamp value) { + this.contractEnd = value; + return this; + } + + public ContractTermBuilder status(Status value) { + this.status = value; + return this; + } + + public ContractTermBuilder totalAmountRaised(Long value) { + this.totalAmountRaised = value; + return this; + } + + public ContractTermBuilder totalAmountRaisedBeforeTax(Long value) { + this.totalAmountRaisedBeforeTax = value; + return this; + } + + public ContractTermBuilder totalContractValue(Long value) { + this.totalContractValue = value; + return this; + } + + public ContractTermBuilder totalContractValueBeforeTax(Long value) { + this.totalContractValueBeforeTax = value; + return this; + } + + public ContractTermBuilder billingCycle(Integer value) { + this.billingCycle = value; + return this; + } + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum Status { + ACTIVE("active"), + + COMPLETED("completed"), + + CANCELLED("cancelled"), + + TERMINATED("terminated"), + + /** An enum member indicating that Status was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Status(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Status fromString(String value) { + if (value == null) return _UNKNOWN; + for (Status enumValue : Status.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + RENEW_ONCE("renew_once"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForCustomerParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForCustomerParams.java new file mode 100644 index 00000000..7030eff9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForCustomerParams.java @@ -0,0 +1,2112 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class SubscriptionImportForCustomerParams { + + private final String id; + + private final String planId; + + private final Integer planQuantity; + + private final String planQuantityInDecimal; + + private final Long planUnitPrice; + + private final String planUnitPriceInDecimal; + + private final Long setupFee; + + private final Timestamp trialEnd; + + private final Integer billingCycles; + + private final Timestamp startDate; + + private final AutoCollection autoCollection; + + private final String poNumber; + + private final List couponIds; + + private final String paymentSourceId; + + private final Status status; + + private final Timestamp currentTermEnd; + + private final Timestamp currentTermStart; + + private final Timestamp trialStart; + + private final Timestamp cancelledAt; + + private final Timestamp startedAt; + + private final Timestamp activatedAt; + + private final Timestamp pauseDate; + + private final Timestamp resumeDate; + + private final Integer contractTermBillingCycleOnRenewal; + + private final Boolean createCurrentTermInvoice; + + private final String invoiceNotes; + + private final java.util.Map metaData; + + private final ContractTermParams contractTerm; + + private final TransactionParams transaction; + + private final ShippingAddressParams shippingAddress; + + private final List addons; + + private final List eventBasedAddons; + + private final List chargedEventBasedAddons; + + private final List coupons; + + private final Map customFields; + + private SubscriptionImportForCustomerParams(SubscriptionImportForCustomerBuilder builder) { + + this.id = builder.id; + + this.planId = builder.planId; + + this.planQuantity = builder.planQuantity; + + this.planQuantityInDecimal = builder.planQuantityInDecimal; + + this.planUnitPrice = builder.planUnitPrice; + + this.planUnitPriceInDecimal = builder.planUnitPriceInDecimal; + + this.setupFee = builder.setupFee; + + this.trialEnd = builder.trialEnd; + + this.billingCycles = builder.billingCycles; + + this.startDate = builder.startDate; + + this.autoCollection = builder.autoCollection; + + this.poNumber = builder.poNumber; + + this.couponIds = builder.couponIds; + + this.paymentSourceId = builder.paymentSourceId; + + this.status = builder.status; + + this.currentTermEnd = builder.currentTermEnd; + + this.currentTermStart = builder.currentTermStart; + + this.trialStart = builder.trialStart; + + this.cancelledAt = builder.cancelledAt; + + this.startedAt = builder.startedAt; + + this.activatedAt = builder.activatedAt; + + this.pauseDate = builder.pauseDate; + + this.resumeDate = builder.resumeDate; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + + this.createCurrentTermInvoice = builder.createCurrentTermInvoice; + + this.invoiceNotes = builder.invoiceNotes; + + this.metaData = builder.metaData; + + this.contractTerm = builder.contractTerm; + + this.transaction = builder.transaction; + + this.shippingAddress = builder.shippingAddress; + + this.addons = builder.addons; + + this.eventBasedAddons = builder.eventBasedAddons; + + this.chargedEventBasedAddons = builder.chargedEventBasedAddons; + + this.coupons = builder.coupons; + + this.customFields = + builder.customFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); + } + + public String getId() { + return id; + } + + public String getPlanId() { + return planId; + } + + public Integer getPlanQuantity() { + return planQuantity; + } + + public String getPlanQuantityInDecimal() { + return planQuantityInDecimal; + } + + public Long getPlanUnitPrice() { + return planUnitPrice; + } + + public String getPlanUnitPriceInDecimal() { + return planUnitPriceInDecimal; + } + + public Long getSetupFee() { + return setupFee; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getStartDate() { + return startDate; + } + + public AutoCollection getAutoCollection() { + return autoCollection; + } + + public String getPoNumber() { + return poNumber; + } + + public List getCouponIds() { + return couponIds; + } + + public String getPaymentSourceId() { + return paymentSourceId; + } + + public Status getStatus() { + return status; + } + + public Timestamp getCurrentTermEnd() { + return currentTermEnd; + } + + public Timestamp getCurrentTermStart() { + return currentTermStart; + } + + public Timestamp getTrialStart() { + return trialStart; + } + + public Timestamp getCancelledAt() { + return cancelledAt; + } + + public Timestamp getStartedAt() { + return startedAt; + } + + public Timestamp getActivatedAt() { + return activatedAt; + } + + public Timestamp getPauseDate() { + return pauseDate; + } + + public Timestamp getResumeDate() { + return resumeDate; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + public Boolean getCreateCurrentTermInvoice() { + return createCurrentTermInvoice; + } + + public String getInvoiceNotes() { + return invoiceNotes; + } + + public java.util.Map getMetaData() { + return metaData; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public TransactionParams getTransaction() { + return transaction; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public List getAddons() { + return addons; + } + + public List getEventBasedAddons() { + return eventBasedAddons; + } + + public List getChargedEventBasedAddons() { + return chargedEventBasedAddons; + } + + public List getCoupons() { + return coupons; + } + + public Map customFields() { + return customFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.planId != null) { + + formData.put("plan_id", this.planId); + } + + if (this.planQuantity != null) { + + formData.put("plan_quantity", this.planQuantity); + } + + if (this.planQuantityInDecimal != null) { + + formData.put("plan_quantity_in_decimal", this.planQuantityInDecimal); + } + + if (this.planUnitPrice != null) { + + formData.put("plan_unit_price", this.planUnitPrice); + } + + if (this.planUnitPriceInDecimal != null) { + + formData.put("plan_unit_price_in_decimal", this.planUnitPriceInDecimal); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.autoCollection != null) { + + formData.put("auto_collection", this.autoCollection); + } + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.paymentSourceId != null) { + + formData.put("payment_source_id", this.paymentSourceId); + } + + if (this.status != null) { + + formData.put("status", this.status); + } + + if (this.currentTermEnd != null) { + + formData.put("current_term_end", this.currentTermEnd); + } + + if (this.currentTermStart != null) { + + formData.put("current_term_start", this.currentTermStart); + } + + if (this.trialStart != null) { + + formData.put("trial_start", this.trialStart); + } + + if (this.cancelledAt != null) { + + formData.put("cancelled_at", this.cancelledAt); + } + + if (this.startedAt != null) { + + formData.put("started_at", this.startedAt); + } + + if (this.activatedAt != null) { + + formData.put("activated_at", this.activatedAt); + } + + if (this.pauseDate != null) { + + formData.put("pause_date", this.pauseDate); + } + + if (this.resumeDate != null) { + + formData.put("resume_date", this.resumeDate); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + if (this.createCurrentTermInvoice != null) { + + formData.put("create_current_term_invoice", this.createCurrentTermInvoice); + } + + if (this.invoiceNotes != null) { + + formData.put("invoice_notes", this.invoiceNotes); + } + + if (this.metaData != null) { + + formData.put("meta_data", JsonUtil.toJson(this.metaData)); + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.transaction != null) { + + // Single object + Map nestedData = this.transaction.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "transaction[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.addons != null) { + + // List of objects + for (int i = 0; i < this.addons.size(); i++) { + AddonsParams item = this.addons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.eventBasedAddons != null) { + + // List of objects + for (int i = 0; i < this.eventBasedAddons.size(); i++) { + EventBasedAddonsParams item = this.eventBasedAddons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "event_based_addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.chargedEventBasedAddons != null) { + + // List of objects + for (int i = 0; i < this.chargedEventBasedAddons.size(); i++) { + ChargedEventBasedAddonsParams item = this.chargedEventBasedAddons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "charged_event_based_addons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.coupons != null) { + + // List of objects + for (int i = 0; i < this.coupons.size(); i++) { + CouponsParams item = this.coupons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(customFields); + + return formData; + } + + /** Create a new builder for SubscriptionImportForCustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionImportForCustomerBuilder builder() { + return new SubscriptionImportForCustomerBuilder(); + } + + public static final class SubscriptionImportForCustomerBuilder { + + private String id; + + private String planId; + + private Integer planQuantity; + + private String planQuantityInDecimal; + + private Long planUnitPrice; + + private String planUnitPriceInDecimal; + + private Long setupFee; + + private Timestamp trialEnd; + + private Integer billingCycles; + + private Timestamp startDate; + + private AutoCollection autoCollection; + + private String poNumber; + + private List couponIds; + + private String paymentSourceId; + + private Status status; + + private Timestamp currentTermEnd; + + private Timestamp currentTermStart; + + private Timestamp trialStart; + + private Timestamp cancelledAt; + + private Timestamp startedAt; + + private Timestamp activatedAt; + + private Timestamp pauseDate; + + private Timestamp resumeDate; + + private Integer contractTermBillingCycleOnRenewal; + + private Boolean createCurrentTermInvoice; + + private String invoiceNotes; + + private java.util.Map metaData; + + private ContractTermParams contractTerm; + + private TransactionParams transaction; + + private ShippingAddressParams shippingAddress; + + private List addons; + + private List eventBasedAddons; + + private List chargedEventBasedAddons; + + private List coupons; + + private Map customFields = new LinkedHashMap<>(); + + private SubscriptionImportForCustomerBuilder() {} + + public SubscriptionImportForCustomerBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionImportForCustomerBuilder planId(String value) { + this.planId = value; + return this; + } + + public SubscriptionImportForCustomerBuilder planQuantity(Integer value) { + this.planQuantity = value; + return this; + } + + public SubscriptionImportForCustomerBuilder planQuantityInDecimal(String value) { + this.planQuantityInDecimal = value; + return this; + } + + public SubscriptionImportForCustomerBuilder planUnitPrice(Long value) { + this.planUnitPrice = value; + return this; + } + + public SubscriptionImportForCustomerBuilder planUnitPriceInDecimal(String value) { + this.planUnitPriceInDecimal = value; + return this; + } + + public SubscriptionImportForCustomerBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionImportForCustomerBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionImportForCustomerBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public SubscriptionImportForCustomerBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionImportForCustomerBuilder autoCollection(AutoCollection value) { + this.autoCollection = value; + return this; + } + + public SubscriptionImportForCustomerBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public SubscriptionImportForCustomerBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public SubscriptionImportForCustomerBuilder paymentSourceId(String value) { + this.paymentSourceId = value; + return this; + } + + public SubscriptionImportForCustomerBuilder status(Status value) { + this.status = value; + return this; + } + + public SubscriptionImportForCustomerBuilder currentTermEnd(Timestamp value) { + this.currentTermEnd = value; + return this; + } + + public SubscriptionImportForCustomerBuilder currentTermStart(Timestamp value) { + this.currentTermStart = value; + return this; + } + + public SubscriptionImportForCustomerBuilder trialStart(Timestamp value) { + this.trialStart = value; + return this; + } + + public SubscriptionImportForCustomerBuilder cancelledAt(Timestamp value) { + this.cancelledAt = value; + return this; + } + + public SubscriptionImportForCustomerBuilder startedAt(Timestamp value) { + this.startedAt = value; + return this; + } + + public SubscriptionImportForCustomerBuilder activatedAt(Timestamp value) { + this.activatedAt = value; + return this; + } + + public SubscriptionImportForCustomerBuilder pauseDate(Timestamp value) { + this.pauseDate = value; + return this; + } + + public SubscriptionImportForCustomerBuilder resumeDate(Timestamp value) { + this.resumeDate = value; + return this; + } + + public SubscriptionImportForCustomerBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionImportForCustomerBuilder createCurrentTermInvoice(Boolean value) { + this.createCurrentTermInvoice = value; + return this; + } + + public SubscriptionImportForCustomerBuilder invoiceNotes(String value) { + this.invoiceNotes = value; + return this; + } + + public SubscriptionImportForCustomerBuilder metaData(java.util.Map value) { + this.metaData = value; + return this; + } + + public SubscriptionImportForCustomerBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public SubscriptionImportForCustomerBuilder transaction(TransactionParams value) { + this.transaction = value; + return this; + } + + public SubscriptionImportForCustomerBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public SubscriptionImportForCustomerBuilder addons(List value) { + this.addons = value; + return this; + } + + public SubscriptionImportForCustomerBuilder eventBasedAddons( + List value) { + this.eventBasedAddons = value; + return this; + } + + public SubscriptionImportForCustomerBuilder chargedEventBasedAddons( + List value) { + this.chargedEventBasedAddons = value; + return this; + } + + @Deprecated + public SubscriptionImportForCustomerBuilder coupons(List value) { + this.coupons = value; + return this; + } + + /** + * Add a custom field to the request. Custom fields must start with "cf_". + * + * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") + * @param value the value of the custom field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cf_" + */ + public SubscriptionImportForCustomerBuilder customField(String fieldName, String value) { + if (fieldName == null || !fieldName.startsWith("cf_")) { + throw new IllegalArgumentException("Custom field name must start with 'cf_'"); + } + this.customFields.put(fieldName, value); + return this; + } + + /** + * Add multiple custom fields to the request. All field names must start with "cf_". + * + * @param customFields map of custom field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cf_" + */ + public SubscriptionImportForCustomerBuilder customFields(Map customFields) { + if (customFields != null) { + for (Map.Entry entry : customFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { + throw new IllegalArgumentException( + "Custom field name must start with 'cf_': " + entry.getKey()); + } + this.customFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public SubscriptionImportForCustomerParams build() { + return new SubscriptionImportForCustomerParams(this); + } + } + + public enum AutoCollection { + ON("on"), + + OFF("off"), + + /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AutoCollection(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AutoCollection fromString(String value) { + if (value == null) return _UNKNOWN; + for (AutoCollection enumValue : AutoCollection.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum Status { + FUTURE("future"), + + IN_TRIAL("in_trial"), + + ACTIVE("active"), + + NON_RENEWING("non_renewing"), + + PAUSED("paused"), + + CANCELLED("cancelled"), + + TRANSFERRED("transferred"), + + /** An enum member indicating that Status was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Status(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Status fromString(String value) { + if (value == null) return _UNKNOWN; + for (Status enumValue : Status.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class ContractTermParams { + + private final String id; + + private final Timestamp createdAt; + + private final Timestamp contractStart; + + private final Integer billingCycle; + + private final Long totalAmountRaised; + + private final Long totalAmountRaisedBeforeTax; + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.id = builder.id; + + this.createdAt = builder.createdAt; + + this.contractStart = builder.contractStart; + + this.billingCycle = builder.billingCycle; + + this.totalAmountRaised = builder.totalAmountRaised; + + this.totalAmountRaisedBeforeTax = builder.totalAmountRaisedBeforeTax; + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public String getId() { + return id; + } + + public Timestamp getCreatedAt() { + return createdAt; + } + + public Timestamp getContractStart() { + return contractStart; + } + + public Integer getBillingCycle() { + return billingCycle; + } + + public Long getTotalAmountRaised() { + return totalAmountRaised; + } + + public Long getTotalAmountRaisedBeforeTax() { + return totalAmountRaisedBeforeTax; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.createdAt != null) { + + formData.put("created_at", this.createdAt); + } + + if (this.contractStart != null) { + + formData.put("contract_start", this.contractStart); + } + + if (this.billingCycle != null) { + + formData.put("billing_cycle", this.billingCycle); + } + + if (this.totalAmountRaised != null) { + + formData.put("total_amount_raised", this.totalAmountRaised); + } + + if (this.totalAmountRaisedBeforeTax != null) { + + formData.put("total_amount_raised_before_tax", this.totalAmountRaisedBeforeTax); + } + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private String id; + + private Timestamp createdAt; + + private Timestamp contractStart; + + private Integer billingCycle; + + private Long totalAmountRaised; + + private Long totalAmountRaisedBeforeTax; + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder id(String value) { + this.id = value; + return this; + } + + public ContractTermBuilder createdAt(Timestamp value) { + this.createdAt = value; + return this; + } + + public ContractTermBuilder contractStart(Timestamp value) { + this.contractStart = value; + return this; + } + + public ContractTermBuilder billingCycle(Integer value) { + this.billingCycle = value; + return this; + } + + public ContractTermBuilder totalAmountRaised(Long value) { + this.totalAmountRaised = value; + return this; + } + + public ContractTermBuilder totalAmountRaisedBeforeTax(Long value) { + this.totalAmountRaisedBeforeTax = value; + return this; + } + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + RENEW_ONCE("renew_once"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class TransactionParams { + + private final Long amount; + + private final PaymentMethod paymentMethod; + + private final String referenceNumber; + + private final Timestamp date; + + private TransactionParams(TransactionBuilder builder) { + + this.amount = builder.amount; + + this.paymentMethod = builder.paymentMethod; + + this.referenceNumber = builder.referenceNumber; + + this.date = builder.date; + } + + public Long getAmount() { + return amount; + } + + public PaymentMethod getPaymentMethod() { + return paymentMethod; + } + + public String getReferenceNumber() { + return referenceNumber; + } + + public Timestamp getDate() { + return date; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.paymentMethod != null) { + + formData.put("payment_method", this.paymentMethod); + } + + if (this.referenceNumber != null) { + + formData.put("reference_number", this.referenceNumber); + } + + if (this.date != null) { + + formData.put("date", this.date); + } + + return formData; + } + + /** Create a new builder for TransactionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TransactionBuilder builder() { + return new TransactionBuilder(); + } + + public static final class TransactionBuilder { + + private Long amount; + + private PaymentMethod paymentMethod; + + private String referenceNumber; + + private Timestamp date; + + private TransactionBuilder() {} + + public TransactionBuilder amount(Long value) { + this.amount = value; + return this; + } + + public TransactionBuilder paymentMethod(PaymentMethod value) { + this.paymentMethod = value; + return this; + } + + public TransactionBuilder referenceNumber(String value) { + this.referenceNumber = value; + return this; + } + + public TransactionBuilder date(Timestamp value) { + this.date = value; + return this; + } + + public TransactionParams build() { + return new TransactionParams(this); + } + } + + public enum PaymentMethod { + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + OTHER("other"), + + APP_STORE("app_store"), + + PLAY_STORE("play_store"), + + CUSTOM("custom"), + + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethod enumValue : PaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class AddonsParams { + + private final String id; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private AddonsParams(AddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + return formData; + } + + /** Create a new builder for AddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static AddonsBuilder builder() { + return new AddonsBuilder(); + } + + public static final class AddonsBuilder { + + private String id; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private AddonsBuilder() {} + + public AddonsBuilder id(String value) { + this.id = value; + return this; + } + + public AddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public AddonsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public AddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public AddonsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public AddonsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public AddonsParams build() { + return new AddonsParams(this); + } + } + } + + public static final class EventBasedAddonsParams { + + private final String id; + + private final Integer quantity; + + private final Long unitPrice; + + private final String quantityInDecimal; + + private final String unitPriceInDecimal; + + private final Integer servicePeriodInDays; + + private final OnEvent onEvent; + + private final Boolean chargeOnce; + + private EventBasedAddonsParams(EventBasedAddonsBuilder builder) { + + this.id = builder.id; + + this.quantity = builder.quantity; + + this.unitPrice = builder.unitPrice; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.servicePeriodInDays = builder.servicePeriodInDays; + + this.onEvent = builder.onEvent; + + this.chargeOnce = builder.chargeOnce; + } + + public String getId() { + return id; + } + + public Integer getQuantity() { + return quantity; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getServicePeriodInDays() { + return servicePeriodInDays; + } + + public OnEvent getOnEvent() { + return onEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.servicePeriodInDays != null) { + + formData.put("service_period_in_days", this.servicePeriodInDays); + } + + if (this.onEvent != null) { + + formData.put("on_event", this.onEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + return formData; + } + + /** Create a new builder for EventBasedAddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EventBasedAddonsBuilder builder() { + return new EventBasedAddonsBuilder(); + } + + public static final class EventBasedAddonsBuilder { + + private String id; + + private Integer quantity; + + private Long unitPrice; + + private String quantityInDecimal; + + private String unitPriceInDecimal; + + private Integer servicePeriodInDays; + + private OnEvent onEvent; + + private Boolean chargeOnce; + + private EventBasedAddonsBuilder() {} + + public EventBasedAddonsBuilder id(String value) { + this.id = value; + return this; + } + + public EventBasedAddonsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public EventBasedAddonsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public EventBasedAddonsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public EventBasedAddonsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public EventBasedAddonsBuilder servicePeriodInDays(Integer value) { + this.servicePeriodInDays = value; + return this; + } + + public EventBasedAddonsBuilder onEvent(OnEvent value) { + this.onEvent = value; + return this; + } + + public EventBasedAddonsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public EventBasedAddonsParams build() { + return new EventBasedAddonsParams(this); + } + } + + public enum OnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that OnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + OnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (OnEvent enumValue : OnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ChargedEventBasedAddonsParams { + + private final String id; + + private final Timestamp lastChargedAt; + + private ChargedEventBasedAddonsParams(ChargedEventBasedAddonsBuilder builder) { + + this.id = builder.id; + + this.lastChargedAt = builder.lastChargedAt; + } + + public String getId() { + return id; + } + + public Timestamp getLastChargedAt() { + return lastChargedAt; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.lastChargedAt != null) { + + formData.put("last_charged_at", this.lastChargedAt); + } + + return formData; + } + + /** Create a new builder for ChargedEventBasedAddonsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ChargedEventBasedAddonsBuilder builder() { + return new ChargedEventBasedAddonsBuilder(); + } + + public static final class ChargedEventBasedAddonsBuilder { + + private String id; + + private Timestamp lastChargedAt; + + private ChargedEventBasedAddonsBuilder() {} + + public ChargedEventBasedAddonsBuilder id(String value) { + this.id = value; + return this; + } + + public ChargedEventBasedAddonsBuilder lastChargedAt(Timestamp value) { + this.lastChargedAt = value; + return this; + } + + public ChargedEventBasedAddonsParams build() { + return new ChargedEventBasedAddonsParams(this); + } + } + } + + public static final class CouponsParams { + + private final String couponId; + + private final Timestamp applyTill; + + private CouponsParams(CouponsBuilder builder) { + + this.couponId = builder.couponId; + + this.applyTill = builder.applyTill; + } + + public String getCouponId() { + return couponId; + } + + public Timestamp getApplyTill() { + return applyTill; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.couponId != null) { + + formData.put("coupon_id", this.couponId); + } + + if (this.applyTill != null) { + + formData.put("apply_till", this.applyTill); + } + + return formData; + } + + /** Create a new builder for CouponsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponsBuilder builder() { + return new CouponsBuilder(); + } + + public static final class CouponsBuilder { + + private String couponId; + + private Timestamp applyTill; + + private CouponsBuilder() {} + + public CouponsBuilder couponId(String value) { + this.couponId = value; + return this; + } + + public CouponsBuilder applyTill(Timestamp value) { + this.applyTill = value; + return this; + } + + public CouponsParams build() { + return new CouponsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForItemsForCustomerParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForItemsForCustomerParams.java deleted file mode 100644 index 019e2a38..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForItemsForCustomerParams.java +++ /dev/null @@ -1,2627 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class SubscriptionImportForItemsForCustomerParams { - - private final List exhaustedCouponIds; - - private final String id; - - private final Timestamp trialEnd; - - private final Integer billingCycles; - - private final Long setupFee; - - private final Integer netTermDays; - - private final Timestamp startDate; - - private final AutoCollection autoCollection; - - private final String poNumber; - - private final List couponIds; - - private final String paymentSourceId; - - private final Status status; - - private final Timestamp currentTermEnd; - - private final Timestamp currentTermStart; - - private final Timestamp trialStart; - - private final Timestamp cancelledAt; - - private final Timestamp startedAt; - - private final Timestamp activatedAt; - - private final Timestamp pauseDate; - - private final Timestamp resumeDate; - - private final Integer contractTermBillingCycleOnRenewal; - - private final Boolean createCurrentTermInvoice; - - private final String invoiceNotes; - - private final java.util.Map metaData; - - private final String cancelReasonCode; - - private final Boolean createPendingInvoices; - - private final Boolean autoCloseInvoices; - - private final ContractTermParams contractTerm; - - private final TransactionParams transaction; - - private final ShippingAddressParams shippingAddress; - - private final List subscriptionItems; - - private final List discounts; - - private final List chargedItems; - - private final List itemTiers; - - private final List coupons; - - private final Map customFields; - - private SubscriptionImportForItemsForCustomerParams( - SubscriptionImportForItemsForCustomerBuilder builder) { - - this.exhaustedCouponIds = builder.exhaustedCouponIds; - - this.id = builder.id; - - this.trialEnd = builder.trialEnd; - - this.billingCycles = builder.billingCycles; - - this.setupFee = builder.setupFee; - - this.netTermDays = builder.netTermDays; - - this.startDate = builder.startDate; - - this.autoCollection = builder.autoCollection; - - this.poNumber = builder.poNumber; - - this.couponIds = builder.couponIds; - - this.paymentSourceId = builder.paymentSourceId; - - this.status = builder.status; - - this.currentTermEnd = builder.currentTermEnd; - - this.currentTermStart = builder.currentTermStart; - - this.trialStart = builder.trialStart; - - this.cancelledAt = builder.cancelledAt; - - this.startedAt = builder.startedAt; - - this.activatedAt = builder.activatedAt; - - this.pauseDate = builder.pauseDate; - - this.resumeDate = builder.resumeDate; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - - this.createCurrentTermInvoice = builder.createCurrentTermInvoice; - - this.invoiceNotes = builder.invoiceNotes; - - this.metaData = builder.metaData; - - this.cancelReasonCode = builder.cancelReasonCode; - - this.createPendingInvoices = builder.createPendingInvoices; - - this.autoCloseInvoices = builder.autoCloseInvoices; - - this.contractTerm = builder.contractTerm; - - this.transaction = builder.transaction; - - this.shippingAddress = builder.shippingAddress; - - this.subscriptionItems = builder.subscriptionItems; - - this.discounts = builder.discounts; - - this.chargedItems = builder.chargedItems; - - this.itemTiers = builder.itemTiers; - - this.coupons = builder.coupons; - - this.customFields = - builder.customFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); - } - - public List getExhaustedCouponIds() { - return exhaustedCouponIds; - } - - public String getId() { - return id; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Long getSetupFee() { - return setupFee; - } - - public Integer getNetTermDays() { - return netTermDays; - } - - public Timestamp getStartDate() { - return startDate; - } - - public AutoCollection getAutoCollection() { - return autoCollection; - } - - public String getPoNumber() { - return poNumber; - } - - public List getCouponIds() { - return couponIds; - } - - public String getPaymentSourceId() { - return paymentSourceId; - } - - public Status getStatus() { - return status; - } - - public Timestamp getCurrentTermEnd() { - return currentTermEnd; - } - - public Timestamp getCurrentTermStart() { - return currentTermStart; - } - - public Timestamp getTrialStart() { - return trialStart; - } - - public Timestamp getCancelledAt() { - return cancelledAt; - } - - public Timestamp getStartedAt() { - return startedAt; - } - - public Timestamp getActivatedAt() { - return activatedAt; - } - - public Timestamp getPauseDate() { - return pauseDate; - } - - public Timestamp getResumeDate() { - return resumeDate; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - public Boolean getCreateCurrentTermInvoice() { - return createCurrentTermInvoice; - } - - public String getInvoiceNotes() { - return invoiceNotes; - } - - public java.util.Map getMetaData() { - return metaData; - } - - public String getCancelReasonCode() { - return cancelReasonCode; - } - - public Boolean getCreatePendingInvoices() { - return createPendingInvoices; - } - - public Boolean getAutoCloseInvoices() { - return autoCloseInvoices; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public TransactionParams getTransaction() { - return transaction; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public List getSubscriptionItems() { - return subscriptionItems; - } - - public List getDiscounts() { - return discounts; - } - - public List getChargedItems() { - return chargedItems; - } - - public List getItemTiers() { - return itemTiers; - } - - public List getCoupons() { - return coupons; - } - - public Map customFields() { - return customFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.exhaustedCouponIds != null) { - - formData.put("exhausted_coupon_ids", this.exhaustedCouponIds); - } - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.netTermDays != null) { - - formData.put("net_term_days", this.netTermDays); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.autoCollection != null) { - - formData.put("auto_collection", this.autoCollection); - } - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.paymentSourceId != null) { - - formData.put("payment_source_id", this.paymentSourceId); - } - - if (this.status != null) { - - formData.put("status", this.status); - } - - if (this.currentTermEnd != null) { - - formData.put("current_term_end", this.currentTermEnd); - } - - if (this.currentTermStart != null) { - - formData.put("current_term_start", this.currentTermStart); - } - - if (this.trialStart != null) { - - formData.put("trial_start", this.trialStart); - } - - if (this.cancelledAt != null) { - - formData.put("cancelled_at", this.cancelledAt); - } - - if (this.startedAt != null) { - - formData.put("started_at", this.startedAt); - } - - if (this.activatedAt != null) { - - formData.put("activated_at", this.activatedAt); - } - - if (this.pauseDate != null) { - - formData.put("pause_date", this.pauseDate); - } - - if (this.resumeDate != null) { - - formData.put("resume_date", this.resumeDate); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - if (this.createCurrentTermInvoice != null) { - - formData.put("create_current_term_invoice", this.createCurrentTermInvoice); - } - - if (this.invoiceNotes != null) { - - formData.put("invoice_notes", this.invoiceNotes); - } - - if (this.metaData != null) { - - formData.put("meta_data", JsonUtil.toJson(this.metaData)); - } - - if (this.cancelReasonCode != null) { - - formData.put("cancel_reason_code", this.cancelReasonCode); - } - - if (this.createPendingInvoices != null) { - - formData.put("create_pending_invoices", this.createPendingInvoices); - } - - if (this.autoCloseInvoices != null) { - - formData.put("auto_close_invoices", this.autoCloseInvoices); - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.transaction != null) { - - // Single object - Map nestedData = this.transaction.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "transaction[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.subscriptionItems != null) { - - // List of objects - for (int i = 0; i < this.subscriptionItems.size(); i++) { - SubscriptionItemsParams item = this.subscriptionItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discounts != null) { - - // List of objects - for (int i = 0; i < this.discounts.size(); i++) { - DiscountsParams item = this.discounts.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.chargedItems != null) { - - // List of objects - for (int i = 0; i < this.chargedItems.size(); i++) { - ChargedItemsParams item = this.chargedItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "charged_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.coupons != null) { - - // List of objects - for (int i = 0; i < this.coupons.size(); i++) { - CouponsParams item = this.coupons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(customFields); - - return formData; - } - - /** Create a new builder for SubscriptionImportForItemsForCustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionImportForItemsForCustomerBuilder builder() { - return new SubscriptionImportForItemsForCustomerBuilder(); - } - - public static final class SubscriptionImportForItemsForCustomerBuilder { - - private List exhaustedCouponIds; - - private String id; - - private Timestamp trialEnd; - - private Integer billingCycles; - - private Long setupFee; - - private Integer netTermDays; - - private Timestamp startDate; - - private AutoCollection autoCollection; - - private String poNumber; - - private List couponIds; - - private String paymentSourceId; - - private Status status; - - private Timestamp currentTermEnd; - - private Timestamp currentTermStart; - - private Timestamp trialStart; - - private Timestamp cancelledAt; - - private Timestamp startedAt; - - private Timestamp activatedAt; - - private Timestamp pauseDate; - - private Timestamp resumeDate; - - private Integer contractTermBillingCycleOnRenewal; - - private Boolean createCurrentTermInvoice; - - private String invoiceNotes; - - private java.util.Map metaData; - - private String cancelReasonCode; - - private Boolean createPendingInvoices; - - private Boolean autoCloseInvoices; - - private ContractTermParams contractTerm; - - private TransactionParams transaction; - - private ShippingAddressParams shippingAddress; - - private List subscriptionItems; - - private List discounts; - - private List chargedItems; - - private List itemTiers; - - private List coupons; - - private Map customFields = new LinkedHashMap<>(); - - private SubscriptionImportForItemsForCustomerBuilder() {} - - public SubscriptionImportForItemsForCustomerBuilder exhaustedCouponIds(List value) { - this.exhaustedCouponIds = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder id(String value) { - this.id = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - @Deprecated - public SubscriptionImportForItemsForCustomerBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder netTermDays(Integer value) { - this.netTermDays = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder autoCollection(AutoCollection value) { - this.autoCollection = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder paymentSourceId(String value) { - this.paymentSourceId = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder status(Status value) { - this.status = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder currentTermEnd(Timestamp value) { - this.currentTermEnd = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder currentTermStart(Timestamp value) { - this.currentTermStart = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder trialStart(Timestamp value) { - this.trialStart = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder cancelledAt(Timestamp value) { - this.cancelledAt = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder startedAt(Timestamp value) { - this.startedAt = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder activatedAt(Timestamp value) { - this.activatedAt = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder pauseDate(Timestamp value) { - this.pauseDate = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder resumeDate(Timestamp value) { - this.resumeDate = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder contractTermBillingCycleOnRenewal( - Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder createCurrentTermInvoice(Boolean value) { - this.createCurrentTermInvoice = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder invoiceNotes(String value) { - this.invoiceNotes = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder metaData( - java.util.Map value) { - this.metaData = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder cancelReasonCode(String value) { - this.cancelReasonCode = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder createPendingInvoices(Boolean value) { - this.createPendingInvoices = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder autoCloseInvoices(Boolean value) { - this.autoCloseInvoices = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder transaction(TransactionParams value) { - this.transaction = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder shippingAddress( - ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder subscriptionItems( - List value) { - this.subscriptionItems = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder discounts(List value) { - this.discounts = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder chargedItems( - List value) { - this.chargedItems = value; - return this; - } - - public SubscriptionImportForItemsForCustomerBuilder itemTiers(List value) { - this.itemTiers = value; - return this; - } - - @Deprecated - public SubscriptionImportForItemsForCustomerBuilder coupons(List value) { - this.coupons = value; - return this; - } - - /** - * Add a custom field to the request. Custom fields must start with "cf_". - * - * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") - * @param value the value of the custom field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cf_" - */ - public SubscriptionImportForItemsForCustomerBuilder customField( - String fieldName, String value) { - if (fieldName == null || !fieldName.startsWith("cf_")) { - throw new IllegalArgumentException("Custom field name must start with 'cf_'"); - } - this.customFields.put(fieldName, value); - return this; - } - - /** - * Add multiple custom fields to the request. All field names must start with "cf_". - * - * @param customFields map of custom field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cf_" - */ - public SubscriptionImportForItemsForCustomerBuilder customFields( - Map customFields) { - if (customFields != null) { - for (Map.Entry entry : customFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { - throw new IllegalArgumentException( - "Custom field name must start with 'cf_': " + entry.getKey()); - } - this.customFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public SubscriptionImportForItemsForCustomerParams build() { - return new SubscriptionImportForItemsForCustomerParams(this); - } - } - - public enum AutoCollection { - ON("on"), - - OFF("off"), - - /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AutoCollection(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AutoCollection fromString(String value) { - if (value == null) return _UNKNOWN; - for (AutoCollection enumValue : AutoCollection.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum Status { - FUTURE("future"), - - IN_TRIAL("in_trial"), - - ACTIVE("active"), - - NON_RENEWING("non_renewing"), - - PAUSED("paused"), - - CANCELLED("cancelled"), - - TRANSFERRED("transferred"), - - /** An enum member indicating that Status was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Status(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Status fromString(String value) { - if (value == null) return _UNKNOWN; - for (Status enumValue : Status.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class ContractTermParams { - - private final String id; - - private final Timestamp createdAt; - - private final Timestamp contractStart; - - private final Integer billingCycle; - - private final Long totalAmountRaised; - - private final Long totalAmountRaisedBeforeTax; - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private ContractTermParams(ContractTermBuilder builder) { - - this.id = builder.id; - - this.createdAt = builder.createdAt; - - this.contractStart = builder.contractStart; - - this.billingCycle = builder.billingCycle; - - this.totalAmountRaised = builder.totalAmountRaised; - - this.totalAmountRaisedBeforeTax = builder.totalAmountRaisedBeforeTax; - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - } - - public String getId() { - return id; - } - - public Timestamp getCreatedAt() { - return createdAt; - } - - public Timestamp getContractStart() { - return contractStart; - } - - public Integer getBillingCycle() { - return billingCycle; - } - - public Long getTotalAmountRaised() { - return totalAmountRaised; - } - - public Long getTotalAmountRaisedBeforeTax() { - return totalAmountRaisedBeforeTax; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.createdAt != null) { - - formData.put("created_at", this.createdAt); - } - - if (this.contractStart != null) { - - formData.put("contract_start", this.contractStart); - } - - if (this.billingCycle != null) { - - formData.put("billing_cycle", this.billingCycle); - } - - if (this.totalAmountRaised != null) { - - formData.put("total_amount_raised", this.totalAmountRaised); - } - - if (this.totalAmountRaisedBeforeTax != null) { - - formData.put("total_amount_raised_before_tax", this.totalAmountRaisedBeforeTax); - } - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private String id; - - private Timestamp createdAt; - - private Timestamp contractStart; - - private Integer billingCycle; - - private Long totalAmountRaised; - - private Long totalAmountRaisedBeforeTax; - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private ContractTermBuilder() {} - - public ContractTermBuilder id(String value) { - this.id = value; - return this; - } - - public ContractTermBuilder createdAt(Timestamp value) { - this.createdAt = value; - return this; - } - - public ContractTermBuilder contractStart(Timestamp value) { - this.contractStart = value; - return this; - } - - public ContractTermBuilder billingCycle(Integer value) { - this.billingCycle = value; - return this; - } - - public ContractTermBuilder totalAmountRaised(Long value) { - this.totalAmountRaised = value; - return this; - } - - public ContractTermBuilder totalAmountRaisedBeforeTax(Long value) { - this.totalAmountRaisedBeforeTax = value; - return this; - } - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - RENEW_ONCE("renew_once"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class TransactionParams { - - private final Long amount; - - private final PaymentMethod paymentMethod; - - private final String referenceNumber; - - private final Timestamp date; - - private TransactionParams(TransactionBuilder builder) { - - this.amount = builder.amount; - - this.paymentMethod = builder.paymentMethod; - - this.referenceNumber = builder.referenceNumber; - - this.date = builder.date; - } - - public Long getAmount() { - return amount; - } - - public PaymentMethod getPaymentMethod() { - return paymentMethod; - } - - public String getReferenceNumber() { - return referenceNumber; - } - - public Timestamp getDate() { - return date; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.paymentMethod != null) { - - formData.put("payment_method", this.paymentMethod); - } - - if (this.referenceNumber != null) { - - formData.put("reference_number", this.referenceNumber); - } - - if (this.date != null) { - - formData.put("date", this.date); - } - - return formData; - } - - /** Create a new builder for TransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TransactionBuilder builder() { - return new TransactionBuilder(); - } - - public static final class TransactionBuilder { - - private Long amount; - - private PaymentMethod paymentMethod; - - private String referenceNumber; - - private Timestamp date; - - private TransactionBuilder() {} - - public TransactionBuilder amount(Long value) { - this.amount = value; - return this; - } - - public TransactionBuilder paymentMethod(PaymentMethod value) { - this.paymentMethod = value; - return this; - } - - public TransactionBuilder referenceNumber(String value) { - this.referenceNumber = value; - return this; - } - - public TransactionBuilder date(Timestamp value) { - this.date = value; - return this; - } - - public TransactionParams build() { - return new TransactionParams(this); - } - } - - public enum PaymentMethod { - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - OTHER("other"), - - APP_STORE("app_store"), - - PLAY_STORE("play_store"), - - CUSTOM("custom"), - - /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethod enumValue : PaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class SubscriptionItemsParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Timestamp trialEnd; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ItemType itemType; - - private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.trialEnd = builder.trialEnd; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.itemType = builder.itemType; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ItemType getItemType() { - return itemType; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.itemType != null) { - - formData.put("item_type", this.itemType); - } - - return formData; - } - - /** Create a new builder for SubscriptionItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionItemsBuilder builder() { - return new SubscriptionItemsBuilder(); - } - - public static final class SubscriptionItemsBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Timestamp trialEnd; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ItemType itemType; - - private SubscriptionItemsBuilder() {} - - public SubscriptionItemsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public SubscriptionItemsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public SubscriptionItemsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public SubscriptionItemsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public SubscriptionItemsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionItemsBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public SubscriptionItemsBuilder itemType(ItemType value) { - this.itemType = value; - return this; - } - - public SubscriptionItemsParams build() { - return new SubscriptionItemsParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ItemType { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemType enumValue : ItemType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class DiscountsParams { - - private final ApplyOn applyOn; - - private final DurationType durationType; - - private final Number percentage; - - private final Long amount; - - private final Integer period; - - private final PeriodUnit periodUnit; - - private final Boolean includedInMrr; - - private final String itemPriceId; - - private final Integer quantity; - - private DiscountsParams(DiscountsBuilder builder) { - - this.applyOn = builder.applyOn; - - this.durationType = builder.durationType; - - this.percentage = builder.percentage; - - this.amount = builder.amount; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - - this.includedInMrr = builder.includedInMrr; - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public DurationType getDurationType() { - return durationType; - } - - public Number getPercentage() { - return percentage; - } - - public Long getAmount() { - return amount; - } - - public Integer getPeriod() { - return period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public Boolean getIncludedInMrr() { - return includedInMrr; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.durationType != null) { - - formData.put("duration_type", this.durationType); - } - - if (this.percentage != null) { - - formData.put("percentage", this.percentage); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.includedInMrr != null) { - - formData.put("included_in_mrr", this.includedInMrr); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - return formData; - } - - /** Create a new builder for DiscountsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsBuilder builder() { - return new DiscountsBuilder(); - } - - public static final class DiscountsBuilder { - - private ApplyOn applyOn; - - private DurationType durationType; - - private Number percentage; - - private Long amount; - - private Integer period; - - private PeriodUnit periodUnit; - - private Boolean includedInMrr; - - private String itemPriceId; - - private Integer quantity; - - private DiscountsBuilder() {} - - public DiscountsBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public DiscountsBuilder durationType(DurationType value) { - this.durationType = value; - return this; - } - - public DiscountsBuilder percentage(Number value) { - this.percentage = value; - return this; - } - - public DiscountsBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsBuilder period(Integer value) { - this.period = value; - return this; - } - - public DiscountsBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public DiscountsBuilder includedInMrr(Boolean value) { - this.includedInMrr = value; - return this; - } - - public DiscountsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DiscountsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public DiscountsParams build() { - return new DiscountsParams(this); - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIC_ITEM_PRICE("specific_item_price"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum DurationType { - ONE_TIME("one_time"), - - FOREVER("forever"), - - LIMITED_PERIOD("limited_period"), - - /** An enum member indicating that DurationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DurationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DurationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DurationType enumValue : DurationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ChargedItemsParams { - - private final String itemPriceId; - - private final Timestamp lastChargedAt; - - private ChargedItemsParams(ChargedItemsBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.lastChargedAt = builder.lastChargedAt; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Timestamp getLastChargedAt() { - return lastChargedAt; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.lastChargedAt != null) { - - formData.put("last_charged_at", this.lastChargedAt); - } - - return formData; - } - - /** Create a new builder for ChargedItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ChargedItemsBuilder builder() { - return new ChargedItemsBuilder(); - } - - public static final class ChargedItemsBuilder { - - private String itemPriceId; - - private Timestamp lastChargedAt; - - private ChargedItemsBuilder() {} - - public ChargedItemsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ChargedItemsBuilder lastChargedAt(Timestamp value) { - this.lastChargedAt = value; - return this; - } - - public ChargedItemsParams build() { - return new ChargedItemsParams(this); - } - } - } - - public static final class ItemTiersParams { - - private final String itemPriceId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private String itemPriceId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CouponsParams { - - private final String couponId; - - private final Timestamp applyTill; - - private CouponsParams(CouponsBuilder builder) { - - this.couponId = builder.couponId; - - this.applyTill = builder.applyTill; - } - - public String getCouponId() { - return couponId; - } - - public Timestamp getApplyTill() { - return applyTill; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.couponId != null) { - - formData.put("coupon_id", this.couponId); - } - - if (this.applyTill != null) { - - formData.put("apply_till", this.applyTill); - } - - return formData; - } - - /** Create a new builder for CouponsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CouponsBuilder builder() { - return new CouponsBuilder(); - } - - public static final class CouponsBuilder { - - private String couponId; - - private Timestamp applyTill; - - private CouponsBuilder() {} - - public CouponsBuilder couponId(String value) { - this.couponId = value; - return this; - } - - public CouponsBuilder applyTill(Timestamp value) { - this.applyTill = value; - return this; - } - - public CouponsParams build() { - return new CouponsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForItemsParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForItemsParams.java new file mode 100644 index 00000000..71c5ac6f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForItemsParams.java @@ -0,0 +1,2620 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class SubscriptionImportForItemsParams { + + private final List exhaustedCouponIds; + + private final String id; + + private final Timestamp trialEnd; + + private final Integer billingCycles; + + private final Long setupFee; + + private final Integer netTermDays; + + private final Timestamp startDate; + + private final AutoCollection autoCollection; + + private final String poNumber; + + private final List couponIds; + + private final String paymentSourceId; + + private final Status status; + + private final Timestamp currentTermEnd; + + private final Timestamp currentTermStart; + + private final Timestamp trialStart; + + private final Timestamp cancelledAt; + + private final Timestamp startedAt; + + private final Timestamp activatedAt; + + private final Timestamp pauseDate; + + private final Timestamp resumeDate; + + private final Integer contractTermBillingCycleOnRenewal; + + private final Boolean createCurrentTermInvoice; + + private final String invoiceNotes; + + private final java.util.Map metaData; + + private final String cancelReasonCode; + + private final Boolean createPendingInvoices; + + private final Boolean autoCloseInvoices; + + private final ContractTermParams contractTerm; + + private final TransactionParams transaction; + + private final ShippingAddressParams shippingAddress; + + private final List subscriptionItems; + + private final List discounts; + + private final List chargedItems; + + private final List itemTiers; + + private final List coupons; + + private final Map customFields; + + private SubscriptionImportForItemsParams(SubscriptionImportForItemsBuilder builder) { + + this.exhaustedCouponIds = builder.exhaustedCouponIds; + + this.id = builder.id; + + this.trialEnd = builder.trialEnd; + + this.billingCycles = builder.billingCycles; + + this.setupFee = builder.setupFee; + + this.netTermDays = builder.netTermDays; + + this.startDate = builder.startDate; + + this.autoCollection = builder.autoCollection; + + this.poNumber = builder.poNumber; + + this.couponIds = builder.couponIds; + + this.paymentSourceId = builder.paymentSourceId; + + this.status = builder.status; + + this.currentTermEnd = builder.currentTermEnd; + + this.currentTermStart = builder.currentTermStart; + + this.trialStart = builder.trialStart; + + this.cancelledAt = builder.cancelledAt; + + this.startedAt = builder.startedAt; + + this.activatedAt = builder.activatedAt; + + this.pauseDate = builder.pauseDate; + + this.resumeDate = builder.resumeDate; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + + this.createCurrentTermInvoice = builder.createCurrentTermInvoice; + + this.invoiceNotes = builder.invoiceNotes; + + this.metaData = builder.metaData; + + this.cancelReasonCode = builder.cancelReasonCode; + + this.createPendingInvoices = builder.createPendingInvoices; + + this.autoCloseInvoices = builder.autoCloseInvoices; + + this.contractTerm = builder.contractTerm; + + this.transaction = builder.transaction; + + this.shippingAddress = builder.shippingAddress; + + this.subscriptionItems = builder.subscriptionItems; + + this.discounts = builder.discounts; + + this.chargedItems = builder.chargedItems; + + this.itemTiers = builder.itemTiers; + + this.coupons = builder.coupons; + + this.customFields = + builder.customFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); + } + + public List getExhaustedCouponIds() { + return exhaustedCouponIds; + } + + public String getId() { + return id; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Long getSetupFee() { + return setupFee; + } + + public Integer getNetTermDays() { + return netTermDays; + } + + public Timestamp getStartDate() { + return startDate; + } + + public AutoCollection getAutoCollection() { + return autoCollection; + } + + public String getPoNumber() { + return poNumber; + } + + public List getCouponIds() { + return couponIds; + } + + public String getPaymentSourceId() { + return paymentSourceId; + } + + public Status getStatus() { + return status; + } + + public Timestamp getCurrentTermEnd() { + return currentTermEnd; + } + + public Timestamp getCurrentTermStart() { + return currentTermStart; + } + + public Timestamp getTrialStart() { + return trialStart; + } + + public Timestamp getCancelledAt() { + return cancelledAt; + } + + public Timestamp getStartedAt() { + return startedAt; + } + + public Timestamp getActivatedAt() { + return activatedAt; + } + + public Timestamp getPauseDate() { + return pauseDate; + } + + public Timestamp getResumeDate() { + return resumeDate; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + public Boolean getCreateCurrentTermInvoice() { + return createCurrentTermInvoice; + } + + public String getInvoiceNotes() { + return invoiceNotes; + } + + public java.util.Map getMetaData() { + return metaData; + } + + public String getCancelReasonCode() { + return cancelReasonCode; + } + + public Boolean getCreatePendingInvoices() { + return createPendingInvoices; + } + + public Boolean getAutoCloseInvoices() { + return autoCloseInvoices; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public TransactionParams getTransaction() { + return transaction; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public List getSubscriptionItems() { + return subscriptionItems; + } + + public List getDiscounts() { + return discounts; + } + + public List getChargedItems() { + return chargedItems; + } + + public List getItemTiers() { + return itemTiers; + } + + public List getCoupons() { + return coupons; + } + + public Map customFields() { + return customFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.exhaustedCouponIds != null) { + + formData.put("exhausted_coupon_ids", this.exhaustedCouponIds); + } + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.netTermDays != null) { + + formData.put("net_term_days", this.netTermDays); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.autoCollection != null) { + + formData.put("auto_collection", this.autoCollection); + } + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.paymentSourceId != null) { + + formData.put("payment_source_id", this.paymentSourceId); + } + + if (this.status != null) { + + formData.put("status", this.status); + } + + if (this.currentTermEnd != null) { + + formData.put("current_term_end", this.currentTermEnd); + } + + if (this.currentTermStart != null) { + + formData.put("current_term_start", this.currentTermStart); + } + + if (this.trialStart != null) { + + formData.put("trial_start", this.trialStart); + } + + if (this.cancelledAt != null) { + + formData.put("cancelled_at", this.cancelledAt); + } + + if (this.startedAt != null) { + + formData.put("started_at", this.startedAt); + } + + if (this.activatedAt != null) { + + formData.put("activated_at", this.activatedAt); + } + + if (this.pauseDate != null) { + + formData.put("pause_date", this.pauseDate); + } + + if (this.resumeDate != null) { + + formData.put("resume_date", this.resumeDate); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + if (this.createCurrentTermInvoice != null) { + + formData.put("create_current_term_invoice", this.createCurrentTermInvoice); + } + + if (this.invoiceNotes != null) { + + formData.put("invoice_notes", this.invoiceNotes); + } + + if (this.metaData != null) { + + formData.put("meta_data", JsonUtil.toJson(this.metaData)); + } + + if (this.cancelReasonCode != null) { + + formData.put("cancel_reason_code", this.cancelReasonCode); + } + + if (this.createPendingInvoices != null) { + + formData.put("create_pending_invoices", this.createPendingInvoices); + } + + if (this.autoCloseInvoices != null) { + + formData.put("auto_close_invoices", this.autoCloseInvoices); + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.transaction != null) { + + // Single object + Map nestedData = this.transaction.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "transaction[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.subscriptionItems != null) { + + // List of objects + for (int i = 0; i < this.subscriptionItems.size(); i++) { + SubscriptionItemsParams item = this.subscriptionItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discounts != null) { + + // List of objects + for (int i = 0; i < this.discounts.size(); i++) { + DiscountsParams item = this.discounts.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.chargedItems != null) { + + // List of objects + for (int i = 0; i < this.chargedItems.size(); i++) { + ChargedItemsParams item = this.chargedItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "charged_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.coupons != null) { + + // List of objects + for (int i = 0; i < this.coupons.size(); i++) { + CouponsParams item = this.coupons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(customFields); + + return formData; + } + + /** Create a new builder for SubscriptionImportForItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionImportForItemsBuilder builder() { + return new SubscriptionImportForItemsBuilder(); + } + + public static final class SubscriptionImportForItemsBuilder { + + private List exhaustedCouponIds; + + private String id; + + private Timestamp trialEnd; + + private Integer billingCycles; + + private Long setupFee; + + private Integer netTermDays; + + private Timestamp startDate; + + private AutoCollection autoCollection; + + private String poNumber; + + private List couponIds; + + private String paymentSourceId; + + private Status status; + + private Timestamp currentTermEnd; + + private Timestamp currentTermStart; + + private Timestamp trialStart; + + private Timestamp cancelledAt; + + private Timestamp startedAt; + + private Timestamp activatedAt; + + private Timestamp pauseDate; + + private Timestamp resumeDate; + + private Integer contractTermBillingCycleOnRenewal; + + private Boolean createCurrentTermInvoice; + + private String invoiceNotes; + + private java.util.Map metaData; + + private String cancelReasonCode; + + private Boolean createPendingInvoices; + + private Boolean autoCloseInvoices; + + private ContractTermParams contractTerm; + + private TransactionParams transaction; + + private ShippingAddressParams shippingAddress; + + private List subscriptionItems; + + private List discounts; + + private List chargedItems; + + private List itemTiers; + + private List coupons; + + private Map customFields = new LinkedHashMap<>(); + + private SubscriptionImportForItemsBuilder() {} + + public SubscriptionImportForItemsBuilder exhaustedCouponIds(List value) { + this.exhaustedCouponIds = value; + return this; + } + + public SubscriptionImportForItemsBuilder id(String value) { + this.id = value; + return this; + } + + public SubscriptionImportForItemsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionImportForItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + @Deprecated + public SubscriptionImportForItemsBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionImportForItemsBuilder netTermDays(Integer value) { + this.netTermDays = value; + return this; + } + + public SubscriptionImportForItemsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionImportForItemsBuilder autoCollection(AutoCollection value) { + this.autoCollection = value; + return this; + } + + public SubscriptionImportForItemsBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public SubscriptionImportForItemsBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public SubscriptionImportForItemsBuilder paymentSourceId(String value) { + this.paymentSourceId = value; + return this; + } + + public SubscriptionImportForItemsBuilder status(Status value) { + this.status = value; + return this; + } + + public SubscriptionImportForItemsBuilder currentTermEnd(Timestamp value) { + this.currentTermEnd = value; + return this; + } + + public SubscriptionImportForItemsBuilder currentTermStart(Timestamp value) { + this.currentTermStart = value; + return this; + } + + public SubscriptionImportForItemsBuilder trialStart(Timestamp value) { + this.trialStart = value; + return this; + } + + public SubscriptionImportForItemsBuilder cancelledAt(Timestamp value) { + this.cancelledAt = value; + return this; + } + + public SubscriptionImportForItemsBuilder startedAt(Timestamp value) { + this.startedAt = value; + return this; + } + + public SubscriptionImportForItemsBuilder activatedAt(Timestamp value) { + this.activatedAt = value; + return this; + } + + public SubscriptionImportForItemsBuilder pauseDate(Timestamp value) { + this.pauseDate = value; + return this; + } + + public SubscriptionImportForItemsBuilder resumeDate(Timestamp value) { + this.resumeDate = value; + return this; + } + + public SubscriptionImportForItemsBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionImportForItemsBuilder createCurrentTermInvoice(Boolean value) { + this.createCurrentTermInvoice = value; + return this; + } + + public SubscriptionImportForItemsBuilder invoiceNotes(String value) { + this.invoiceNotes = value; + return this; + } + + public SubscriptionImportForItemsBuilder metaData(java.util.Map value) { + this.metaData = value; + return this; + } + + public SubscriptionImportForItemsBuilder cancelReasonCode(String value) { + this.cancelReasonCode = value; + return this; + } + + public SubscriptionImportForItemsBuilder createPendingInvoices(Boolean value) { + this.createPendingInvoices = value; + return this; + } + + public SubscriptionImportForItemsBuilder autoCloseInvoices(Boolean value) { + this.autoCloseInvoices = value; + return this; + } + + public SubscriptionImportForItemsBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public SubscriptionImportForItemsBuilder transaction(TransactionParams value) { + this.transaction = value; + return this; + } + + public SubscriptionImportForItemsBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public SubscriptionImportForItemsBuilder subscriptionItems( + List value) { + this.subscriptionItems = value; + return this; + } + + public SubscriptionImportForItemsBuilder discounts(List value) { + this.discounts = value; + return this; + } + + public SubscriptionImportForItemsBuilder chargedItems(List value) { + this.chargedItems = value; + return this; + } + + public SubscriptionImportForItemsBuilder itemTiers(List value) { + this.itemTiers = value; + return this; + } + + @Deprecated + public SubscriptionImportForItemsBuilder coupons(List value) { + this.coupons = value; + return this; + } + + /** + * Add a custom field to the request. Custom fields must start with "cf_". + * + * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") + * @param value the value of the custom field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cf_" + */ + public SubscriptionImportForItemsBuilder customField(String fieldName, String value) { + if (fieldName == null || !fieldName.startsWith("cf_")) { + throw new IllegalArgumentException("Custom field name must start with 'cf_'"); + } + this.customFields.put(fieldName, value); + return this; + } + + /** + * Add multiple custom fields to the request. All field names must start with "cf_". + * + * @param customFields map of custom field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cf_" + */ + public SubscriptionImportForItemsBuilder customFields(Map customFields) { + if (customFields != null) { + for (Map.Entry entry : customFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { + throw new IllegalArgumentException( + "Custom field name must start with 'cf_': " + entry.getKey()); + } + this.customFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public SubscriptionImportForItemsParams build() { + return new SubscriptionImportForItemsParams(this); + } + } + + public enum AutoCollection { + ON("on"), + + OFF("off"), + + /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AutoCollection(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AutoCollection fromString(String value) { + if (value == null) return _UNKNOWN; + for (AutoCollection enumValue : AutoCollection.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum Status { + FUTURE("future"), + + IN_TRIAL("in_trial"), + + ACTIVE("active"), + + NON_RENEWING("non_renewing"), + + PAUSED("paused"), + + CANCELLED("cancelled"), + + TRANSFERRED("transferred"), + + /** An enum member indicating that Status was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Status(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Status fromString(String value) { + if (value == null) return _UNKNOWN; + for (Status enumValue : Status.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class ContractTermParams { + + private final String id; + + private final Timestamp createdAt; + + private final Timestamp contractStart; + + private final Integer billingCycle; + + private final Long totalAmountRaised; + + private final Long totalAmountRaisedBeforeTax; + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.id = builder.id; + + this.createdAt = builder.createdAt; + + this.contractStart = builder.contractStart; + + this.billingCycle = builder.billingCycle; + + this.totalAmountRaised = builder.totalAmountRaised; + + this.totalAmountRaisedBeforeTax = builder.totalAmountRaisedBeforeTax; + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public String getId() { + return id; + } + + public Timestamp getCreatedAt() { + return createdAt; + } + + public Timestamp getContractStart() { + return contractStart; + } + + public Integer getBillingCycle() { + return billingCycle; + } + + public Long getTotalAmountRaised() { + return totalAmountRaised; + } + + public Long getTotalAmountRaisedBeforeTax() { + return totalAmountRaisedBeforeTax; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.createdAt != null) { + + formData.put("created_at", this.createdAt); + } + + if (this.contractStart != null) { + + formData.put("contract_start", this.contractStart); + } + + if (this.billingCycle != null) { + + formData.put("billing_cycle", this.billingCycle); + } + + if (this.totalAmountRaised != null) { + + formData.put("total_amount_raised", this.totalAmountRaised); + } + + if (this.totalAmountRaisedBeforeTax != null) { + + formData.put("total_amount_raised_before_tax", this.totalAmountRaisedBeforeTax); + } + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private String id; + + private Timestamp createdAt; + + private Timestamp contractStart; + + private Integer billingCycle; + + private Long totalAmountRaised; + + private Long totalAmountRaisedBeforeTax; + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder id(String value) { + this.id = value; + return this; + } + + public ContractTermBuilder createdAt(Timestamp value) { + this.createdAt = value; + return this; + } + + public ContractTermBuilder contractStart(Timestamp value) { + this.contractStart = value; + return this; + } + + public ContractTermBuilder billingCycle(Integer value) { + this.billingCycle = value; + return this; + } + + public ContractTermBuilder totalAmountRaised(Long value) { + this.totalAmountRaised = value; + return this; + } + + public ContractTermBuilder totalAmountRaisedBeforeTax(Long value) { + this.totalAmountRaisedBeforeTax = value; + return this; + } + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + RENEW_ONCE("renew_once"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class TransactionParams { + + private final Long amount; + + private final PaymentMethod paymentMethod; + + private final String referenceNumber; + + private final Timestamp date; + + private TransactionParams(TransactionBuilder builder) { + + this.amount = builder.amount; + + this.paymentMethod = builder.paymentMethod; + + this.referenceNumber = builder.referenceNumber; + + this.date = builder.date; + } + + public Long getAmount() { + return amount; + } + + public PaymentMethod getPaymentMethod() { + return paymentMethod; + } + + public String getReferenceNumber() { + return referenceNumber; + } + + public Timestamp getDate() { + return date; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.paymentMethod != null) { + + formData.put("payment_method", this.paymentMethod); + } + + if (this.referenceNumber != null) { + + formData.put("reference_number", this.referenceNumber); + } + + if (this.date != null) { + + formData.put("date", this.date); + } + + return formData; + } + + /** Create a new builder for TransactionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TransactionBuilder builder() { + return new TransactionBuilder(); + } + + public static final class TransactionBuilder { + + private Long amount; + + private PaymentMethod paymentMethod; + + private String referenceNumber; + + private Timestamp date; + + private TransactionBuilder() {} + + public TransactionBuilder amount(Long value) { + this.amount = value; + return this; + } + + public TransactionBuilder paymentMethod(PaymentMethod value) { + this.paymentMethod = value; + return this; + } + + public TransactionBuilder referenceNumber(String value) { + this.referenceNumber = value; + return this; + } + + public TransactionBuilder date(Timestamp value) { + this.date = value; + return this; + } + + public TransactionParams build() { + return new TransactionParams(this); + } + } + + public enum PaymentMethod { + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + OTHER("other"), + + APP_STORE("app_store"), + + PLAY_STORE("play_store"), + + CUSTOM("custom"), + + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethod enumValue : PaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class SubscriptionItemsParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Timestamp trialEnd; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ItemType itemType; + + private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.trialEnd = builder.trialEnd; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.itemType = builder.itemType; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ItemType getItemType() { + return itemType; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.itemType != null) { + + formData.put("item_type", this.itemType); + } + + return formData; + } + + /** Create a new builder for SubscriptionItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionItemsBuilder builder() { + return new SubscriptionItemsBuilder(); + } + + public static final class SubscriptionItemsBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Timestamp trialEnd; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ItemType itemType; + + private SubscriptionItemsBuilder() {} + + public SubscriptionItemsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public SubscriptionItemsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public SubscriptionItemsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public SubscriptionItemsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public SubscriptionItemsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionItemsBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public SubscriptionItemsBuilder itemType(ItemType value) { + this.itemType = value; + return this; + } + + public SubscriptionItemsParams build() { + return new SubscriptionItemsParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ItemType { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemType enumValue : ItemType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class DiscountsParams { + + private final ApplyOn applyOn; + + private final DurationType durationType; + + private final Number percentage; + + private final Long amount; + + private final Integer period; + + private final PeriodUnit periodUnit; + + private final Boolean includedInMrr; + + private final String itemPriceId; + + private final Integer quantity; + + private DiscountsParams(DiscountsBuilder builder) { + + this.applyOn = builder.applyOn; + + this.durationType = builder.durationType; + + this.percentage = builder.percentage; + + this.amount = builder.amount; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + + this.includedInMrr = builder.includedInMrr; + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public DurationType getDurationType() { + return durationType; + } + + public Number getPercentage() { + return percentage; + } + + public Long getAmount() { + return amount; + } + + public Integer getPeriod() { + return period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public Boolean getIncludedInMrr() { + return includedInMrr; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.durationType != null) { + + formData.put("duration_type", this.durationType); + } + + if (this.percentage != null) { + + formData.put("percentage", this.percentage); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.includedInMrr != null) { + + formData.put("included_in_mrr", this.includedInMrr); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + return formData; + } + + /** Create a new builder for DiscountsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsBuilder builder() { + return new DiscountsBuilder(); + } + + public static final class DiscountsBuilder { + + private ApplyOn applyOn; + + private DurationType durationType; + + private Number percentage; + + private Long amount; + + private Integer period; + + private PeriodUnit periodUnit; + + private Boolean includedInMrr; + + private String itemPriceId; + + private Integer quantity; + + private DiscountsBuilder() {} + + public DiscountsBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public DiscountsBuilder durationType(DurationType value) { + this.durationType = value; + return this; + } + + public DiscountsBuilder percentage(Number value) { + this.percentage = value; + return this; + } + + public DiscountsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsBuilder period(Integer value) { + this.period = value; + return this; + } + + public DiscountsBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public DiscountsBuilder includedInMrr(Boolean value) { + this.includedInMrr = value; + return this; + } + + public DiscountsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DiscountsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public DiscountsParams build() { + return new DiscountsParams(this); + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIC_ITEM_PRICE("specific_item_price"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum DurationType { + ONE_TIME("one_time"), + + FOREVER("forever"), + + LIMITED_PERIOD("limited_period"), + + /** An enum member indicating that DurationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DurationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DurationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DurationType enumValue : DurationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ChargedItemsParams { + + private final String itemPriceId; + + private final Timestamp lastChargedAt; + + private ChargedItemsParams(ChargedItemsBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.lastChargedAt = builder.lastChargedAt; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Timestamp getLastChargedAt() { + return lastChargedAt; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.lastChargedAt != null) { + + formData.put("last_charged_at", this.lastChargedAt); + } + + return formData; + } + + /** Create a new builder for ChargedItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ChargedItemsBuilder builder() { + return new ChargedItemsBuilder(); + } + + public static final class ChargedItemsBuilder { + + private String itemPriceId; + + private Timestamp lastChargedAt; + + private ChargedItemsBuilder() {} + + public ChargedItemsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ChargedItemsBuilder lastChargedAt(Timestamp value) { + this.lastChargedAt = value; + return this; + } + + public ChargedItemsParams build() { + return new ChargedItemsParams(this); + } + } + } + + public static final class ItemTiersParams { + + private final String itemPriceId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private String itemPriceId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CouponsParams { + + private final String couponId; + + private final Timestamp applyTill; + + private CouponsParams(CouponsBuilder builder) { + + this.couponId = builder.couponId; + + this.applyTill = builder.applyTill; + } + + public String getCouponId() { + return couponId; + } + + public Timestamp getApplyTill() { + return applyTill; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.couponId != null) { + + formData.put("coupon_id", this.couponId); + } + + if (this.applyTill != null) { + + formData.put("apply_till", this.applyTill); + } + + return formData; + } + + /** Create a new builder for CouponsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponsBuilder builder() { + return new CouponsBuilder(); + } + + public static final class CouponsBuilder { + + private String couponId; + + private Timestamp applyTill; + + private CouponsBuilder() {} + + public CouponsBuilder couponId(String value) { + this.couponId = value; + return this; + } + + public CouponsBuilder applyTill(Timestamp value) { + this.applyTill = value; + return this; + } + + public CouponsParams build() { + return new CouponsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportUnbilledChargesParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportUnbilledChargesParams.java new file mode 100644 index 00000000..79572b13 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportUnbilledChargesParams.java @@ -0,0 +1,868 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class SubscriptionImportUnbilledChargesParams { + + private final List unbilledCharges; + + private final List discounts; + + private final List tiers; + + private SubscriptionImportUnbilledChargesParams( + SubscriptionImportUnbilledChargesBuilder builder) { + + this.unbilledCharges = builder.unbilledCharges; + + this.discounts = builder.discounts; + + this.tiers = builder.tiers; + } + + public List getUnbilledCharges() { + return unbilledCharges; + } + + public List getDiscounts() { + return discounts; + } + + public List getTiers() { + return tiers; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.unbilledCharges != null) { + + // List of objects + for (int i = 0; i < this.unbilledCharges.size(); i++) { + UnbilledChargesParams item = this.unbilledCharges.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "unbilled_charges[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discounts != null) { + + // List of objects + for (int i = 0; i < this.discounts.size(); i++) { + DiscountsParams item = this.discounts.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.tiers != null) { + + // List of objects + for (int i = 0; i < this.tiers.size(); i++) { + TiersParams item = this.tiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for SubscriptionImportUnbilledChargesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionImportUnbilledChargesBuilder builder() { + return new SubscriptionImportUnbilledChargesBuilder(); + } + + public static final class SubscriptionImportUnbilledChargesBuilder { + + private List unbilledCharges; + + private List discounts; + + private List tiers; + + private SubscriptionImportUnbilledChargesBuilder() {} + + public SubscriptionImportUnbilledChargesBuilder unbilledCharges( + List value) { + this.unbilledCharges = value; + return this; + } + + public SubscriptionImportUnbilledChargesBuilder discounts(List value) { + this.discounts = value; + return this; + } + + public SubscriptionImportUnbilledChargesBuilder tiers(List value) { + this.tiers = value; + return this; + } + + public SubscriptionImportUnbilledChargesParams build() { + return new SubscriptionImportUnbilledChargesParams(this); + } + } + + public static final class UnbilledChargesParams { + + private final String id; + + private final Timestamp dateFrom; + + private final Timestamp dateTo; + + private final EntityType entityType; + + private final String entityId; + + private final String description; + + private final Long unitAmount; + + private final Integer quantity; + + private final Long amount; + + private final String unitAmountInDecimal; + + private final String quantityInDecimal; + + private final String amountInDecimal; + + private final Long discountAmount; + + private final Boolean useForProration; + + private final Boolean isAdvanceCharge; + + private UnbilledChargesParams(UnbilledChargesBuilder builder) { + + this.id = builder.id; + + this.dateFrom = builder.dateFrom; + + this.dateTo = builder.dateTo; + + this.entityType = builder.entityType; + + this.entityId = builder.entityId; + + this.description = builder.description; + + this.unitAmount = builder.unitAmount; + + this.quantity = builder.quantity; + + this.amount = builder.amount; + + this.unitAmountInDecimal = builder.unitAmountInDecimal; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.amountInDecimal = builder.amountInDecimal; + + this.discountAmount = builder.discountAmount; + + this.useForProration = builder.useForProration; + + this.isAdvanceCharge = builder.isAdvanceCharge; + } + + public String getId() { + return id; + } + + public Timestamp getDateFrom() { + return dateFrom; + } + + public Timestamp getDateTo() { + return dateTo; + } + + public EntityType getEntityType() { + return entityType; + } + + public String getEntityId() { + return entityId; + } + + public String getDescription() { + return description; + } + + public Long getUnitAmount() { + return unitAmount; + } + + public Integer getQuantity() { + return quantity; + } + + public Long getAmount() { + return amount; + } + + public String getUnitAmountInDecimal() { + return unitAmountInDecimal; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public String getAmountInDecimal() { + return amountInDecimal; + } + + public Long getDiscountAmount() { + return discountAmount; + } + + public Boolean getUseForProration() { + return useForProration; + } + + public Boolean getIsAdvanceCharge() { + return isAdvanceCharge; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.dateFrom != null) { + + formData.put("date_from", this.dateFrom); + } + + if (this.dateTo != null) { + + formData.put("date_to", this.dateTo); + } + + if (this.entityType != null) { + + formData.put("entity_type", this.entityType); + } + + if (this.entityId != null) { + + formData.put("entity_id", this.entityId); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.unitAmount != null) { + + formData.put("unit_amount", this.unitAmount); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.unitAmountInDecimal != null) { + + formData.put("unit_amount_in_decimal", this.unitAmountInDecimal); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.amountInDecimal != null) { + + formData.put("amount_in_decimal", this.amountInDecimal); + } + + if (this.discountAmount != null) { + + formData.put("discount_amount", this.discountAmount); + } + + if (this.useForProration != null) { + + formData.put("use_for_proration", this.useForProration); + } + + if (this.isAdvanceCharge != null) { + + formData.put("is_advance_charge", this.isAdvanceCharge); + } + + return formData; + } + + /** Create a new builder for UnbilledChargesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UnbilledChargesBuilder builder() { + return new UnbilledChargesBuilder(); + } + + public static final class UnbilledChargesBuilder { + + private String id; + + private Timestamp dateFrom; + + private Timestamp dateTo; + + private EntityType entityType; + + private String entityId; + + private String description; + + private Long unitAmount; + + private Integer quantity; + + private Long amount; + + private String unitAmountInDecimal; + + private String quantityInDecimal; + + private String amountInDecimal; + + private Long discountAmount; + + private Boolean useForProration; + + private Boolean isAdvanceCharge; + + private UnbilledChargesBuilder() {} + + public UnbilledChargesBuilder id(String value) { + this.id = value; + return this; + } + + public UnbilledChargesBuilder dateFrom(Timestamp value) { + this.dateFrom = value; + return this; + } + + public UnbilledChargesBuilder dateTo(Timestamp value) { + this.dateTo = value; + return this; + } + + public UnbilledChargesBuilder entityType(EntityType value) { + this.entityType = value; + return this; + } + + public UnbilledChargesBuilder entityId(String value) { + this.entityId = value; + return this; + } + + public UnbilledChargesBuilder description(String value) { + this.description = value; + return this; + } + + public UnbilledChargesBuilder unitAmount(Long value) { + this.unitAmount = value; + return this; + } + + public UnbilledChargesBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public UnbilledChargesBuilder amount(Long value) { + this.amount = value; + return this; + } + + public UnbilledChargesBuilder unitAmountInDecimal(String value) { + this.unitAmountInDecimal = value; + return this; + } + + public UnbilledChargesBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public UnbilledChargesBuilder amountInDecimal(String value) { + this.amountInDecimal = value; + return this; + } + + public UnbilledChargesBuilder discountAmount(Long value) { + this.discountAmount = value; + return this; + } + + public UnbilledChargesBuilder useForProration(Boolean value) { + this.useForProration = value; + return this; + } + + public UnbilledChargesBuilder isAdvanceCharge(Boolean value) { + this.isAdvanceCharge = value; + return this; + } + + public UnbilledChargesParams build() { + return new UnbilledChargesParams(this); + } + } + + public enum EntityType { + ADHOC("adhoc"), + + PLAN_ITEM_PRICE("plan_item_price"), + + ADDON_ITEM_PRICE("addon_item_price"), + + CHARGE_ITEM_PRICE("charge_item_price"), + + PLAN_SETUP("plan_setup"), + + PLAN("plan"), + + ADDON("addon"), + + /** An enum member indicating that EntityType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + EntityType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EntityType fromString(String value) { + if (value == null) return _UNKNOWN; + for (EntityType enumValue : EntityType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class DiscountsParams { + + private final String unbilledChargeId; + + private final EntityType entityType; + + private final String entityId; + + private final String description; + + private final Long amount; + + private DiscountsParams(DiscountsBuilder builder) { + + this.unbilledChargeId = builder.unbilledChargeId; + + this.entityType = builder.entityType; + + this.entityId = builder.entityId; + + this.description = builder.description; + + this.amount = builder.amount; + } + + public String getUnbilledChargeId() { + return unbilledChargeId; + } + + public EntityType getEntityType() { + return entityType; + } + + public String getEntityId() { + return entityId; + } + + public String getDescription() { + return description; + } + + public Long getAmount() { + return amount; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.unbilledChargeId != null) { + + formData.put("unbilled_charge_id", this.unbilledChargeId); + } + + if (this.entityType != null) { + + formData.put("entity_type", this.entityType); + } + + if (this.entityId != null) { + + formData.put("entity_id", this.entityId); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + return formData; + } + + /** Create a new builder for DiscountsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsBuilder builder() { + return new DiscountsBuilder(); + } + + public static final class DiscountsBuilder { + + private String unbilledChargeId; + + private EntityType entityType; + + private String entityId; + + private String description; + + private Long amount; + + private DiscountsBuilder() {} + + public DiscountsBuilder unbilledChargeId(String value) { + this.unbilledChargeId = value; + return this; + } + + public DiscountsBuilder entityType(EntityType value) { + this.entityType = value; + return this; + } + + public DiscountsBuilder entityId(String value) { + this.entityId = value; + return this; + } + + public DiscountsBuilder description(String value) { + this.description = value; + return this; + } + + public DiscountsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsParams build() { + return new DiscountsParams(this); + } + } + + public enum EntityType { + ITEM_LEVEL_COUPON("item_level_coupon"), + + DOCUMENT_LEVEL_COUPON("document_level_coupon"), + + ITEM_LEVEL_DISCOUNT("item_level_discount"), + + DOCUMENT_LEVEL_DISCOUNT("document_level_discount"), + + /** An enum member indicating that EntityType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + EntityType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EntityType fromString(String value) { + if (value == null) return _UNKNOWN; + for (EntityType enumValue : EntityType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class TiersParams { + + private final String unbilledChargeId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Integer quantityUsed; + + private final Long unitAmount; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String quantityUsedInDecimal; + + private final String unitAmountInDecimal; + + private TiersParams(TiersBuilder builder) { + + this.unbilledChargeId = builder.unbilledChargeId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.quantityUsed = builder.quantityUsed; + + this.unitAmount = builder.unitAmount; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.quantityUsedInDecimal = builder.quantityUsedInDecimal; + + this.unitAmountInDecimal = builder.unitAmountInDecimal; + } + + public String getUnbilledChargeId() { + return unbilledChargeId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Integer getQuantityUsed() { + return quantityUsed; + } + + public Long getUnitAmount() { + return unitAmount; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getQuantityUsedInDecimal() { + return quantityUsedInDecimal; + } + + public String getUnitAmountInDecimal() { + return unitAmountInDecimal; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.unbilledChargeId != null) { + + formData.put("unbilled_charge_id", this.unbilledChargeId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.quantityUsed != null) { + + formData.put("quantity_used", this.quantityUsed); + } + + if (this.unitAmount != null) { + + formData.put("unit_amount", this.unitAmount); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.quantityUsedInDecimal != null) { + + formData.put("quantity_used_in_decimal", this.quantityUsedInDecimal); + } + + if (this.unitAmountInDecimal != null) { + + formData.put("unit_amount_in_decimal", this.unitAmountInDecimal); + } + + return formData; + } + + /** Create a new builder for TiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TiersBuilder builder() { + return new TiersBuilder(); + } + + public static final class TiersBuilder { + + private String unbilledChargeId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Integer quantityUsed; + + private Long unitAmount; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String quantityUsedInDecimal; + + private String unitAmountInDecimal; + + private TiersBuilder() {} + + public TiersBuilder unbilledChargeId(String value) { + this.unbilledChargeId = value; + return this; + } + + public TiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public TiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public TiersBuilder quantityUsed(Integer value) { + this.quantityUsed = value; + return this; + } + + public TiersBuilder unitAmount(Long value) { + this.unitAmount = value; + return this; + } + + public TiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public TiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public TiersBuilder quantityUsedInDecimal(String value) { + this.quantityUsedInDecimal = value; + return this; + } + + public TiersBuilder unitAmountInDecimal(String value) { + this.unitAmountInDecimal = value; + return this; + } + + public TiersParams build() { + return new TiersParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionListDiscountsParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionListDiscountsParams.java new file mode 100644 index 00000000..977e5c1c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionListDiscountsParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SubscriptionListDiscountsParams { + + private final Map queryParams; + + private SubscriptionListDiscountsParams(SubscriptionListDiscountsBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public SubscriptionListDiscountsBuilder toBuilder() { + SubscriptionListDiscountsBuilder builder = new SubscriptionListDiscountsBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for SubscriptionListDiscountsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionListDiscountsBuilder builder() { + return new SubscriptionListDiscountsBuilder(); + } + + public static final class SubscriptionListDiscountsBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private SubscriptionListDiscountsBuilder() {} + + public SubscriptionListDiscountsBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public SubscriptionListDiscountsBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + public SubscriptionListDiscountsParams build() { + return new SubscriptionListDiscountsParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionMoveParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionMoveParams.java new file mode 100644 index 00000000..1a882b6f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionMoveParams.java @@ -0,0 +1,80 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SubscriptionMoveParams { + + private final String toCustomerId; + + private final Boolean copyPaymentSource; + + private SubscriptionMoveParams(SubscriptionMoveBuilder builder) { + + this.toCustomerId = builder.toCustomerId; + + this.copyPaymentSource = builder.copyPaymentSource; + } + + public String getToCustomerId() { + return toCustomerId; + } + + public Boolean getCopyPaymentSource() { + return copyPaymentSource; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.toCustomerId != null) { + + formData.put("to_customer_id", this.toCustomerId); + } + + if (this.copyPaymentSource != null) { + + formData.put("copy_payment_source", this.copyPaymentSource); + } + + return formData; + } + + /** Create a new builder for SubscriptionMoveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionMoveBuilder builder() { + return new SubscriptionMoveBuilder(); + } + + public static final class SubscriptionMoveBuilder { + + private String toCustomerId; + + private Boolean copyPaymentSource; + + private SubscriptionMoveBuilder() {} + + public SubscriptionMoveBuilder toCustomerId(String value) { + this.toCustomerId = value; + return this; + } + + public SubscriptionMoveBuilder copyPaymentSource(Boolean value) { + this.copyPaymentSource = value; + return this; + } + + public SubscriptionMoveParams build() { + return new SubscriptionMoveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionOverrideBillingProfileParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionOverrideBillingProfileParams.java new file mode 100644 index 00000000..d6b75935 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionOverrideBillingProfileParams.java @@ -0,0 +1,109 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SubscriptionOverrideBillingProfileParams { + + private final String paymentSourceId; + + private final AutoCollection autoCollection; + + private SubscriptionOverrideBillingProfileParams( + SubscriptionOverrideBillingProfileBuilder builder) { + + this.paymentSourceId = builder.paymentSourceId; + + this.autoCollection = builder.autoCollection; + } + + public String getPaymentSourceId() { + return paymentSourceId; + } + + public AutoCollection getAutoCollection() { + return autoCollection; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.paymentSourceId != null) { + + formData.put("payment_source_id", this.paymentSourceId); + } + + if (this.autoCollection != null) { + + formData.put("auto_collection", this.autoCollection); + } + + return formData; + } + + /** Create a new builder for SubscriptionOverrideBillingProfileParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionOverrideBillingProfileBuilder builder() { + return new SubscriptionOverrideBillingProfileBuilder(); + } + + public static final class SubscriptionOverrideBillingProfileBuilder { + + private String paymentSourceId; + + private AutoCollection autoCollection; + + private SubscriptionOverrideBillingProfileBuilder() {} + + public SubscriptionOverrideBillingProfileBuilder paymentSourceId(String value) { + this.paymentSourceId = value; + return this; + } + + public SubscriptionOverrideBillingProfileBuilder autoCollection(AutoCollection value) { + this.autoCollection = value; + return this; + } + + public SubscriptionOverrideBillingProfileParams build() { + return new SubscriptionOverrideBillingProfileParams(this); + } + } + + public enum AutoCollection { + ON("on"), + + OFF("off"), + + /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AutoCollection(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AutoCollection fromString(String value) { + if (value == null) return _UNKNOWN; + for (AutoCollection enumValue : AutoCollection.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionPauseParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionPauseParams.java new file mode 100644 index 00000000..9233c07d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionPauseParams.java @@ -0,0 +1,254 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class SubscriptionPauseParams { + + private final PauseOption pauseOption; + + private final Timestamp pauseDate; + + private final UnbilledChargesHandling unbilledChargesHandling; + + private final InvoiceDunningHandling invoiceDunningHandling; + + private final Integer skipBillingCycles; + + private final Timestamp resumeDate; + + private SubscriptionPauseParams(SubscriptionPauseBuilder builder) { + + this.pauseOption = builder.pauseOption; + + this.pauseDate = builder.pauseDate; + + this.unbilledChargesHandling = builder.unbilledChargesHandling; + + this.invoiceDunningHandling = builder.invoiceDunningHandling; + + this.skipBillingCycles = builder.skipBillingCycles; + + this.resumeDate = builder.resumeDate; + } + + public PauseOption getPauseOption() { + return pauseOption; + } + + public Timestamp getPauseDate() { + return pauseDate; + } + + public UnbilledChargesHandling getUnbilledChargesHandling() { + return unbilledChargesHandling; + } + + public InvoiceDunningHandling getInvoiceDunningHandling() { + return invoiceDunningHandling; + } + + public Integer getSkipBillingCycles() { + return skipBillingCycles; + } + + public Timestamp getResumeDate() { + return resumeDate; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.pauseOption != null) { + + formData.put("pause_option", this.pauseOption); + } + + if (this.pauseDate != null) { + + formData.put("pause_date", this.pauseDate); + } + + if (this.unbilledChargesHandling != null) { + + formData.put("unbilled_charges_handling", this.unbilledChargesHandling); + } + + if (this.invoiceDunningHandling != null) { + + formData.put("invoice_dunning_handling", this.invoiceDunningHandling); + } + + if (this.skipBillingCycles != null) { + + formData.put("skip_billing_cycles", this.skipBillingCycles); + } + + if (this.resumeDate != null) { + + formData.put("resume_date", this.resumeDate); + } + + return formData; + } + + /** Create a new builder for SubscriptionPauseParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionPauseBuilder builder() { + return new SubscriptionPauseBuilder(); + } + + public static final class SubscriptionPauseBuilder { + + private PauseOption pauseOption; + + private Timestamp pauseDate; + + private UnbilledChargesHandling unbilledChargesHandling; + + private InvoiceDunningHandling invoiceDunningHandling; + + private Integer skipBillingCycles; + + private Timestamp resumeDate; + + private SubscriptionPauseBuilder() {} + + public SubscriptionPauseBuilder pauseOption(PauseOption value) { + this.pauseOption = value; + return this; + } + + public SubscriptionPauseBuilder pauseDate(Timestamp value) { + this.pauseDate = value; + return this; + } + + public SubscriptionPauseBuilder unbilledChargesHandling(UnbilledChargesHandling value) { + this.unbilledChargesHandling = value; + return this; + } + + public SubscriptionPauseBuilder invoiceDunningHandling(InvoiceDunningHandling value) { + this.invoiceDunningHandling = value; + return this; + } + + public SubscriptionPauseBuilder skipBillingCycles(Integer value) { + this.skipBillingCycles = value; + return this; + } + + public SubscriptionPauseBuilder resumeDate(Timestamp value) { + this.resumeDate = value; + return this; + } + + public SubscriptionPauseParams build() { + return new SubscriptionPauseParams(this); + } + } + + public enum PauseOption { + IMMEDIATELY("immediately"), + + END_OF_TERM("end_of_term"), + + SPECIFIC_DATE("specific_date"), + + BILLING_CYCLES("billing_cycles"), + + /** An enum member indicating that PauseOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PauseOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PauseOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (PauseOption enumValue : PauseOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum UnbilledChargesHandling { + NO_ACTION("no_action"), + + INVOICE("invoice"), + + /** + * An enum member indicating that UnbilledChargesHandling was instantiated with an unknown + * value. + */ + _UNKNOWN(null); + private final String value; + + UnbilledChargesHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static UnbilledChargesHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (UnbilledChargesHandling enumValue : UnbilledChargesHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum InvoiceDunningHandling { + CONTINUE("continue"), + + STOP("stop"), + + /** + * An enum member indicating that InvoiceDunningHandling was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + InvoiceDunningHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static InvoiceDunningHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (InvoiceDunningHandling enumValue : InvoiceDunningHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionReactivateParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionReactivateParams.java new file mode 100644 index 00000000..a2021f68 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionReactivateParams.java @@ -0,0 +1,770 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class SubscriptionReactivateParams { + + private final Timestamp trialEnd; + + private final Integer billingCycles; + + private final Integer trialPeriodDays; + + private final Timestamp reactivateFrom; + + private final Boolean invoiceImmediately; + + private final BillingAlignmentMode billingAlignmentMode; + + private final Integer termsToCharge; + + private final Timestamp invoiceDate; + + private final Integer contractTermBillingCycleOnRenewal; + + private final PaymentInitiator paymentInitiator; + + private final ContractTermParams contractTerm; + + private final StatementDescriptorParams statementDescriptor; + + private final PaymentIntentParams paymentIntent; + + private SubscriptionReactivateParams(SubscriptionReactivateBuilder builder) { + + this.trialEnd = builder.trialEnd; + + this.billingCycles = builder.billingCycles; + + this.trialPeriodDays = builder.trialPeriodDays; + + this.reactivateFrom = builder.reactivateFrom; + + this.invoiceImmediately = builder.invoiceImmediately; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.termsToCharge = builder.termsToCharge; + + this.invoiceDate = builder.invoiceDate; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + + this.paymentInitiator = builder.paymentInitiator; + + this.contractTerm = builder.contractTerm; + + this.statementDescriptor = builder.statementDescriptor; + + this.paymentIntent = builder.paymentIntent; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Integer getTrialPeriodDays() { + return trialPeriodDays; + } + + public Timestamp getReactivateFrom() { + return reactivateFrom; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + public PaymentInitiator getPaymentInitiator() { + return paymentInitiator; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public StatementDescriptorParams getStatementDescriptor() { + return statementDescriptor; + } + + public PaymentIntentParams getPaymentIntent() { + return paymentIntent; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialPeriodDays != null) { + + formData.put("trial_period_days", this.trialPeriodDays); + } + + if (this.reactivateFrom != null) { + + formData.put("reactivate_from", this.reactivateFrom); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + if (this.paymentInitiator != null) { + + formData.put("payment_initiator", this.paymentInitiator); + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.statementDescriptor != null) { + + // Single object + Map nestedData = this.statementDescriptor.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "statement_descriptor[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.paymentIntent != null) { + + // Single object + Map nestedData = this.paymentIntent.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "payment_intent[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for SubscriptionReactivateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionReactivateBuilder builder() { + return new SubscriptionReactivateBuilder(); + } + + public static final class SubscriptionReactivateBuilder { + + private Timestamp trialEnd; + + private Integer billingCycles; + + private Integer trialPeriodDays; + + private Timestamp reactivateFrom; + + private Boolean invoiceImmediately; + + private BillingAlignmentMode billingAlignmentMode; + + private Integer termsToCharge; + + private Timestamp invoiceDate; + + private Integer contractTermBillingCycleOnRenewal; + + private PaymentInitiator paymentInitiator; + + private ContractTermParams contractTerm; + + private StatementDescriptorParams statementDescriptor; + + private PaymentIntentParams paymentIntent; + + private SubscriptionReactivateBuilder() {} + + public SubscriptionReactivateBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionReactivateBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + @Deprecated + public SubscriptionReactivateBuilder trialPeriodDays(Integer value) { + this.trialPeriodDays = value; + return this; + } + + public SubscriptionReactivateBuilder reactivateFrom(Timestamp value) { + this.reactivateFrom = value; + return this; + } + + public SubscriptionReactivateBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public SubscriptionReactivateBuilder billingAlignmentMode(BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public SubscriptionReactivateBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public SubscriptionReactivateBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public SubscriptionReactivateBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionReactivateBuilder paymentInitiator(PaymentInitiator value) { + this.paymentInitiator = value; + return this; + } + + public SubscriptionReactivateBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public SubscriptionReactivateBuilder statementDescriptor(StatementDescriptorParams value) { + this.statementDescriptor = value; + return this; + } + + public SubscriptionReactivateBuilder paymentIntent(PaymentIntentParams value) { + this.paymentIntent = value; + return this; + } + + public SubscriptionReactivateParams build() { + return new SubscriptionReactivateParams(this); + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PaymentInitiator { + CUSTOMER("customer"), + + MERCHANT("merchant"), + + /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentInitiator(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentInitiator fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentInitiator enumValue : PaymentInitiator.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class StatementDescriptorParams { + + private final String descriptor; + + private StatementDescriptorParams(StatementDescriptorBuilder builder) { + + this.descriptor = builder.descriptor; + } + + public String getDescriptor() { + return descriptor; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.descriptor != null) { + + formData.put("descriptor", this.descriptor); + } + + return formData; + } + + /** Create a new builder for StatementDescriptorParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static StatementDescriptorBuilder builder() { + return new StatementDescriptorBuilder(); + } + + public static final class StatementDescriptorBuilder { + + private String descriptor; + + private StatementDescriptorBuilder() {} + + public StatementDescriptorBuilder descriptor(String value) { + this.descriptor = value; + return this; + } + + public StatementDescriptorParams build() { + return new StatementDescriptorParams(this); + } + } + } + + public static final class PaymentIntentParams { + + private final String id; + + private final String gatewayAccountId; + + private final String gwToken; + + private final PaymentMethodType paymentMethodType; + + private final String referenceId; + + private final String gwPaymentMethodId; + + private final java.util.Map additionalInformation; + + private PaymentIntentParams(PaymentIntentBuilder builder) { + + this.id = builder.id; + + this.gatewayAccountId = builder.gatewayAccountId; + + this.gwToken = builder.gwToken; + + this.paymentMethodType = builder.paymentMethodType; + + this.referenceId = builder.referenceId; + + this.gwPaymentMethodId = builder.gwPaymentMethodId; + + this.additionalInformation = builder.additionalInformation; + } + + public String getId() { + return id; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getGwToken() { + return gwToken; + } + + public PaymentMethodType getPaymentMethodType() { + return paymentMethodType; + } + + public String getReferenceId() { + return referenceId; + } + + public String getGwPaymentMethodId() { + return gwPaymentMethodId; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.gwToken != null) { + + formData.put("gw_token", this.gwToken); + } + + if (this.paymentMethodType != null) { + + formData.put("payment_method_type", this.paymentMethodType); + } + + if (this.referenceId != null) { + + formData.put("reference_id", this.referenceId); + } + + if (this.gwPaymentMethodId != null) { + + formData.put("gw_payment_method_id", this.gwPaymentMethodId); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for PaymentIntentParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentIntentBuilder builder() { + return new PaymentIntentBuilder(); + } + + public static final class PaymentIntentBuilder { + + private String id; + + private String gatewayAccountId; + + private String gwToken; + + private PaymentMethodType paymentMethodType; + + private String referenceId; + + private String gwPaymentMethodId; + + private java.util.Map additionalInformation; + + private PaymentIntentBuilder() {} + + public PaymentIntentBuilder id(String value) { + this.id = value; + return this; + } + + public PaymentIntentBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public PaymentIntentBuilder gwToken(String value) { + this.gwToken = value; + return this; + } + + public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { + this.paymentMethodType = value; + return this; + } + + public PaymentIntentBuilder referenceId(String value) { + this.referenceId = value; + return this; + } + + @Deprecated + public PaymentIntentBuilder gwPaymentMethodId(String value) { + this.gwPaymentMethodId = value; + return this; + } + + public PaymentIntentBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public PaymentIntentParams build() { + return new PaymentIntentParams(this); + } + } + + public enum PaymentMethodType { + CARD("card"), + + IDEAL("ideal"), + + SOFORT("sofort"), + + BANCONTACT("bancontact"), + + GOOGLE_PAY("google_pay"), + + DOTPAY("dotpay"), + + GIROPAY("giropay"), + + APPLE_PAY("apple_pay"), + + UPI("upi"), + + NETBANKING_EMANDATES("netbanking_emandates"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + DIRECT_DEBIT("direct_debit"), + + BOLETO("boleto"), + + VENMO("venmo"), + + AMAZON_PAYMENTS("amazon_payments"), + + PAY_TO("pay_to"), + + FASTER_PAYMENTS("faster_payments"), + + SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), + + KLARNA_PAY_NOW("klarna_pay_now"), + + ONLINE_BANKING_POLAND("online_banking_poland"), + + PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), + + ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), + + KBC_PAYMENT_BUTTON("kbc_payment_button"), + + PAY_BY_BANK("pay_by_bank"), + + TRUSTLY("trustly"), + + STABLECOIN("stablecoin"), + + /** + * An enum member indicating that PaymentMethodType was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + PaymentMethodType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethodType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethodType enumValue : PaymentMethodType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRegenerateInvoiceParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRegenerateInvoiceParams.java new file mode 100644 index 00000000..0653e327 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRegenerateInvoiceParams.java @@ -0,0 +1,121 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class SubscriptionRegenerateInvoiceParams { + + private final Timestamp dateFrom; + + private final Timestamp dateTo; + + private final Boolean prorate; + + private final Boolean invoiceImmediately; + + private SubscriptionRegenerateInvoiceParams(SubscriptionRegenerateInvoiceBuilder builder) { + + this.dateFrom = builder.dateFrom; + + this.dateTo = builder.dateTo; + + this.prorate = builder.prorate; + + this.invoiceImmediately = builder.invoiceImmediately; + } + + public Timestamp getDateFrom() { + return dateFrom; + } + + public Timestamp getDateTo() { + return dateTo; + } + + public Boolean getProrate() { + return prorate; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.dateFrom != null) { + + formData.put("date_from", this.dateFrom); + } + + if (this.dateTo != null) { + + formData.put("date_to", this.dateTo); + } + + if (this.prorate != null) { + + formData.put("prorate", this.prorate); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + return formData; + } + + /** Create a new builder for SubscriptionRegenerateInvoiceParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionRegenerateInvoiceBuilder builder() { + return new SubscriptionRegenerateInvoiceBuilder(); + } + + public static final class SubscriptionRegenerateInvoiceBuilder { + + private Timestamp dateFrom; + + private Timestamp dateTo; + + private Boolean prorate; + + private Boolean invoiceImmediately; + + private SubscriptionRegenerateInvoiceBuilder() {} + + public SubscriptionRegenerateInvoiceBuilder dateFrom(Timestamp value) { + this.dateFrom = value; + return this; + } + + public SubscriptionRegenerateInvoiceBuilder dateTo(Timestamp value) { + this.dateTo = value; + return this; + } + + public SubscriptionRegenerateInvoiceBuilder prorate(Boolean value) { + this.prorate = value; + return this; + } + + public SubscriptionRegenerateInvoiceBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public SubscriptionRegenerateInvoiceParams build() { + return new SubscriptionRegenerateInvoiceParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveAdvanceInvoiceScheduleParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveAdvanceInvoiceScheduleParams.java new file mode 100644 index 00000000..58f2b221 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveAdvanceInvoiceScheduleParams.java @@ -0,0 +1,121 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class SubscriptionRemoveAdvanceInvoiceScheduleParams { + + private final List specificDatesSchedule; + + private SubscriptionRemoveAdvanceInvoiceScheduleParams( + SubscriptionRemoveAdvanceInvoiceScheduleBuilder builder) { + + this.specificDatesSchedule = builder.specificDatesSchedule; + } + + public List getSpecificDatesSchedule() { + return specificDatesSchedule; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.specificDatesSchedule != null) { + + // List of objects + for (int i = 0; i < this.specificDatesSchedule.size(); i++) { + SpecificDatesScheduleParams item = this.specificDatesSchedule.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "specific_dates_schedule[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for SubscriptionRemoveAdvanceInvoiceScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionRemoveAdvanceInvoiceScheduleBuilder builder() { + return new SubscriptionRemoveAdvanceInvoiceScheduleBuilder(); + } + + public static final class SubscriptionRemoveAdvanceInvoiceScheduleBuilder { + + private List specificDatesSchedule; + + private SubscriptionRemoveAdvanceInvoiceScheduleBuilder() {} + + public SubscriptionRemoveAdvanceInvoiceScheduleBuilder specificDatesSchedule( + List value) { + this.specificDatesSchedule = value; + return this; + } + + public SubscriptionRemoveAdvanceInvoiceScheduleParams build() { + return new SubscriptionRemoveAdvanceInvoiceScheduleParams(this); + } + } + + public static final class SpecificDatesScheduleParams { + + private final String id; + + private SpecificDatesScheduleParams(SpecificDatesScheduleBuilder builder) { + + this.id = builder.id; + } + + public String getId() { + return id; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + return formData; + } + + /** Create a new builder for SpecificDatesScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SpecificDatesScheduleBuilder builder() { + return new SpecificDatesScheduleBuilder(); + } + + public static final class SpecificDatesScheduleBuilder { + + private String id; + + private SpecificDatesScheduleBuilder() {} + + public SpecificDatesScheduleBuilder id(String value) { + this.id = value; + return this; + } + + public SpecificDatesScheduleParams build() { + return new SpecificDatesScheduleParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveCouponsParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveCouponsParams.java new file mode 100644 index 00000000..065933a8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveCouponsParams.java @@ -0,0 +1,61 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class SubscriptionRemoveCouponsParams { + + private final List couponIds; + + private SubscriptionRemoveCouponsParams(SubscriptionRemoveCouponsBuilder builder) { + + this.couponIds = builder.couponIds; + } + + public List getCouponIds() { + return couponIds; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + return formData; + } + + /** Create a new builder for SubscriptionRemoveCouponsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionRemoveCouponsBuilder builder() { + return new SubscriptionRemoveCouponsBuilder(); + } + + public static final class SubscriptionRemoveCouponsBuilder { + + private List couponIds; + + private SubscriptionRemoveCouponsBuilder() {} + + public SubscriptionRemoveCouponsBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public SubscriptionRemoveCouponsParams build() { + return new SubscriptionRemoveCouponsParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledCancellationParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledCancellationParams.java new file mode 100644 index 00000000..c3a3fe86 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledCancellationParams.java @@ -0,0 +1,206 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SubscriptionRemoveScheduledCancellationParams { + + private final Integer billingCycles; + + private final Integer contractTermBillingCycleOnRenewal; + + private final ContractTermParams contractTerm; + + private SubscriptionRemoveScheduledCancellationParams( + SubscriptionRemoveScheduledCancellationBuilder builder) { + + this.billingCycles = builder.billingCycles; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + + this.contractTerm = builder.contractTerm; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for SubscriptionRemoveScheduledCancellationParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionRemoveScheduledCancellationBuilder builder() { + return new SubscriptionRemoveScheduledCancellationBuilder(); + } + + public static final class SubscriptionRemoveScheduledCancellationBuilder { + + private Integer billingCycles; + + private Integer contractTermBillingCycleOnRenewal; + + private ContractTermParams contractTerm; + + private SubscriptionRemoveScheduledCancellationBuilder() {} + + public SubscriptionRemoveScheduledCancellationBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public SubscriptionRemoveScheduledCancellationBuilder contractTermBillingCycleOnRenewal( + Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionRemoveScheduledCancellationBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public SubscriptionRemoveScheduledCancellationParams build() { + return new SubscriptionRemoveScheduledCancellationParams(this); + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledChangesParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledChangesParams.java new file mode 100644 index 00000000..e84c0441 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledChangesParams.java @@ -0,0 +1,40 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SubscriptionRemoveScheduledChangesParams { + + private SubscriptionRemoveScheduledChangesParams( + SubscriptionRemoveScheduledChangesBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for SubscriptionRemoveScheduledChangesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionRemoveScheduledChangesBuilder builder() { + return new SubscriptionRemoveScheduledChangesBuilder(); + } + + public static final class SubscriptionRemoveScheduledChangesBuilder { + + private SubscriptionRemoveScheduledChangesBuilder() {} + + public SubscriptionRemoveScheduledChangesParams build() { + return new SubscriptionRemoveScheduledChangesParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledPauseParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledPauseParams.java new file mode 100644 index 00000000..32335017 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledPauseParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SubscriptionRemoveScheduledPauseParams { + + private SubscriptionRemoveScheduledPauseParams(SubscriptionRemoveScheduledPauseBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for SubscriptionRemoveScheduledPauseParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionRemoveScheduledPauseBuilder builder() { + return new SubscriptionRemoveScheduledPauseBuilder(); + } + + public static final class SubscriptionRemoveScheduledPauseBuilder { + + private SubscriptionRemoveScheduledPauseBuilder() {} + + public SubscriptionRemoveScheduledPauseParams build() { + return new SubscriptionRemoveScheduledPauseParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledResumptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledResumptionParams.java new file mode 100644 index 00000000..730b3022 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRemoveScheduledResumptionParams.java @@ -0,0 +1,40 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SubscriptionRemoveScheduledResumptionParams { + + private SubscriptionRemoveScheduledResumptionParams( + SubscriptionRemoveScheduledResumptionBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for SubscriptionRemoveScheduledResumptionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionRemoveScheduledResumptionBuilder builder() { + return new SubscriptionRemoveScheduledResumptionBuilder(); + } + + public static final class SubscriptionRemoveScheduledResumptionBuilder { + + private SubscriptionRemoveScheduledResumptionBuilder() {} + + public SubscriptionRemoveScheduledResumptionParams build() { + return new SubscriptionRemoveScheduledResumptionParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionResumeParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionResumeParams.java new file mode 100644 index 00000000..9a62b3af --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionResumeParams.java @@ -0,0 +1,528 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class SubscriptionResumeParams { + + private final ResumeOption resumeOption; + + private final Timestamp resumeDate; + + private final ChargesHandling chargesHandling; + + private final UnpaidInvoicesHandling unpaidInvoicesHandling; + + private final PaymentInitiator paymentInitiator; + + private final PaymentIntentParams paymentIntent; + + private SubscriptionResumeParams(SubscriptionResumeBuilder builder) { + + this.resumeOption = builder.resumeOption; + + this.resumeDate = builder.resumeDate; + + this.chargesHandling = builder.chargesHandling; + + this.unpaidInvoicesHandling = builder.unpaidInvoicesHandling; + + this.paymentInitiator = builder.paymentInitiator; + + this.paymentIntent = builder.paymentIntent; + } + + public ResumeOption getResumeOption() { + return resumeOption; + } + + public Timestamp getResumeDate() { + return resumeDate; + } + + public ChargesHandling getChargesHandling() { + return chargesHandling; + } + + public UnpaidInvoicesHandling getUnpaidInvoicesHandling() { + return unpaidInvoicesHandling; + } + + public PaymentInitiator getPaymentInitiator() { + return paymentInitiator; + } + + public PaymentIntentParams getPaymentIntent() { + return paymentIntent; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.resumeOption != null) { + + formData.put("resume_option", this.resumeOption); + } + + if (this.resumeDate != null) { + + formData.put("resume_date", this.resumeDate); + } + + if (this.chargesHandling != null) { + + formData.put("charges_handling", this.chargesHandling); + } + + if (this.unpaidInvoicesHandling != null) { + + formData.put("unpaid_invoices_handling", this.unpaidInvoicesHandling); + } + + if (this.paymentInitiator != null) { + + formData.put("payment_initiator", this.paymentInitiator); + } + + if (this.paymentIntent != null) { + + // Single object + Map nestedData = this.paymentIntent.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "payment_intent[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + return formData; + } + + /** Create a new builder for SubscriptionResumeParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionResumeBuilder builder() { + return new SubscriptionResumeBuilder(); + } + + public static final class SubscriptionResumeBuilder { + + private ResumeOption resumeOption; + + private Timestamp resumeDate; + + private ChargesHandling chargesHandling; + + private UnpaidInvoicesHandling unpaidInvoicesHandling; + + private PaymentInitiator paymentInitiator; + + private PaymentIntentParams paymentIntent; + + private SubscriptionResumeBuilder() {} + + public SubscriptionResumeBuilder resumeOption(ResumeOption value) { + this.resumeOption = value; + return this; + } + + public SubscriptionResumeBuilder resumeDate(Timestamp value) { + this.resumeDate = value; + return this; + } + + public SubscriptionResumeBuilder chargesHandling(ChargesHandling value) { + this.chargesHandling = value; + return this; + } + + public SubscriptionResumeBuilder unpaidInvoicesHandling(UnpaidInvoicesHandling value) { + this.unpaidInvoicesHandling = value; + return this; + } + + public SubscriptionResumeBuilder paymentInitiator(PaymentInitiator value) { + this.paymentInitiator = value; + return this; + } + + public SubscriptionResumeBuilder paymentIntent(PaymentIntentParams value) { + this.paymentIntent = value; + return this; + } + + public SubscriptionResumeParams build() { + return new SubscriptionResumeParams(this); + } + } + + public enum ResumeOption { + IMMEDIATELY("immediately"), + + SPECIFIC_DATE("specific_date"), + + /** An enum member indicating that ResumeOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ResumeOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ResumeOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ResumeOption enumValue : ResumeOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargesHandling { + INVOICE_IMMEDIATELY("invoice_immediately"), + + ADD_TO_UNBILLED_CHARGES("add_to_unbilled_charges"), + + /** An enum member indicating that ChargesHandling was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargesHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargesHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargesHandling enumValue : ChargesHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum UnpaidInvoicesHandling { + NO_ACTION("no_action"), + + SCHEDULE_PAYMENT_COLLECTION("schedule_payment_collection"), + + /** + * An enum member indicating that UnpaidInvoicesHandling was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + UnpaidInvoicesHandling(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static UnpaidInvoicesHandling fromString(String value) { + if (value == null) return _UNKNOWN; + for (UnpaidInvoicesHandling enumValue : UnpaidInvoicesHandling.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PaymentInitiator { + CUSTOMER("customer"), + + MERCHANT("merchant"), + + /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentInitiator(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentInitiator fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentInitiator enumValue : PaymentInitiator.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class PaymentIntentParams { + + private final String id; + + private final String gatewayAccountId; + + private final String gwToken; + + private final PaymentMethodType paymentMethodType; + + private final String referenceId; + + private final String gwPaymentMethodId; + + private final java.util.Map additionalInformation; + + private PaymentIntentParams(PaymentIntentBuilder builder) { + + this.id = builder.id; + + this.gatewayAccountId = builder.gatewayAccountId; + + this.gwToken = builder.gwToken; + + this.paymentMethodType = builder.paymentMethodType; + + this.referenceId = builder.referenceId; + + this.gwPaymentMethodId = builder.gwPaymentMethodId; + + this.additionalInformation = builder.additionalInformation; + } + + public String getId() { + return id; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getGwToken() { + return gwToken; + } + + public PaymentMethodType getPaymentMethodType() { + return paymentMethodType; + } + + public String getReferenceId() { + return referenceId; + } + + public String getGwPaymentMethodId() { + return gwPaymentMethodId; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.gwToken != null) { + + formData.put("gw_token", this.gwToken); + } + + if (this.paymentMethodType != null) { + + formData.put("payment_method_type", this.paymentMethodType); + } + + if (this.referenceId != null) { + + formData.put("reference_id", this.referenceId); + } + + if (this.gwPaymentMethodId != null) { + + formData.put("gw_payment_method_id", this.gwPaymentMethodId); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for PaymentIntentParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentIntentBuilder builder() { + return new PaymentIntentBuilder(); + } + + public static final class PaymentIntentBuilder { + + private String id; + + private String gatewayAccountId; + + private String gwToken; + + private PaymentMethodType paymentMethodType; + + private String referenceId; + + private String gwPaymentMethodId; + + private java.util.Map additionalInformation; + + private PaymentIntentBuilder() {} + + public PaymentIntentBuilder id(String value) { + this.id = value; + return this; + } + + public PaymentIntentBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public PaymentIntentBuilder gwToken(String value) { + this.gwToken = value; + return this; + } + + public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { + this.paymentMethodType = value; + return this; + } + + public PaymentIntentBuilder referenceId(String value) { + this.referenceId = value; + return this; + } + + @Deprecated + public PaymentIntentBuilder gwPaymentMethodId(String value) { + this.gwPaymentMethodId = value; + return this; + } + + public PaymentIntentBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public PaymentIntentParams build() { + return new PaymentIntentParams(this); + } + } + + public enum PaymentMethodType { + CARD("card"), + + IDEAL("ideal"), + + SOFORT("sofort"), + + BANCONTACT("bancontact"), + + GOOGLE_PAY("google_pay"), + + DOTPAY("dotpay"), + + GIROPAY("giropay"), + + APPLE_PAY("apple_pay"), + + UPI("upi"), + + NETBANKING_EMANDATES("netbanking_emandates"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + DIRECT_DEBIT("direct_debit"), + + BOLETO("boleto"), + + VENMO("venmo"), + + AMAZON_PAYMENTS("amazon_payments"), + + PAY_TO("pay_to"), + + FASTER_PAYMENTS("faster_payments"), + + SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), + + KLARNA_PAY_NOW("klarna_pay_now"), + + ONLINE_BANKING_POLAND("online_banking_poland"), + + PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), + + ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), + + KBC_PAYMENT_BUTTON("kbc_payment_button"), + + PAY_BY_BANK("pay_by_bank"), + + TRUSTLY("trustly"), + + STABLECOIN("stablecoin"), + + /** + * An enum member indicating that PaymentMethodType was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + PaymentMethodType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethodType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethodType enumValue : PaymentMethodType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRetrieveAdvanceInvoiceScheduleParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRetrieveAdvanceInvoiceScheduleParams.java new file mode 100644 index 00000000..2a01a9b9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRetrieveAdvanceInvoiceScheduleParams.java @@ -0,0 +1,52 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SubscriptionRetrieveAdvanceInvoiceScheduleParams { + + private final Map queryParams; + + private SubscriptionRetrieveAdvanceInvoiceScheduleParams( + SubscriptionRetrieveAdvanceInvoiceScheduleBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public SubscriptionRetrieveAdvanceInvoiceScheduleBuilder toBuilder() { + SubscriptionRetrieveAdvanceInvoiceScheduleBuilder builder = + new SubscriptionRetrieveAdvanceInvoiceScheduleBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for SubscriptionRetrieveAdvanceInvoiceScheduleParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionRetrieveAdvanceInvoiceScheduleBuilder builder() { + return new SubscriptionRetrieveAdvanceInvoiceScheduleBuilder(); + } + + public static final class SubscriptionRetrieveAdvanceInvoiceScheduleBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private SubscriptionRetrieveAdvanceInvoiceScheduleBuilder() {} + + public SubscriptionRetrieveAdvanceInvoiceScheduleParams build() { + return new SubscriptionRetrieveAdvanceInvoiceScheduleParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRetrieveWithScheduledChangesParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRetrieveWithScheduledChangesParams.java new file mode 100644 index 00000000..b1cf0c8d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionRetrieveWithScheduledChangesParams.java @@ -0,0 +1,52 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SubscriptionRetrieveWithScheduledChangesParams { + + private final Map queryParams; + + private SubscriptionRetrieveWithScheduledChangesParams( + SubscriptionRetrieveWithScheduledChangesBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public SubscriptionRetrieveWithScheduledChangesBuilder toBuilder() { + SubscriptionRetrieveWithScheduledChangesBuilder builder = + new SubscriptionRetrieveWithScheduledChangesBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for SubscriptionRetrieveWithScheduledChangesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionRetrieveWithScheduledChangesBuilder builder() { + return new SubscriptionRetrieveWithScheduledChangesBuilder(); + } + + public static final class SubscriptionRetrieveWithScheduledChangesBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private SubscriptionRetrieveWithScheduledChangesBuilder() {} + + public SubscriptionRetrieveWithScheduledChangesParams build() { + return new SubscriptionRetrieveWithScheduledChangesParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionUpdateForItemsParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionUpdateForItemsParams.java new file mode 100644 index 00000000..b8d4f5b5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionUpdateForItemsParams.java @@ -0,0 +1,4875 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscription.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class SubscriptionUpdateForItemsParams { + + private final List mandatoryItemsToRemove; + + private final Boolean replaceItemsList; + + private final Long setupFee; + + private final Integer netTermDays; + + private final Timestamp invoiceDate; + + private final Timestamp startDate; + + private final Timestamp trialEnd; + + private final Integer billingCycles; + + private final String coupon; + + private final Integer termsToCharge; + + private final Timestamp reactivateFrom; + + private final BillingAlignmentMode billingAlignmentMode; + + private final AutoCollection autoCollection; + + private final OfflinePaymentMethod offlinePaymentMethod; + + private final String poNumber; + + private final List couponIds; + + private final Boolean replaceCouponList; + + private final Boolean prorate; + + private final Boolean endOfTerm; + + private final Boolean forceTermReset; + + private final Boolean reactivate; + + private final String tokenId; + + private final String invoiceNotes; + + private final java.util.Map metaData; + + private final Boolean invoiceImmediately; + + private final Boolean overrideRelationship; + + private final Timestamp changesScheduledAt; + + private final ChangeOption changeOption; + + private final Integer contractTermBillingCycleOnRenewal; + + private final Integer freePeriod; + + private final FreePeriodUnit freePeriodUnit; + + private final Boolean createPendingInvoices; + + private final Boolean autoCloseInvoices; + + private final TrialEndAction trialEndAction; + + private final PaymentInitiator paymentInitiator; + + private final Boolean invoiceUsages; + + private final CardParams card; + + private final PaymentMethodParams paymentMethod; + + private final PaymentIntentParams paymentIntent; + + private final BillingAddressParams billingAddress; + + private final ShippingAddressParams shippingAddress; + + private final StatementDescriptorParams statementDescriptor; + + private final CustomerParams customer; + + private final ContractTermParams contractTerm; + + private final BillingOverrideParams billingOverride; + + private final List subscriptionItems; + + private final List discounts; + + private final List itemTiers; + + private final List coupons; + + private final Map customFields; + + private SubscriptionUpdateForItemsParams(SubscriptionUpdateForItemsBuilder builder) { + + this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; + + this.replaceItemsList = builder.replaceItemsList; + + this.setupFee = builder.setupFee; + + this.netTermDays = builder.netTermDays; + + this.invoiceDate = builder.invoiceDate; + + this.startDate = builder.startDate; + + this.trialEnd = builder.trialEnd; + + this.billingCycles = builder.billingCycles; + + this.coupon = builder.coupon; + + this.termsToCharge = builder.termsToCharge; + + this.reactivateFrom = builder.reactivateFrom; + + this.billingAlignmentMode = builder.billingAlignmentMode; + + this.autoCollection = builder.autoCollection; + + this.offlinePaymentMethod = builder.offlinePaymentMethod; + + this.poNumber = builder.poNumber; + + this.couponIds = builder.couponIds; + + this.replaceCouponList = builder.replaceCouponList; + + this.prorate = builder.prorate; + + this.endOfTerm = builder.endOfTerm; + + this.forceTermReset = builder.forceTermReset; + + this.reactivate = builder.reactivate; + + this.tokenId = builder.tokenId; + + this.invoiceNotes = builder.invoiceNotes; + + this.metaData = builder.metaData; + + this.invoiceImmediately = builder.invoiceImmediately; + + this.overrideRelationship = builder.overrideRelationship; + + this.changesScheduledAt = builder.changesScheduledAt; + + this.changeOption = builder.changeOption; + + this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; + + this.freePeriod = builder.freePeriod; + + this.freePeriodUnit = builder.freePeriodUnit; + + this.createPendingInvoices = builder.createPendingInvoices; + + this.autoCloseInvoices = builder.autoCloseInvoices; + + this.trialEndAction = builder.trialEndAction; + + this.paymentInitiator = builder.paymentInitiator; + + this.invoiceUsages = builder.invoiceUsages; + + this.card = builder.card; + + this.paymentMethod = builder.paymentMethod; + + this.paymentIntent = builder.paymentIntent; + + this.billingAddress = builder.billingAddress; + + this.shippingAddress = builder.shippingAddress; + + this.statementDescriptor = builder.statementDescriptor; + + this.customer = builder.customer; + + this.contractTerm = builder.contractTerm; + + this.billingOverride = builder.billingOverride; + + this.subscriptionItems = builder.subscriptionItems; + + this.discounts = builder.discounts; + + this.itemTiers = builder.itemTiers; + + this.coupons = builder.coupons; + + this.customFields = + builder.customFields.isEmpty() + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); + } + + public List getMandatoryItemsToRemove() { + return mandatoryItemsToRemove; + } + + public Boolean getReplaceItemsList() { + return replaceItemsList; + } + + public Long getSetupFee() { + return setupFee; + } + + public Integer getNetTermDays() { + return netTermDays; + } + + public Timestamp getInvoiceDate() { + return invoiceDate; + } + + public Timestamp getStartDate() { + return startDate; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public String getCoupon() { + return coupon; + } + + public Integer getTermsToCharge() { + return termsToCharge; + } + + public Timestamp getReactivateFrom() { + return reactivateFrom; + } + + public BillingAlignmentMode getBillingAlignmentMode() { + return billingAlignmentMode; + } + + public AutoCollection getAutoCollection() { + return autoCollection; + } + + public OfflinePaymentMethod getOfflinePaymentMethod() { + return offlinePaymentMethod; + } + + public String getPoNumber() { + return poNumber; + } + + public List getCouponIds() { + return couponIds; + } + + public Boolean getReplaceCouponList() { + return replaceCouponList; + } + + public Boolean getProrate() { + return prorate; + } + + public Boolean getEndOfTerm() { + return endOfTerm; + } + + public Boolean getForceTermReset() { + return forceTermReset; + } + + public Boolean getReactivate() { + return reactivate; + } + + public String getTokenId() { + return tokenId; + } + + public String getInvoiceNotes() { + return invoiceNotes; + } + + public java.util.Map getMetaData() { + return metaData; + } + + public Boolean getInvoiceImmediately() { + return invoiceImmediately; + } + + public Boolean getOverrideRelationship() { + return overrideRelationship; + } + + public Timestamp getChangesScheduledAt() { + return changesScheduledAt; + } + + public ChangeOption getChangeOption() { + return changeOption; + } + + public Integer getContractTermBillingCycleOnRenewal() { + return contractTermBillingCycleOnRenewal; + } + + public Integer getFreePeriod() { + return freePeriod; + } + + public FreePeriodUnit getFreePeriodUnit() { + return freePeriodUnit; + } + + public Boolean getCreatePendingInvoices() { + return createPendingInvoices; + } + + public Boolean getAutoCloseInvoices() { + return autoCloseInvoices; + } + + public TrialEndAction getTrialEndAction() { + return trialEndAction; + } + + public PaymentInitiator getPaymentInitiator() { + return paymentInitiator; + } + + public Boolean getInvoiceUsages() { + return invoiceUsages; + } + + public CardParams getCard() { + return card; + } + + public PaymentMethodParams getPaymentMethod() { + return paymentMethod; + } + + public PaymentIntentParams getPaymentIntent() { + return paymentIntent; + } + + public BillingAddressParams getBillingAddress() { + return billingAddress; + } + + public ShippingAddressParams getShippingAddress() { + return shippingAddress; + } + + public StatementDescriptorParams getStatementDescriptor() { + return statementDescriptor; + } + + public CustomerParams getCustomer() { + return customer; + } + + public ContractTermParams getContractTerm() { + return contractTerm; + } + + public BillingOverrideParams getBillingOverride() { + return billingOverride; + } + + public List getSubscriptionItems() { + return subscriptionItems; + } + + public List getDiscounts() { + return discounts; + } + + public List getItemTiers() { + return itemTiers; + } + + public List getCoupons() { + return coupons; + } + + public Map customFields() { + return customFields; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.mandatoryItemsToRemove != null) { + + formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); + } + + if (this.replaceItemsList != null) { + + formData.put("replace_items_list", this.replaceItemsList); + } + + if (this.setupFee != null) { + + formData.put("setup_fee", this.setupFee); + } + + if (this.netTermDays != null) { + + formData.put("net_term_days", this.netTermDays); + } + + if (this.invoiceDate != null) { + + formData.put("invoice_date", this.invoiceDate); + } + + if (this.startDate != null) { + + formData.put("start_date", this.startDate); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.coupon != null) { + + formData.put("coupon", this.coupon); + } + + if (this.termsToCharge != null) { + + formData.put("terms_to_charge", this.termsToCharge); + } + + if (this.reactivateFrom != null) { + + formData.put("reactivate_from", this.reactivateFrom); + } + + if (this.billingAlignmentMode != null) { + + formData.put("billing_alignment_mode", this.billingAlignmentMode); + } + + if (this.autoCollection != null) { + + formData.put("auto_collection", this.autoCollection); + } + + if (this.offlinePaymentMethod != null) { + + formData.put("offline_payment_method", this.offlinePaymentMethod); + } + + if (this.poNumber != null) { + + formData.put("po_number", this.poNumber); + } + + if (this.couponIds != null) { + + formData.put("coupon_ids", this.couponIds); + } + + if (this.replaceCouponList != null) { + + formData.put("replace_coupon_list", this.replaceCouponList); + } + + if (this.prorate != null) { + + formData.put("prorate", this.prorate); + } + + if (this.endOfTerm != null) { + + formData.put("end_of_term", this.endOfTerm); + } + + if (this.forceTermReset != null) { + + formData.put("force_term_reset", this.forceTermReset); + } + + if (this.reactivate != null) { + + formData.put("reactivate", this.reactivate); + } + + if (this.tokenId != null) { + + formData.put("token_id", this.tokenId); + } + + if (this.invoiceNotes != null) { + + formData.put("invoice_notes", this.invoiceNotes); + } + + if (this.metaData != null) { + + formData.put("meta_data", JsonUtil.toJson(this.metaData)); + } + + if (this.invoiceImmediately != null) { + + formData.put("invoice_immediately", this.invoiceImmediately); + } + + if (this.overrideRelationship != null) { + + formData.put("override_relationship", this.overrideRelationship); + } + + if (this.changesScheduledAt != null) { + + formData.put("changes_scheduled_at", this.changesScheduledAt); + } + + if (this.changeOption != null) { + + formData.put("change_option", this.changeOption); + } + + if (this.contractTermBillingCycleOnRenewal != null) { + + formData.put( + "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); + } + + if (this.freePeriod != null) { + + formData.put("free_period", this.freePeriod); + } + + if (this.freePeriodUnit != null) { + + formData.put("free_period_unit", this.freePeriodUnit); + } + + if (this.createPendingInvoices != null) { + + formData.put("create_pending_invoices", this.createPendingInvoices); + } + + if (this.autoCloseInvoices != null) { + + formData.put("auto_close_invoices", this.autoCloseInvoices); + } + + if (this.trialEndAction != null) { + + formData.put("trial_end_action", this.trialEndAction); + } + + if (this.paymentInitiator != null) { + + formData.put("payment_initiator", this.paymentInitiator); + } + + if (this.invoiceUsages != null) { + + formData.put("invoice_usages", this.invoiceUsages); + } + + if (this.card != null) { + + // Single object + Map nestedData = this.card.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "card[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.paymentMethod != null) { + + // Single object + Map nestedData = this.paymentMethod.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "payment_method[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.paymentIntent != null) { + + // Single object + Map nestedData = this.paymentIntent.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "payment_intent[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.billingAddress != null) { + + // Single object + Map nestedData = this.billingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.shippingAddress != null) { + + // Single object + Map nestedData = this.shippingAddress.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "shipping_address[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.statementDescriptor != null) { + + // Single object + Map nestedData = this.statementDescriptor.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "statement_descriptor[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.customer != null) { + + // Single object + Map nestedData = this.customer.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "customer[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.contractTerm != null) { + + // Single object + Map nestedData = this.contractTerm.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "contract_term[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.billingOverride != null) { + + // Single object + Map nestedData = this.billingOverride.toFormData(); + for (Map.Entry entry : nestedData.entrySet()) { + String nestedKey = "billing_override[" + entry.getKey() + "]"; + formData.put(nestedKey, entry.getValue()); + } + } + + if (this.subscriptionItems != null) { + + // List of objects + for (int i = 0; i < this.subscriptionItems.size(); i++) { + SubscriptionItemsParams item = this.subscriptionItems.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.discounts != null) { + + // List of objects + for (int i = 0; i < this.discounts.size(); i++) { + DiscountsParams item = this.discounts.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.itemTiers != null) { + + // List of objects + for (int i = 0; i < this.itemTiers.size(); i++) { + ItemTiersParams item = this.itemTiers.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + if (this.coupons != null) { + + // List of objects + for (int i = 0; i < this.coupons.size(); i++) { + CouponsParams item = this.coupons.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + formData.putAll(customFields); + + return formData; + } + + /** Create a new builder for SubscriptionUpdateForItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionUpdateForItemsBuilder builder() { + return new SubscriptionUpdateForItemsBuilder(); + } + + public static final class SubscriptionUpdateForItemsBuilder { + + private List mandatoryItemsToRemove; + + private Boolean replaceItemsList; + + private Long setupFee; + + private Integer netTermDays; + + private Timestamp invoiceDate; + + private Timestamp startDate; + + private Timestamp trialEnd; + + private Integer billingCycles; + + private String coupon; + + private Integer termsToCharge; + + private Timestamp reactivateFrom; + + private BillingAlignmentMode billingAlignmentMode; + + private AutoCollection autoCollection; + + private OfflinePaymentMethod offlinePaymentMethod; + + private String poNumber; + + private List couponIds; + + private Boolean replaceCouponList; + + private Boolean prorate; + + private Boolean endOfTerm; + + private Boolean forceTermReset; + + private Boolean reactivate; + + private String tokenId; + + private String invoiceNotes; + + private java.util.Map metaData; + + private Boolean invoiceImmediately; + + private Boolean overrideRelationship; + + private Timestamp changesScheduledAt; + + private ChangeOption changeOption; + + private Integer contractTermBillingCycleOnRenewal; + + private Integer freePeriod; + + private FreePeriodUnit freePeriodUnit; + + private Boolean createPendingInvoices; + + private Boolean autoCloseInvoices; + + private TrialEndAction trialEndAction; + + private PaymentInitiator paymentInitiator; + + private Boolean invoiceUsages; + + private CardParams card; + + private PaymentMethodParams paymentMethod; + + private PaymentIntentParams paymentIntent; + + private BillingAddressParams billingAddress; + + private ShippingAddressParams shippingAddress; + + private StatementDescriptorParams statementDescriptor; + + private CustomerParams customer; + + private ContractTermParams contractTerm; + + private BillingOverrideParams billingOverride; + + private List subscriptionItems; + + private List discounts; + + private List itemTiers; + + private List coupons; + + private Map customFields = new LinkedHashMap<>(); + + private SubscriptionUpdateForItemsBuilder() {} + + public SubscriptionUpdateForItemsBuilder mandatoryItemsToRemove(List value) { + this.mandatoryItemsToRemove = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder replaceItemsList(Boolean value) { + this.replaceItemsList = value; + return this; + } + + @Deprecated + public SubscriptionUpdateForItemsBuilder setupFee(Long value) { + this.setupFee = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder netTermDays(Integer value) { + this.netTermDays = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder invoiceDate(Timestamp value) { + this.invoiceDate = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder startDate(Timestamp value) { + this.startDate = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + @Deprecated + public SubscriptionUpdateForItemsBuilder coupon(String value) { + this.coupon = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder termsToCharge(Integer value) { + this.termsToCharge = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder reactivateFrom(Timestamp value) { + this.reactivateFrom = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder billingAlignmentMode(BillingAlignmentMode value) { + this.billingAlignmentMode = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder autoCollection(AutoCollection value) { + this.autoCollection = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder offlinePaymentMethod(OfflinePaymentMethod value) { + this.offlinePaymentMethod = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder poNumber(String value) { + this.poNumber = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder couponIds(List value) { + this.couponIds = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder replaceCouponList(Boolean value) { + this.replaceCouponList = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder prorate(Boolean value) { + this.prorate = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder endOfTerm(Boolean value) { + this.endOfTerm = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder forceTermReset(Boolean value) { + this.forceTermReset = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder reactivate(Boolean value) { + this.reactivate = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder tokenId(String value) { + this.tokenId = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder invoiceNotes(String value) { + this.invoiceNotes = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder metaData(java.util.Map value) { + this.metaData = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder invoiceImmediately(Boolean value) { + this.invoiceImmediately = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder overrideRelationship(Boolean value) { + this.overrideRelationship = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder changesScheduledAt(Timestamp value) { + this.changesScheduledAt = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder changeOption(ChangeOption value) { + this.changeOption = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder contractTermBillingCycleOnRenewal(Integer value) { + this.contractTermBillingCycleOnRenewal = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder freePeriod(Integer value) { + this.freePeriod = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder freePeriodUnit(FreePeriodUnit value) { + this.freePeriodUnit = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder createPendingInvoices(Boolean value) { + this.createPendingInvoices = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder autoCloseInvoices(Boolean value) { + this.autoCloseInvoices = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder trialEndAction(TrialEndAction value) { + this.trialEndAction = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder paymentInitiator(PaymentInitiator value) { + this.paymentInitiator = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder invoiceUsages(Boolean value) { + this.invoiceUsages = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder card(CardParams value) { + this.card = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder paymentMethod(PaymentMethodParams value) { + this.paymentMethod = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder paymentIntent(PaymentIntentParams value) { + this.paymentIntent = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder billingAddress(BillingAddressParams value) { + this.billingAddress = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder shippingAddress(ShippingAddressParams value) { + this.shippingAddress = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder statementDescriptor(StatementDescriptorParams value) { + this.statementDescriptor = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder customer(CustomerParams value) { + this.customer = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder contractTerm(ContractTermParams value) { + this.contractTerm = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder billingOverride(BillingOverrideParams value) { + this.billingOverride = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder subscriptionItems( + List value) { + this.subscriptionItems = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder discounts(List value) { + this.discounts = value; + return this; + } + + public SubscriptionUpdateForItemsBuilder itemTiers(List value) { + this.itemTiers = value; + return this; + } + + @Deprecated + public SubscriptionUpdateForItemsBuilder coupons(List value) { + this.coupons = value; + return this; + } + + /** + * Add a custom field to the request. Custom fields must start with "cf_". + * + * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") + * @param value the value of the custom field + * @return this builder + * @throws IllegalArgumentException if fieldName doesn't start with "cf_" + */ + public SubscriptionUpdateForItemsBuilder customField(String fieldName, String value) { + if (fieldName == null || !fieldName.startsWith("cf_")) { + throw new IllegalArgumentException("Custom field name must start with 'cf_'"); + } + this.customFields.put(fieldName, value); + return this; + } + + /** + * Add multiple custom fields to the request. All field names must start with "cf_". + * + * @param customFields map of custom field names to values + * @return this builder + * @throws IllegalArgumentException if any field name doesn't start with "cf_" + */ + public SubscriptionUpdateForItemsBuilder customFields(Map customFields) { + if (customFields != null) { + for (Map.Entry entry : customFields.entrySet()) { + if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { + throw new IllegalArgumentException( + "Custom field name must start with 'cf_': " + entry.getKey()); + } + this.customFields.put(entry.getKey(), entry.getValue()); + } + } + return this; + } + + public SubscriptionUpdateForItemsParams build() { + return new SubscriptionUpdateForItemsParams(this); + } + } + + public enum BillingAlignmentMode { + IMMEDIATE("immediate"), + + DELAYED("delayed"), + + /** + * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + BillingAlignmentMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static BillingAlignmentMode fromString(String value) { + if (value == null) return _UNKNOWN; + for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum AutoCollection { + ON("on"), + + OFF("off"), + + /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AutoCollection(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AutoCollection fromString(String value) { + if (value == null) return _UNKNOWN; + for (AutoCollection enumValue : AutoCollection.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum OfflinePaymentMethod { + NO_PREFERENCE("no_preference"), + + CASH("cash"), + + CHECK("check"), + + BANK_TRANSFER("bank_transfer"), + + ACH_CREDIT("ach_credit"), + + SEPA_CREDIT("sepa_credit"), + + BOLETO("boleto"), + + US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), + + EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), + + UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), + + JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), + + MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), + + CUSTOM("custom"), + + /** + * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + OfflinePaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OfflinePaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChangeOption { + IMMEDIATELY("immediately"), + + END_OF_TERM("end_of_term"), + + SPECIFIC_DATE("specific_date"), + + /** An enum member indicating that ChangeOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChangeOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChangeOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChangeOption enumValue : ChangeOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum FreePeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + FreePeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static FreePeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum TrialEndAction { + SITE_DEFAULT("site_default"), + + PLAN_DEFAULT("plan_default"), + + ACTIVATE_SUBSCRIPTION("activate_subscription"), + + CANCEL_SUBSCRIPTION("cancel_subscription"), + + /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + TrialEndAction(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static TrialEndAction fromString(String value) { + if (value == null) return _UNKNOWN; + for (TrialEndAction enumValue : TrialEndAction.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PaymentInitiator { + CUSTOMER("customer"), + + MERCHANT("merchant"), + + /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentInitiator(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentInitiator fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentInitiator enumValue : PaymentInitiator.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class CardParams { + + private final Gateway gateway; + + private final String gatewayAccountId; + + private final String tmpToken; + + private final String firstName; + + private final String lastName; + + private final String number; + + private final Integer expiryMonth; + + private final Integer expiryYear; + + private final String cvv; + + private final PreferredScheme preferredScheme; + + private final String billingAddr1; + + private final String billingAddr2; + + private final String billingCity; + + private final String billingStateCode; + + private final String billingState; + + private final String billingZip; + + private final String billingCountry; + + private final String ipAddress; + + private final java.util.Map additionalInformation; + + private CardParams(CardBuilder builder) { + + this.gateway = builder.gateway; + + this.gatewayAccountId = builder.gatewayAccountId; + + this.tmpToken = builder.tmpToken; + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.number = builder.number; + + this.expiryMonth = builder.expiryMonth; + + this.expiryYear = builder.expiryYear; + + this.cvv = builder.cvv; + + this.preferredScheme = builder.preferredScheme; + + this.billingAddr1 = builder.billingAddr1; + + this.billingAddr2 = builder.billingAddr2; + + this.billingCity = builder.billingCity; + + this.billingStateCode = builder.billingStateCode; + + this.billingState = builder.billingState; + + this.billingZip = builder.billingZip; + + this.billingCountry = builder.billingCountry; + + this.ipAddress = builder.ipAddress; + + this.additionalInformation = builder.additionalInformation; + } + + public Gateway getGateway() { + return gateway; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getTmpToken() { + return tmpToken; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getNumber() { + return number; + } + + public Integer getExpiryMonth() { + return expiryMonth; + } + + public Integer getExpiryYear() { + return expiryYear; + } + + public String getCvv() { + return cvv; + } + + public PreferredScheme getPreferredScheme() { + return preferredScheme; + } + + public String getBillingAddr1() { + return billingAddr1; + } + + public String getBillingAddr2() { + return billingAddr2; + } + + public String getBillingCity() { + return billingCity; + } + + public String getBillingStateCode() { + return billingStateCode; + } + + public String getBillingState() { + return billingState; + } + + public String getBillingZip() { + return billingZip; + } + + public String getBillingCountry() { + return billingCountry; + } + + public String getIpAddress() { + return ipAddress; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.gateway != null) { + + formData.put("gateway", this.gateway); + } + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.tmpToken != null) { + + formData.put("tmp_token", this.tmpToken); + } + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.number != null) { + + formData.put("number", this.number); + } + + if (this.expiryMonth != null) { + + formData.put("expiry_month", this.expiryMonth); + } + + if (this.expiryYear != null) { + + formData.put("expiry_year", this.expiryYear); + } + + if (this.cvv != null) { + + formData.put("cvv", this.cvv); + } + + if (this.preferredScheme != null) { + + formData.put("preferred_scheme", this.preferredScheme); + } + + if (this.billingAddr1 != null) { + + formData.put("billing_addr1", this.billingAddr1); + } + + if (this.billingAddr2 != null) { + + formData.put("billing_addr2", this.billingAddr2); + } + + if (this.billingCity != null) { + + formData.put("billing_city", this.billingCity); + } + + if (this.billingStateCode != null) { + + formData.put("billing_state_code", this.billingStateCode); + } + + if (this.billingState != null) { + + formData.put("billing_state", this.billingState); + } + + if (this.billingZip != null) { + + formData.put("billing_zip", this.billingZip); + } + + if (this.billingCountry != null) { + + formData.put("billing_country", this.billingCountry); + } + + if (this.ipAddress != null) { + + formData.put("ip_address", this.ipAddress); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for CardParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CardBuilder builder() { + return new CardBuilder(); + } + + public static final class CardBuilder { + + private Gateway gateway; + + private String gatewayAccountId; + + private String tmpToken; + + private String firstName; + + private String lastName; + + private String number; + + private Integer expiryMonth; + + private Integer expiryYear; + + private String cvv; + + private PreferredScheme preferredScheme; + + private String billingAddr1; + + private String billingAddr2; + + private String billingCity; + + private String billingStateCode; + + private String billingState; + + private String billingZip; + + private String billingCountry; + + private String ipAddress; + + private java.util.Map additionalInformation; + + private CardBuilder() {} + + @Deprecated + public CardBuilder gateway(Gateway value) { + this.gateway = value; + return this; + } + + public CardBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + @Deprecated + public CardBuilder tmpToken(String value) { + this.tmpToken = value; + return this; + } + + public CardBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public CardBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public CardBuilder number(String value) { + this.number = value; + return this; + } + + public CardBuilder expiryMonth(Integer value) { + this.expiryMonth = value; + return this; + } + + public CardBuilder expiryYear(Integer value) { + this.expiryYear = value; + return this; + } + + public CardBuilder cvv(String value) { + this.cvv = value; + return this; + } + + public CardBuilder preferredScheme(PreferredScheme value) { + this.preferredScheme = value; + return this; + } + + public CardBuilder billingAddr1(String value) { + this.billingAddr1 = value; + return this; + } + + public CardBuilder billingAddr2(String value) { + this.billingAddr2 = value; + return this; + } + + public CardBuilder billingCity(String value) { + this.billingCity = value; + return this; + } + + public CardBuilder billingStateCode(String value) { + this.billingStateCode = value; + return this; + } + + public CardBuilder billingState(String value) { + this.billingState = value; + return this; + } + + public CardBuilder billingZip(String value) { + this.billingZip = value; + return this; + } + + public CardBuilder billingCountry(String value) { + this.billingCountry = value; + return this; + } + + @Deprecated + public CardBuilder ipAddress(String value) { + this.ipAddress = value; + return this; + } + + public CardBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public CardParams build() { + return new CardParams(this); + } + } + + public enum Gateway { + CHARGEBEE("chargebee"), + + CHARGEBEE_PAYMENTS("chargebee_payments"), + + ADYEN("adyen"), + + STRIPE("stripe"), + + WEPAY("wepay"), + + BRAINTREE("braintree"), + + AUTHORIZE_NET("authorize_net"), + + PAYPAL_PRO("paypal_pro"), + + PIN("pin"), + + EWAY("eway"), + + EWAY_RAPID("eway_rapid"), + + WORLDPAY("worldpay"), + + BALANCED_PAYMENTS("balanced_payments"), + + BEANSTREAM("beanstream"), + + BLUEPAY("bluepay"), + + ELAVON("elavon"), + + FIRST_DATA_GLOBAL("first_data_global"), + + HDFC("hdfc"), + + MIGS("migs"), + + NMI("nmi"), + + OGONE("ogone"), + + PAYMILL("paymill"), + + PAYPAL_PAYFLOW_PRO("paypal_payflow_pro"), + + SAGE_PAY("sage_pay"), + + TCO("tco"), + + WIRECARD("wirecard"), + + AMAZON_PAYMENTS("amazon_payments"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + ORBITAL("orbital"), + + MONERIS_US("moneris_us"), + + MONERIS("moneris"), + + BLUESNAP("bluesnap"), + + CYBERSOURCE("cybersource"), + + VANTIV("vantiv"), + + CHECKOUT_COM("checkout_com"), + + PAYPAL("paypal"), + + INGENICO_DIRECT("ingenico_direct"), + + EXACT("exact"), + + MOLLIE("mollie"), + + QUICKBOOKS("quickbooks"), + + RAZORPAY("razorpay"), + + GLOBAL_PAYMENTS("global_payments"), + + BANK_OF_AMERICA("bank_of_america"), + + ECENTRIC("ecentric"), + + METRICS_GLOBAL("metrics_global"), + + WINDCAVE("windcave"), + + PAY_COM("pay_com"), + + EBANX("ebanx"), + + DLOCAL("dlocal"), + + NUVEI("nuvei"), + + SOLIDGATE("solidgate"), + + PAYSTACK("paystack"), + + JP_MORGAN("jp_morgan"), + + DEUTSCHE_BANK("deutsche_bank"), + + EZIDEBIT("ezidebit"), + + /** An enum member indicating that Gateway was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Gateway(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Gateway fromString(String value) { + if (value == null) return _UNKNOWN; + for (Gateway enumValue : Gateway.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PreferredScheme { + CARTES_BANCAIRES("cartes_bancaires"), + + MASTERCARD("mastercard"), + + VISA("visa"), + + /** An enum member indicating that PreferredScheme was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PreferredScheme(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PreferredScheme fromString(String value) { + if (value == null) return _UNKNOWN; + for (PreferredScheme enumValue : PreferredScheme.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class PaymentMethodParams { + + private final Type type; + + private final Gateway gateway; + + private final String gatewayAccountId; + + private final String referenceId; + + private final String tmpToken; + + private final String issuingCountry; + + private final java.util.Map additionalInformation; + + private PaymentMethodParams(PaymentMethodBuilder builder) { + + this.type = builder.type; + + this.gateway = builder.gateway; + + this.gatewayAccountId = builder.gatewayAccountId; + + this.referenceId = builder.referenceId; + + this.tmpToken = builder.tmpToken; + + this.issuingCountry = builder.issuingCountry; + + this.additionalInformation = builder.additionalInformation; + } + + public Type getType() { + return type; + } + + public Gateway getGateway() { + return gateway; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getReferenceId() { + return referenceId; + } + + public String getTmpToken() { + return tmpToken; + } + + public String getIssuingCountry() { + return issuingCountry; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.type != null) { + + formData.put("type", this.type); + } + + if (this.gateway != null) { + + formData.put("gateway", this.gateway); + } + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.referenceId != null) { + + formData.put("reference_id", this.referenceId); + } + + if (this.tmpToken != null) { + + formData.put("tmp_token", this.tmpToken); + } + + if (this.issuingCountry != null) { + + formData.put("issuing_country", this.issuingCountry); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for PaymentMethodParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentMethodBuilder builder() { + return new PaymentMethodBuilder(); + } + + public static final class PaymentMethodBuilder { + + private Type type; + + private Gateway gateway; + + private String gatewayAccountId; + + private String referenceId; + + private String tmpToken; + + private String issuingCountry; + + private java.util.Map additionalInformation; + + private PaymentMethodBuilder() {} + + public PaymentMethodBuilder type(Type value) { + this.type = value; + return this; + } + + @Deprecated + public PaymentMethodBuilder gateway(Gateway value) { + this.gateway = value; + return this; + } + + public PaymentMethodBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public PaymentMethodBuilder referenceId(String value) { + this.referenceId = value; + return this; + } + + public PaymentMethodBuilder tmpToken(String value) { + this.tmpToken = value; + return this; + } + + public PaymentMethodBuilder issuingCountry(String value) { + this.issuingCountry = value; + return this; + } + + public PaymentMethodBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public PaymentMethodParams build() { + return new PaymentMethodParams(this); + } + } + + public enum Type { + CARD("card"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + AMAZON_PAYMENTS("amazon_payments"), + + DIRECT_DEBIT("direct_debit"), + + GENERIC("generic"), + + ALIPAY("alipay"), + + UNIONPAY("unionpay"), + + APPLE_PAY("apple_pay"), + + WECHAT_PAY("wechat_pay"), + + IDEAL("ideal"), + + GOOGLE_PAY("google_pay"), + + SOFORT("sofort"), + + BANCONTACT("bancontact"), + + GIROPAY("giropay"), + + DOTPAY("dotpay"), + + UPI("upi"), + + NETBANKING_EMANDATES("netbanking_emandates"), + + VENMO("venmo"), + + PAY_TO("pay_to"), + + FASTER_PAYMENTS("faster_payments"), + + SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), + + AUTOMATED_BANK_TRANSFER("automated_bank_transfer"), + + KLARNA_PAY_NOW("klarna_pay_now"), + + ONLINE_BANKING_POLAND("online_banking_poland"), + + PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), + + ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), + + KBC_PAYMENT_BUTTON("kbc_payment_button"), + + PAY_BY_BANK("pay_by_bank"), + + TRUSTLY("trustly"), + + STABLECOIN("stablecoin"), + + /** An enum member indicating that Type was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Type(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Type fromString(String value) { + if (value == null) return _UNKNOWN; + for (Type enumValue : Type.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum Gateway { + CHARGEBEE_PAYMENTS("chargebee_payments"), + + ADYEN("adyen"), + + STRIPE("stripe"), + + WEPAY("wepay"), + + BRAINTREE("braintree"), + + AUTHORIZE_NET("authorize_net"), + + PAYPAL_PRO("paypal_pro"), + + PIN("pin"), + + EWAY("eway"), + + EWAY_RAPID("eway_rapid"), + + WORLDPAY("worldpay"), + + BALANCED_PAYMENTS("balanced_payments"), + + BEANSTREAM("beanstream"), + + BLUEPAY("bluepay"), + + ELAVON("elavon"), + + FIRST_DATA_GLOBAL("first_data_global"), + + HDFC("hdfc"), + + MIGS("migs"), + + NMI("nmi"), + + OGONE("ogone"), + + PAYMILL("paymill"), + + PAYPAL_PAYFLOW_PRO("paypal_payflow_pro"), + + SAGE_PAY("sage_pay"), + + TCO("tco"), + + WIRECARD("wirecard"), + + AMAZON_PAYMENTS("amazon_payments"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + GOCARDLESS("gocardless"), + + ORBITAL("orbital"), + + MONERIS_US("moneris_us"), + + MONERIS("moneris"), + + BLUESNAP("bluesnap"), + + CYBERSOURCE("cybersource"), + + VANTIV("vantiv"), + + CHECKOUT_COM("checkout_com"), + + PAYPAL("paypal"), + + INGENICO_DIRECT("ingenico_direct"), + + EXACT("exact"), + + MOLLIE("mollie"), + + QUICKBOOKS("quickbooks"), + + RAZORPAY("razorpay"), + + GLOBAL_PAYMENTS("global_payments"), + + BANK_OF_AMERICA("bank_of_america"), + + ECENTRIC("ecentric"), + + METRICS_GLOBAL("metrics_global"), + + WINDCAVE("windcave"), + + PAY_COM("pay_com"), + + EBANX("ebanx"), + + DLOCAL("dlocal"), + + NUVEI("nuvei"), + + SOLIDGATE("solidgate"), + + PAYSTACK("paystack"), + + JP_MORGAN("jp_morgan"), + + DEUTSCHE_BANK("deutsche_bank"), + + EZIDEBIT("ezidebit"), + + /** An enum member indicating that Gateway was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Gateway(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Gateway fromString(String value) { + if (value == null) return _UNKNOWN; + for (Gateway enumValue : Gateway.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class PaymentIntentParams { + + private final String id; + + private final String gatewayAccountId; + + private final String gwToken; + + private final PaymentMethodType paymentMethodType; + + private final String referenceId; + + private final String gwPaymentMethodId; + + private final java.util.Map additionalInformation; + + private PaymentIntentParams(PaymentIntentBuilder builder) { + + this.id = builder.id; + + this.gatewayAccountId = builder.gatewayAccountId; + + this.gwToken = builder.gwToken; + + this.paymentMethodType = builder.paymentMethodType; + + this.referenceId = builder.referenceId; + + this.gwPaymentMethodId = builder.gwPaymentMethodId; + + this.additionalInformation = builder.additionalInformation; + } + + public String getId() { + return id; + } + + public String getGatewayAccountId() { + return gatewayAccountId; + } + + public String getGwToken() { + return gwToken; + } + + public PaymentMethodType getPaymentMethodType() { + return paymentMethodType; + } + + public String getReferenceId() { + return referenceId; + } + + public String getGwPaymentMethodId() { + return gwPaymentMethodId; + } + + public java.util.Map getAdditionalInformation() { + return additionalInformation; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.gatewayAccountId != null) { + + formData.put("gateway_account_id", this.gatewayAccountId); + } + + if (this.gwToken != null) { + + formData.put("gw_token", this.gwToken); + } + + if (this.paymentMethodType != null) { + + formData.put("payment_method_type", this.paymentMethodType); + } + + if (this.referenceId != null) { + + formData.put("reference_id", this.referenceId); + } + + if (this.gwPaymentMethodId != null) { + + formData.put("gw_payment_method_id", this.gwPaymentMethodId); + } + + if (this.additionalInformation != null) { + + formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); + } + + return formData; + } + + /** Create a new builder for PaymentIntentParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static PaymentIntentBuilder builder() { + return new PaymentIntentBuilder(); + } + + public static final class PaymentIntentBuilder { + + private String id; + + private String gatewayAccountId; + + private String gwToken; + + private PaymentMethodType paymentMethodType; + + private String referenceId; + + private String gwPaymentMethodId; + + private java.util.Map additionalInformation; + + private PaymentIntentBuilder() {} + + public PaymentIntentBuilder id(String value) { + this.id = value; + return this; + } + + public PaymentIntentBuilder gatewayAccountId(String value) { + this.gatewayAccountId = value; + return this; + } + + public PaymentIntentBuilder gwToken(String value) { + this.gwToken = value; + return this; + } + + public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { + this.paymentMethodType = value; + return this; + } + + public PaymentIntentBuilder referenceId(String value) { + this.referenceId = value; + return this; + } + + @Deprecated + public PaymentIntentBuilder gwPaymentMethodId(String value) { + this.gwPaymentMethodId = value; + return this; + } + + public PaymentIntentBuilder additionalInformation(java.util.Map value) { + this.additionalInformation = value; + return this; + } + + public PaymentIntentParams build() { + return new PaymentIntentParams(this); + } + } + + public enum PaymentMethodType { + CARD("card"), + + IDEAL("ideal"), + + SOFORT("sofort"), + + BANCONTACT("bancontact"), + + GOOGLE_PAY("google_pay"), + + DOTPAY("dotpay"), + + GIROPAY("giropay"), + + APPLE_PAY("apple_pay"), + + UPI("upi"), + + NETBANKING_EMANDATES("netbanking_emandates"), + + PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), + + DIRECT_DEBIT("direct_debit"), + + BOLETO("boleto"), + + VENMO("venmo"), + + AMAZON_PAYMENTS("amazon_payments"), + + PAY_TO("pay_to"), + + FASTER_PAYMENTS("faster_payments"), + + SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), + + KLARNA_PAY_NOW("klarna_pay_now"), + + ONLINE_BANKING_POLAND("online_banking_poland"), + + PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), + + ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), + + KBC_PAYMENT_BUTTON("kbc_payment_button"), + + PAY_BY_BANK("pay_by_bank"), + + TRUSTLY("trustly"), + + STABLECOIN("stablecoin"), + + /** + * An enum member indicating that PaymentMethodType was instantiated with an unknown value. + */ + _UNKNOWN(null); + private final String value; + + PaymentMethodType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethodType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethodType enumValue : PaymentMethodType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class BillingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private BillingAddressParams(BillingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for BillingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingAddressBuilder builder() { + return new BillingAddressBuilder(); + } + + public static final class BillingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private BillingAddressBuilder() {} + + public BillingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public BillingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public BillingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public BillingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public BillingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public BillingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public BillingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public BillingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public BillingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public BillingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public BillingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public BillingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public BillingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public BillingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public BillingAddressParams build() { + return new BillingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ShippingAddressParams { + + private final String firstName; + + private final String lastName; + + private final String email; + + private final String company; + + private final String phone; + + private final String line1; + + private final String line2; + + private final String line3; + + private final String city; + + private final String stateCode; + + private final String state; + + private final String zip; + + private final String country; + + private final ValidationStatus validationStatus; + + private ShippingAddressParams(ShippingAddressBuilder builder) { + + this.firstName = builder.firstName; + + this.lastName = builder.lastName; + + this.email = builder.email; + + this.company = builder.company; + + this.phone = builder.phone; + + this.line1 = builder.line1; + + this.line2 = builder.line2; + + this.line3 = builder.line3; + + this.city = builder.city; + + this.stateCode = builder.stateCode; + + this.state = builder.state; + + this.zip = builder.zip; + + this.country = builder.country; + + this.validationStatus = builder.validationStatus; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getEmail() { + return email; + } + + public String getCompany() { + return company; + } + + public String getPhone() { + return phone; + } + + public String getLine1() { + return line1; + } + + public String getLine2() { + return line2; + } + + public String getLine3() { + return line3; + } + + public String getCity() { + return city; + } + + public String getStateCode() { + return stateCode; + } + + public String getState() { + return state; + } + + public String getZip() { + return zip; + } + + public String getCountry() { + return country; + } + + public ValidationStatus getValidationStatus() { + return validationStatus; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.firstName != null) { + + formData.put("first_name", this.firstName); + } + + if (this.lastName != null) { + + formData.put("last_name", this.lastName); + } + + if (this.email != null) { + + formData.put("email", this.email); + } + + if (this.company != null) { + + formData.put("company", this.company); + } + + if (this.phone != null) { + + formData.put("phone", this.phone); + } + + if (this.line1 != null) { + + formData.put("line1", this.line1); + } + + if (this.line2 != null) { + + formData.put("line2", this.line2); + } + + if (this.line3 != null) { + + formData.put("line3", this.line3); + } + + if (this.city != null) { + + formData.put("city", this.city); + } + + if (this.stateCode != null) { + + formData.put("state_code", this.stateCode); + } + + if (this.state != null) { + + formData.put("state", this.state); + } + + if (this.zip != null) { + + formData.put("zip", this.zip); + } + + if (this.country != null) { + + formData.put("country", this.country); + } + + if (this.validationStatus != null) { + + formData.put("validation_status", this.validationStatus); + } + + return formData; + } + + /** Create a new builder for ShippingAddressParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ShippingAddressBuilder builder() { + return new ShippingAddressBuilder(); + } + + public static final class ShippingAddressBuilder { + + private String firstName; + + private String lastName; + + private String email; + + private String company; + + private String phone; + + private String line1; + + private String line2; + + private String line3; + + private String city; + + private String stateCode; + + private String state; + + private String zip; + + private String country; + + private ValidationStatus validationStatus; + + private ShippingAddressBuilder() {} + + public ShippingAddressBuilder firstName(String value) { + this.firstName = value; + return this; + } + + public ShippingAddressBuilder lastName(String value) { + this.lastName = value; + return this; + } + + public ShippingAddressBuilder email(String value) { + this.email = value; + return this; + } + + public ShippingAddressBuilder company(String value) { + this.company = value; + return this; + } + + public ShippingAddressBuilder phone(String value) { + this.phone = value; + return this; + } + + public ShippingAddressBuilder line1(String value) { + this.line1 = value; + return this; + } + + public ShippingAddressBuilder line2(String value) { + this.line2 = value; + return this; + } + + public ShippingAddressBuilder line3(String value) { + this.line3 = value; + return this; + } + + public ShippingAddressBuilder city(String value) { + this.city = value; + return this; + } + + public ShippingAddressBuilder stateCode(String value) { + this.stateCode = value; + return this; + } + + public ShippingAddressBuilder state(String value) { + this.state = value; + return this; + } + + public ShippingAddressBuilder zip(String value) { + this.zip = value; + return this; + } + + public ShippingAddressBuilder country(String value) { + this.country = value; + return this; + } + + public ShippingAddressBuilder validationStatus(ValidationStatus value) { + this.validationStatus = value; + return this; + } + + public ShippingAddressParams build() { + return new ShippingAddressParams(this); + } + } + + public enum ValidationStatus { + NOT_VALIDATED("not_validated"), + + VALID("valid"), + + PARTIALLY_VALID("partially_valid"), + + INVALID("invalid"), + + /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ValidationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ValidationStatus fromString(String value) { + if (value == null) return _UNKNOWN; + for (ValidationStatus enumValue : ValidationStatus.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class StatementDescriptorParams { + + private final String descriptor; + + private StatementDescriptorParams(StatementDescriptorBuilder builder) { + + this.descriptor = builder.descriptor; + } + + public String getDescriptor() { + return descriptor; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.descriptor != null) { + + formData.put("descriptor", this.descriptor); + } + + return formData; + } + + /** Create a new builder for StatementDescriptorParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static StatementDescriptorBuilder builder() { + return new StatementDescriptorBuilder(); + } + + public static final class StatementDescriptorBuilder { + + private String descriptor; + + private StatementDescriptorBuilder() {} + + public StatementDescriptorBuilder descriptor(String value) { + this.descriptor = value; + return this; + } + + public StatementDescriptorParams build() { + return new StatementDescriptorParams(this); + } + } + } + + public static final class CustomerParams { + + private final String vatNumber; + + private final String vatNumberPrefix; + + private final String entityIdentifierScheme; + + private final Boolean isEinvoiceEnabled; + + private final EinvoicingMethod einvoicingMethod; + + private final String entityIdentifierStandard; + + private final Boolean businessCustomerWithoutVatNumber; + + private final Boolean registeredForGst; + + private CustomerParams(CustomerBuilder builder) { + + this.vatNumber = builder.vatNumber; + + this.vatNumberPrefix = builder.vatNumberPrefix; + + this.entityIdentifierScheme = builder.entityIdentifierScheme; + + this.isEinvoiceEnabled = builder.isEinvoiceEnabled; + + this.einvoicingMethod = builder.einvoicingMethod; + + this.entityIdentifierStandard = builder.entityIdentifierStandard; + + this.businessCustomerWithoutVatNumber = builder.businessCustomerWithoutVatNumber; + + this.registeredForGst = builder.registeredForGst; + } + + public String getVatNumber() { + return vatNumber; + } + + public String getVatNumberPrefix() { + return vatNumberPrefix; + } + + public String getEntityIdentifierScheme() { + return entityIdentifierScheme; + } + + public Boolean getIsEinvoiceEnabled() { + return isEinvoiceEnabled; + } + + public EinvoicingMethod getEinvoicingMethod() { + return einvoicingMethod; + } + + public String getEntityIdentifierStandard() { + return entityIdentifierStandard; + } + + public Boolean getBusinessCustomerWithoutVatNumber() { + return businessCustomerWithoutVatNumber; + } + + public Boolean getRegisteredForGst() { + return registeredForGst; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.vatNumber != null) { + + formData.put("vat_number", this.vatNumber); + } + + if (this.vatNumberPrefix != null) { + + formData.put("vat_number_prefix", this.vatNumberPrefix); + } + + if (this.entityIdentifierScheme != null) { + + formData.put("entity_identifier_scheme", this.entityIdentifierScheme); + } + + if (this.isEinvoiceEnabled != null) { + + formData.put("is_einvoice_enabled", this.isEinvoiceEnabled); + } + + if (this.einvoicingMethod != null) { + + formData.put("einvoicing_method", this.einvoicingMethod); + } + + if (this.entityIdentifierStandard != null) { + + formData.put("entity_identifier_standard", this.entityIdentifierStandard); + } + + if (this.businessCustomerWithoutVatNumber != null) { + + formData.put("business_customer_without_vat_number", this.businessCustomerWithoutVatNumber); + } + + if (this.registeredForGst != null) { + + formData.put("registered_for_gst", this.registeredForGst); + } + + return formData; + } + + /** Create a new builder for CustomerParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CustomerBuilder builder() { + return new CustomerBuilder(); + } + + public static final class CustomerBuilder { + + private String vatNumber; + + private String vatNumberPrefix; + + private String entityIdentifierScheme; + + private Boolean isEinvoiceEnabled; + + private EinvoicingMethod einvoicingMethod; + + private String entityIdentifierStandard; + + private Boolean businessCustomerWithoutVatNumber; + + private Boolean registeredForGst; + + private CustomerBuilder() {} + + public CustomerBuilder vatNumber(String value) { + this.vatNumber = value; + return this; + } + + public CustomerBuilder vatNumberPrefix(String value) { + this.vatNumberPrefix = value; + return this; + } + + public CustomerBuilder entityIdentifierScheme(String value) { + this.entityIdentifierScheme = value; + return this; + } + + public CustomerBuilder isEinvoiceEnabled(Boolean value) { + this.isEinvoiceEnabled = value; + return this; + } + + public CustomerBuilder einvoicingMethod(EinvoicingMethod value) { + this.einvoicingMethod = value; + return this; + } + + public CustomerBuilder entityIdentifierStandard(String value) { + this.entityIdentifierStandard = value; + return this; + } + + public CustomerBuilder businessCustomerWithoutVatNumber(Boolean value) { + this.businessCustomerWithoutVatNumber = value; + return this; + } + + public CustomerBuilder registeredForGst(Boolean value) { + this.registeredForGst = value; + return this; + } + + public CustomerParams build() { + return new CustomerParams(this); + } + } + + public enum EinvoicingMethod { + AUTOMATIC("automatic"), + + MANUAL("manual"), + + SITE_DEFAULT("site_default"), + + /** An enum member indicating that EinvoicingMethod was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + EinvoicingMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EinvoicingMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (EinvoicingMethod enumValue : EinvoicingMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ContractTermParams { + + private final ActionAtTermEnd actionAtTermEnd; + + private final Integer cancellationCutoffPeriod; + + private final Timestamp contractStart; + + private ContractTermParams(ContractTermBuilder builder) { + + this.actionAtTermEnd = builder.actionAtTermEnd; + + this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; + + this.contractStart = builder.contractStart; + } + + public ActionAtTermEnd getActionAtTermEnd() { + return actionAtTermEnd; + } + + public Integer getCancellationCutoffPeriod() { + return cancellationCutoffPeriod; + } + + public Timestamp getContractStart() { + return contractStart; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.actionAtTermEnd != null) { + + formData.put("action_at_term_end", this.actionAtTermEnd); + } + + if (this.cancellationCutoffPeriod != null) { + + formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); + } + + if (this.contractStart != null) { + + formData.put("contract_start", this.contractStart); + } + + return formData; + } + + /** Create a new builder for ContractTermParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ContractTermBuilder builder() { + return new ContractTermBuilder(); + } + + public static final class ContractTermBuilder { + + private ActionAtTermEnd actionAtTermEnd; + + private Integer cancellationCutoffPeriod; + + private Timestamp contractStart; + + private ContractTermBuilder() {} + + public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { + this.actionAtTermEnd = value; + return this; + } + + public ContractTermBuilder cancellationCutoffPeriod(Integer value) { + this.cancellationCutoffPeriod = value; + return this; + } + + @Deprecated + public ContractTermBuilder contractStart(Timestamp value) { + this.contractStart = value; + return this; + } + + public ContractTermParams build() { + return new ContractTermParams(this); + } + } + + public enum ActionAtTermEnd { + RENEW("renew"), + + EVERGREEN("evergreen"), + + CANCEL("cancel"), + + RENEW_ONCE("renew_once"), + + /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ActionAtTermEnd(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ActionAtTermEnd fromString(String value) { + if (value == null) return _UNKNOWN; + for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class BillingOverrideParams { + + private final Long maxExcessPaymentUsage; + + private final Long maxRefundableCreditsUsage; + + private BillingOverrideParams(BillingOverrideBuilder builder) { + + this.maxExcessPaymentUsage = builder.maxExcessPaymentUsage; + + this.maxRefundableCreditsUsage = builder.maxRefundableCreditsUsage; + } + + public Long getMaxExcessPaymentUsage() { + return maxExcessPaymentUsage; + } + + public Long getMaxRefundableCreditsUsage() { + return maxRefundableCreditsUsage; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.maxExcessPaymentUsage != null) { + + formData.put("max_excess_payment_usage", this.maxExcessPaymentUsage); + } + + if (this.maxRefundableCreditsUsage != null) { + + formData.put("max_refundable_credits_usage", this.maxRefundableCreditsUsage); + } + + return formData; + } + + /** Create a new builder for BillingOverrideParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static BillingOverrideBuilder builder() { + return new BillingOverrideBuilder(); + } + + public static final class BillingOverrideBuilder { + + private Long maxExcessPaymentUsage; + + private Long maxRefundableCreditsUsage; + + private BillingOverrideBuilder() {} + + public BillingOverrideBuilder maxExcessPaymentUsage(Long value) { + this.maxExcessPaymentUsage = value; + return this; + } + + public BillingOverrideBuilder maxRefundableCreditsUsage(Long value) { + this.maxRefundableCreditsUsage = value; + return this; + } + + public BillingOverrideParams build() { + return new BillingOverrideParams(this); + } + } + } + + public static final class SubscriptionItemsParams { + + private final String itemPriceId; + + private final Integer quantity; + + private final String quantityInDecimal; + + private final Long unitPrice; + + private final String unitPriceInDecimal; + + private final Integer billingCycles; + + private final Timestamp trialEnd; + + private final Integer servicePeriodDays; + + private final ChargeOnEvent chargeOnEvent; + + private final Boolean chargeOnce; + + private final ChargeOnOption chargeOnOption; + + private final ItemType itemType; + + private final ProrationType prorationType; + + private final UsageAccumulationResetFrequency usageAccumulationResetFrequency; + + private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.quantityInDecimal = builder.quantityInDecimal; + + this.unitPrice = builder.unitPrice; + + this.unitPriceInDecimal = builder.unitPriceInDecimal; + + this.billingCycles = builder.billingCycles; + + this.trialEnd = builder.trialEnd; + + this.servicePeriodDays = builder.servicePeriodDays; + + this.chargeOnEvent = builder.chargeOnEvent; + + this.chargeOnce = builder.chargeOnce; + + this.chargeOnOption = builder.chargeOnOption; + + this.itemType = builder.itemType; + + this.prorationType = builder.prorationType; + + this.usageAccumulationResetFrequency = builder.usageAccumulationResetFrequency; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public String getQuantityInDecimal() { + return quantityInDecimal; + } + + public Long getUnitPrice() { + return unitPrice; + } + + public String getUnitPriceInDecimal() { + return unitPriceInDecimal; + } + + public Integer getBillingCycles() { + return billingCycles; + } + + public Timestamp getTrialEnd() { + return trialEnd; + } + + public Integer getServicePeriodDays() { + return servicePeriodDays; + } + + public ChargeOnEvent getChargeOnEvent() { + return chargeOnEvent; + } + + public Boolean getChargeOnce() { + return chargeOnce; + } + + public ChargeOnOption getChargeOnOption() { + return chargeOnOption; + } + + public ItemType getItemType() { + return itemType; + } + + public ProrationType getProrationType() { + return prorationType; + } + + public UsageAccumulationResetFrequency getUsageAccumulationResetFrequency() { + return usageAccumulationResetFrequency; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.quantityInDecimal != null) { + + formData.put("quantity_in_decimal", this.quantityInDecimal); + } + + if (this.unitPrice != null) { + + formData.put("unit_price", this.unitPrice); + } + + if (this.unitPriceInDecimal != null) { + + formData.put("unit_price_in_decimal", this.unitPriceInDecimal); + } + + if (this.billingCycles != null) { + + formData.put("billing_cycles", this.billingCycles); + } + + if (this.trialEnd != null) { + + formData.put("trial_end", this.trialEnd); + } + + if (this.servicePeriodDays != null) { + + formData.put("service_period_days", this.servicePeriodDays); + } + + if (this.chargeOnEvent != null) { + + formData.put("charge_on_event", this.chargeOnEvent); + } + + if (this.chargeOnce != null) { + + formData.put("charge_once", this.chargeOnce); + } + + if (this.chargeOnOption != null) { + + formData.put("charge_on_option", this.chargeOnOption); + } + + if (this.itemType != null) { + + formData.put("item_type", this.itemType); + } + + if (this.prorationType != null) { + + formData.put("proration_type", this.prorationType); + } + + if (this.usageAccumulationResetFrequency != null) { + + formData.put("usage_accumulation_reset_frequency", this.usageAccumulationResetFrequency); + } + + return formData; + } + + /** Create a new builder for SubscriptionItemsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionItemsBuilder builder() { + return new SubscriptionItemsBuilder(); + } + + public static final class SubscriptionItemsBuilder { + + private String itemPriceId; + + private Integer quantity; + + private String quantityInDecimal; + + private Long unitPrice; + + private String unitPriceInDecimal; + + private Integer billingCycles; + + private Timestamp trialEnd; + + private Integer servicePeriodDays; + + private ChargeOnEvent chargeOnEvent; + + private Boolean chargeOnce; + + private ChargeOnOption chargeOnOption; + + private ItemType itemType; + + private ProrationType prorationType; + + private UsageAccumulationResetFrequency usageAccumulationResetFrequency; + + private SubscriptionItemsBuilder() {} + + public SubscriptionItemsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public SubscriptionItemsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public SubscriptionItemsBuilder quantityInDecimal(String value) { + this.quantityInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder unitPrice(Long value) { + this.unitPrice = value; + return this; + } + + public SubscriptionItemsBuilder unitPriceInDecimal(String value) { + this.unitPriceInDecimal = value; + return this; + } + + public SubscriptionItemsBuilder billingCycles(Integer value) { + this.billingCycles = value; + return this; + } + + public SubscriptionItemsBuilder trialEnd(Timestamp value) { + this.trialEnd = value; + return this; + } + + public SubscriptionItemsBuilder servicePeriodDays(Integer value) { + this.servicePeriodDays = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { + this.chargeOnEvent = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnce(Boolean value) { + this.chargeOnce = value; + return this; + } + + public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { + this.chargeOnOption = value; + return this; + } + + public SubscriptionItemsBuilder itemType(ItemType value) { + this.itemType = value; + return this; + } + + public SubscriptionItemsBuilder prorationType(ProrationType value) { + this.prorationType = value; + return this; + } + + public SubscriptionItemsBuilder usageAccumulationResetFrequency( + UsageAccumulationResetFrequency value) { + this.usageAccumulationResetFrequency = value; + return this; + } + + public SubscriptionItemsParams build() { + return new SubscriptionItemsParams(this); + } + } + + public enum ChargeOnEvent { + SUBSCRIPTION_CREATION("subscription_creation"), + + SUBSCRIPTION_TRIAL_START("subscription_trial_start"), + + PLAN_ACTIVATION("plan_activation"), + + SUBSCRIPTION_ACTIVATION("subscription_activation"), + + CONTRACT_TERMINATION("contract_termination"), + + /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnEvent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnEvent fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ChargeOnOption { + IMMEDIATELY("immediately"), + + ON_EVENT("on_event"), + + /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ChargeOnOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ChargeOnOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (ChargeOnOption enumValue : ChargeOnOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ItemType { + PLAN("plan"), + + ADDON("addon"), + + CHARGE("charge"), + + /** An enum member indicating that ItemType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ItemType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ItemType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ItemType enumValue : ItemType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum ProrationType { + FULL_TERM("full_term"), + + PARTIAL_TERM("partial_term"), + + NONE("none"), + + /** An enum member indicating that ProrationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ProrationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ProrationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (ProrationType enumValue : ProrationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum UsageAccumulationResetFrequency { + NEVER("never"), + + SUBSCRIPTION_BILLING_FREQUENCY("subscription_billing_frequency"), + + /** + * An enum member indicating that UsageAccumulationResetFrequency was instantiated with an + * unknown value. + */ + _UNKNOWN(null); + private final String value; + + UsageAccumulationResetFrequency(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static UsageAccumulationResetFrequency fromString(String value) { + if (value == null) return _UNKNOWN; + for (UsageAccumulationResetFrequency enumValue : UsageAccumulationResetFrequency.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class DiscountsParams { + + private final ApplyOn applyOn; + + private final DurationType durationType; + + private final Number percentage; + + private final Long amount; + + private final Integer period; + + private final PeriodUnit periodUnit; + + private final Boolean includedInMrr; + + private final String itemPriceId; + + private final Integer quantity; + + private final OperationType operationType; + + private final String id; + + private DiscountsParams(DiscountsBuilder builder) { + + this.applyOn = builder.applyOn; + + this.durationType = builder.durationType; + + this.percentage = builder.percentage; + + this.amount = builder.amount; + + this.period = builder.period; + + this.periodUnit = builder.periodUnit; + + this.includedInMrr = builder.includedInMrr; + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.operationType = builder.operationType; + + this.id = builder.id; + } + + public ApplyOn getApplyOn() { + return applyOn; + } + + public DurationType getDurationType() { + return durationType; + } + + public Number getPercentage() { + return percentage; + } + + public Long getAmount() { + return amount; + } + + public Integer getPeriod() { + return period; + } + + public PeriodUnit getPeriodUnit() { + return periodUnit; + } + + public Boolean getIncludedInMrr() { + return includedInMrr; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getQuantity() { + return quantity; + } + + public OperationType getOperationType() { + return operationType; + } + + public String getId() { + return id; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.applyOn != null) { + + formData.put("apply_on", this.applyOn); + } + + if (this.durationType != null) { + + formData.put("duration_type", this.durationType); + } + + if (this.percentage != null) { + + formData.put("percentage", this.percentage); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.period != null) { + + formData.put("period", this.period); + } + + if (this.periodUnit != null) { + + formData.put("period_unit", this.periodUnit); + } + + if (this.includedInMrr != null) { + + formData.put("included_in_mrr", this.includedInMrr); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.operationType != null) { + + formData.put("operation_type", this.operationType); + } + + if (this.id != null) { + + formData.put("id", this.id); + } + + return formData; + } + + /** Create a new builder for DiscountsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DiscountsBuilder builder() { + return new DiscountsBuilder(); + } + + public static final class DiscountsBuilder { + + private ApplyOn applyOn; + + private DurationType durationType; + + private Number percentage; + + private Long amount; + + private Integer period; + + private PeriodUnit periodUnit; + + private Boolean includedInMrr; + + private String itemPriceId; + + private Integer quantity; + + private OperationType operationType; + + private String id; + + private DiscountsBuilder() {} + + public DiscountsBuilder applyOn(ApplyOn value) { + this.applyOn = value; + return this; + } + + public DiscountsBuilder durationType(DurationType value) { + this.durationType = value; + return this; + } + + public DiscountsBuilder percentage(Number value) { + this.percentage = value; + return this; + } + + public DiscountsBuilder amount(Long value) { + this.amount = value; + return this; + } + + public DiscountsBuilder period(Integer value) { + this.period = value; + return this; + } + + public DiscountsBuilder periodUnit(PeriodUnit value) { + this.periodUnit = value; + return this; + } + + public DiscountsBuilder includedInMrr(Boolean value) { + this.includedInMrr = value; + return this; + } + + public DiscountsBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public DiscountsBuilder quantity(Integer value) { + this.quantity = value; + return this; + } + + public DiscountsBuilder operationType(OperationType value) { + this.operationType = value; + return this; + } + + public DiscountsBuilder id(String value) { + this.id = value; + return this; + } + + public DiscountsParams build() { + return new DiscountsParams(this); + } + } + + public enum ApplyOn { + INVOICE_AMOUNT("invoice_amount"), + + SPECIFIC_ITEM_PRICE("specific_item_price"), + + /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + ApplyOn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static ApplyOn fromString(String value) { + if (value == null) return _UNKNOWN; + for (ApplyOn enumValue : ApplyOn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum DurationType { + ONE_TIME("one_time"), + + FOREVER("forever"), + + LIMITED_PERIOD("limited_period"), + + /** An enum member indicating that DurationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DurationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DurationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (DurationType enumValue : DurationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum PeriodUnit { + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + YEAR("year"), + + /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PeriodUnit(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PeriodUnit fromString(String value) { + if (value == null) return _UNKNOWN; + for (PeriodUnit enumValue : PeriodUnit.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum OperationType { + ADD("add"), + + REMOVE("remove"), + + /** An enum member indicating that OperationType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + OperationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static OperationType fromString(String value) { + if (value == null) return _UNKNOWN; + for (OperationType enumValue : OperationType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class ItemTiersParams { + + private final String itemPriceId; + + private final Integer startingUnit; + + private final Integer endingUnit; + + private final Long price; + + private final String startingUnitInDecimal; + + private final String endingUnitInDecimal; + + private final String priceInDecimal; + + private final PricingType pricingType; + + private final Integer packageSize; + + private ItemTiersParams(ItemTiersBuilder builder) { + + this.itemPriceId = builder.itemPriceId; + + this.startingUnit = builder.startingUnit; + + this.endingUnit = builder.endingUnit; + + this.price = builder.price; + + this.startingUnitInDecimal = builder.startingUnitInDecimal; + + this.endingUnitInDecimal = builder.endingUnitInDecimal; + + this.priceInDecimal = builder.priceInDecimal; + + this.pricingType = builder.pricingType; + + this.packageSize = builder.packageSize; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public Integer getStartingUnit() { + return startingUnit; + } + + public Integer getEndingUnit() { + return endingUnit; + } + + public Long getPrice() { + return price; + } + + public String getStartingUnitInDecimal() { + return startingUnitInDecimal; + } + + public String getEndingUnitInDecimal() { + return endingUnitInDecimal; + } + + public String getPriceInDecimal() { + return priceInDecimal; + } + + public PricingType getPricingType() { + return pricingType; + } + + public Integer getPackageSize() { + return packageSize; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.startingUnit != null) { + + formData.put("starting_unit", this.startingUnit); + } + + if (this.endingUnit != null) { + + formData.put("ending_unit", this.endingUnit); + } + + if (this.price != null) { + + formData.put("price", this.price); + } + + if (this.startingUnitInDecimal != null) { + + formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); + } + + if (this.endingUnitInDecimal != null) { + + formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); + } + + if (this.priceInDecimal != null) { + + formData.put("price_in_decimal", this.priceInDecimal); + } + + if (this.pricingType != null) { + + formData.put("pricing_type", this.pricingType); + } + + if (this.packageSize != null) { + + formData.put("package_size", this.packageSize); + } + + return formData; + } + + /** Create a new builder for ItemTiersParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ItemTiersBuilder builder() { + return new ItemTiersBuilder(); + } + + public static final class ItemTiersBuilder { + + private String itemPriceId; + + private Integer startingUnit; + + private Integer endingUnit; + + private Long price; + + private String startingUnitInDecimal; + + private String endingUnitInDecimal; + + private String priceInDecimal; + + private PricingType pricingType; + + private Integer packageSize; + + private ItemTiersBuilder() {} + + public ItemTiersBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public ItemTiersBuilder startingUnit(Integer value) { + this.startingUnit = value; + return this; + } + + public ItemTiersBuilder endingUnit(Integer value) { + this.endingUnit = value; + return this; + } + + public ItemTiersBuilder price(Long value) { + this.price = value; + return this; + } + + public ItemTiersBuilder startingUnitInDecimal(String value) { + this.startingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder endingUnitInDecimal(String value) { + this.endingUnitInDecimal = value; + return this; + } + + public ItemTiersBuilder priceInDecimal(String value) { + this.priceInDecimal = value; + return this; + } + + public ItemTiersBuilder pricingType(PricingType value) { + this.pricingType = value; + return this; + } + + public ItemTiersBuilder packageSize(Integer value) { + this.packageSize = value; + return this; + } + + public ItemTiersParams build() { + return new ItemTiersParams(this); + } + } + + public enum PricingType { + PER_UNIT("per_unit"), + + FLAT_FEE("flat_fee"), + + PACKAGE("package"), + + /** An enum member indicating that PricingType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PricingType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PricingType fromString(String value) { + if (value == null) return _UNKNOWN; + for (PricingType enumValue : PricingType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + } + + public static final class CouponsParams { + + private final String couponId; + + private final Timestamp applyTill; + + private CouponsParams(CouponsBuilder builder) { + + this.couponId = builder.couponId; + + this.applyTill = builder.applyTill; + } + + public String getCouponId() { + return couponId; + } + + public Timestamp getApplyTill() { + return applyTill; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.couponId != null) { + + formData.put("coupon_id", this.couponId); + } + + if (this.applyTill != null) { + + formData.put("apply_till", this.applyTill); + } + + return formData; + } + + /** Create a new builder for CouponsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CouponsBuilder builder() { + return new CouponsBuilder(); + } + + public static final class CouponsBuilder { + + private String couponId; + + private Timestamp applyTill; + + private CouponsBuilder() {} + + public CouponsBuilder couponId(String value) { + this.couponId = value; + return this; + } + + public CouponsBuilder applyTill(Timestamp value) { + this.applyTill = value; + return this; + } + + public CouponsParams build() { + return new CouponsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/UpdateForItemsForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/UpdateForItemsForSubscriptionParams.java deleted file mode 100644 index 9b784ceb..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/params/UpdateForItemsForSubscriptionParams.java +++ /dev/null @@ -1,4876 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscription.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class UpdateForItemsForSubscriptionParams { - - private final List mandatoryItemsToRemove; - - private final Boolean replaceItemsList; - - private final Long setupFee; - - private final Integer netTermDays; - - private final Timestamp invoiceDate; - - private final Timestamp startDate; - - private final Timestamp trialEnd; - - private final Integer billingCycles; - - private final String coupon; - - private final Integer termsToCharge; - - private final Timestamp reactivateFrom; - - private final BillingAlignmentMode billingAlignmentMode; - - private final AutoCollection autoCollection; - - private final OfflinePaymentMethod offlinePaymentMethod; - - private final String poNumber; - - private final List couponIds; - - private final Boolean replaceCouponList; - - private final Boolean prorate; - - private final Boolean endOfTerm; - - private final Boolean forceTermReset; - - private final Boolean reactivate; - - private final String tokenId; - - private final String invoiceNotes; - - private final java.util.Map metaData; - - private final Boolean invoiceImmediately; - - private final Boolean overrideRelationship; - - private final Timestamp changesScheduledAt; - - private final ChangeOption changeOption; - - private final Integer contractTermBillingCycleOnRenewal; - - private final Integer freePeriod; - - private final FreePeriodUnit freePeriodUnit; - - private final Boolean createPendingInvoices; - - private final Boolean autoCloseInvoices; - - private final TrialEndAction trialEndAction; - - private final PaymentInitiator paymentInitiator; - - private final Boolean invoiceUsages; - - private final CardParams card; - - private final PaymentMethodParams paymentMethod; - - private final PaymentIntentParams paymentIntent; - - private final BillingAddressParams billingAddress; - - private final ShippingAddressParams shippingAddress; - - private final StatementDescriptorParams statementDescriptor; - - private final CustomerParams customer; - - private final ContractTermParams contractTerm; - - private final BillingOverrideParams billingOverride; - - private final List subscriptionItems; - - private final List discounts; - - private final List itemTiers; - - private final List coupons; - - private final Map customFields; - - private UpdateForItemsForSubscriptionParams(UpdateForItemsForSubscriptionBuilder builder) { - - this.mandatoryItemsToRemove = builder.mandatoryItemsToRemove; - - this.replaceItemsList = builder.replaceItemsList; - - this.setupFee = builder.setupFee; - - this.netTermDays = builder.netTermDays; - - this.invoiceDate = builder.invoiceDate; - - this.startDate = builder.startDate; - - this.trialEnd = builder.trialEnd; - - this.billingCycles = builder.billingCycles; - - this.coupon = builder.coupon; - - this.termsToCharge = builder.termsToCharge; - - this.reactivateFrom = builder.reactivateFrom; - - this.billingAlignmentMode = builder.billingAlignmentMode; - - this.autoCollection = builder.autoCollection; - - this.offlinePaymentMethod = builder.offlinePaymentMethod; - - this.poNumber = builder.poNumber; - - this.couponIds = builder.couponIds; - - this.replaceCouponList = builder.replaceCouponList; - - this.prorate = builder.prorate; - - this.endOfTerm = builder.endOfTerm; - - this.forceTermReset = builder.forceTermReset; - - this.reactivate = builder.reactivate; - - this.tokenId = builder.tokenId; - - this.invoiceNotes = builder.invoiceNotes; - - this.metaData = builder.metaData; - - this.invoiceImmediately = builder.invoiceImmediately; - - this.overrideRelationship = builder.overrideRelationship; - - this.changesScheduledAt = builder.changesScheduledAt; - - this.changeOption = builder.changeOption; - - this.contractTermBillingCycleOnRenewal = builder.contractTermBillingCycleOnRenewal; - - this.freePeriod = builder.freePeriod; - - this.freePeriodUnit = builder.freePeriodUnit; - - this.createPendingInvoices = builder.createPendingInvoices; - - this.autoCloseInvoices = builder.autoCloseInvoices; - - this.trialEndAction = builder.trialEndAction; - - this.paymentInitiator = builder.paymentInitiator; - - this.invoiceUsages = builder.invoiceUsages; - - this.card = builder.card; - - this.paymentMethod = builder.paymentMethod; - - this.paymentIntent = builder.paymentIntent; - - this.billingAddress = builder.billingAddress; - - this.shippingAddress = builder.shippingAddress; - - this.statementDescriptor = builder.statementDescriptor; - - this.customer = builder.customer; - - this.contractTerm = builder.contractTerm; - - this.billingOverride = builder.billingOverride; - - this.subscriptionItems = builder.subscriptionItems; - - this.discounts = builder.discounts; - - this.itemTiers = builder.itemTiers; - - this.coupons = builder.coupons; - - this.customFields = - builder.customFields.isEmpty() - ? Collections.emptyMap() - : Collections.unmodifiableMap(new LinkedHashMap<>(builder.customFields)); - } - - public List getMandatoryItemsToRemove() { - return mandatoryItemsToRemove; - } - - public Boolean getReplaceItemsList() { - return replaceItemsList; - } - - public Long getSetupFee() { - return setupFee; - } - - public Integer getNetTermDays() { - return netTermDays; - } - - public Timestamp getInvoiceDate() { - return invoiceDate; - } - - public Timestamp getStartDate() { - return startDate; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public String getCoupon() { - return coupon; - } - - public Integer getTermsToCharge() { - return termsToCharge; - } - - public Timestamp getReactivateFrom() { - return reactivateFrom; - } - - public BillingAlignmentMode getBillingAlignmentMode() { - return billingAlignmentMode; - } - - public AutoCollection getAutoCollection() { - return autoCollection; - } - - public OfflinePaymentMethod getOfflinePaymentMethod() { - return offlinePaymentMethod; - } - - public String getPoNumber() { - return poNumber; - } - - public List getCouponIds() { - return couponIds; - } - - public Boolean getReplaceCouponList() { - return replaceCouponList; - } - - public Boolean getProrate() { - return prorate; - } - - public Boolean getEndOfTerm() { - return endOfTerm; - } - - public Boolean getForceTermReset() { - return forceTermReset; - } - - public Boolean getReactivate() { - return reactivate; - } - - public String getTokenId() { - return tokenId; - } - - public String getInvoiceNotes() { - return invoiceNotes; - } - - public java.util.Map getMetaData() { - return metaData; - } - - public Boolean getInvoiceImmediately() { - return invoiceImmediately; - } - - public Boolean getOverrideRelationship() { - return overrideRelationship; - } - - public Timestamp getChangesScheduledAt() { - return changesScheduledAt; - } - - public ChangeOption getChangeOption() { - return changeOption; - } - - public Integer getContractTermBillingCycleOnRenewal() { - return contractTermBillingCycleOnRenewal; - } - - public Integer getFreePeriod() { - return freePeriod; - } - - public FreePeriodUnit getFreePeriodUnit() { - return freePeriodUnit; - } - - public Boolean getCreatePendingInvoices() { - return createPendingInvoices; - } - - public Boolean getAutoCloseInvoices() { - return autoCloseInvoices; - } - - public TrialEndAction getTrialEndAction() { - return trialEndAction; - } - - public PaymentInitiator getPaymentInitiator() { - return paymentInitiator; - } - - public Boolean getInvoiceUsages() { - return invoiceUsages; - } - - public CardParams getCard() { - return card; - } - - public PaymentMethodParams getPaymentMethod() { - return paymentMethod; - } - - public PaymentIntentParams getPaymentIntent() { - return paymentIntent; - } - - public BillingAddressParams getBillingAddress() { - return billingAddress; - } - - public ShippingAddressParams getShippingAddress() { - return shippingAddress; - } - - public StatementDescriptorParams getStatementDescriptor() { - return statementDescriptor; - } - - public CustomerParams getCustomer() { - return customer; - } - - public ContractTermParams getContractTerm() { - return contractTerm; - } - - public BillingOverrideParams getBillingOverride() { - return billingOverride; - } - - public List getSubscriptionItems() { - return subscriptionItems; - } - - public List getDiscounts() { - return discounts; - } - - public List getItemTiers() { - return itemTiers; - } - - public List getCoupons() { - return coupons; - } - - public Map customFields() { - return customFields; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.mandatoryItemsToRemove != null) { - - formData.put("mandatory_items_to_remove", this.mandatoryItemsToRemove); - } - - if (this.replaceItemsList != null) { - - formData.put("replace_items_list", this.replaceItemsList); - } - - if (this.setupFee != null) { - - formData.put("setup_fee", this.setupFee); - } - - if (this.netTermDays != null) { - - formData.put("net_term_days", this.netTermDays); - } - - if (this.invoiceDate != null) { - - formData.put("invoice_date", this.invoiceDate); - } - - if (this.startDate != null) { - - formData.put("start_date", this.startDate); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.coupon != null) { - - formData.put("coupon", this.coupon); - } - - if (this.termsToCharge != null) { - - formData.put("terms_to_charge", this.termsToCharge); - } - - if (this.reactivateFrom != null) { - - formData.put("reactivate_from", this.reactivateFrom); - } - - if (this.billingAlignmentMode != null) { - - formData.put("billing_alignment_mode", this.billingAlignmentMode); - } - - if (this.autoCollection != null) { - - formData.put("auto_collection", this.autoCollection); - } - - if (this.offlinePaymentMethod != null) { - - formData.put("offline_payment_method", this.offlinePaymentMethod); - } - - if (this.poNumber != null) { - - formData.put("po_number", this.poNumber); - } - - if (this.couponIds != null) { - - formData.put("coupon_ids", this.couponIds); - } - - if (this.replaceCouponList != null) { - - formData.put("replace_coupon_list", this.replaceCouponList); - } - - if (this.prorate != null) { - - formData.put("prorate", this.prorate); - } - - if (this.endOfTerm != null) { - - formData.put("end_of_term", this.endOfTerm); - } - - if (this.forceTermReset != null) { - - formData.put("force_term_reset", this.forceTermReset); - } - - if (this.reactivate != null) { - - formData.put("reactivate", this.reactivate); - } - - if (this.tokenId != null) { - - formData.put("token_id", this.tokenId); - } - - if (this.invoiceNotes != null) { - - formData.put("invoice_notes", this.invoiceNotes); - } - - if (this.metaData != null) { - - formData.put("meta_data", JsonUtil.toJson(this.metaData)); - } - - if (this.invoiceImmediately != null) { - - formData.put("invoice_immediately", this.invoiceImmediately); - } - - if (this.overrideRelationship != null) { - - formData.put("override_relationship", this.overrideRelationship); - } - - if (this.changesScheduledAt != null) { - - formData.put("changes_scheduled_at", this.changesScheduledAt); - } - - if (this.changeOption != null) { - - formData.put("change_option", this.changeOption); - } - - if (this.contractTermBillingCycleOnRenewal != null) { - - formData.put( - "contract_term_billing_cycle_on_renewal", this.contractTermBillingCycleOnRenewal); - } - - if (this.freePeriod != null) { - - formData.put("free_period", this.freePeriod); - } - - if (this.freePeriodUnit != null) { - - formData.put("free_period_unit", this.freePeriodUnit); - } - - if (this.createPendingInvoices != null) { - - formData.put("create_pending_invoices", this.createPendingInvoices); - } - - if (this.autoCloseInvoices != null) { - - formData.put("auto_close_invoices", this.autoCloseInvoices); - } - - if (this.trialEndAction != null) { - - formData.put("trial_end_action", this.trialEndAction); - } - - if (this.paymentInitiator != null) { - - formData.put("payment_initiator", this.paymentInitiator); - } - - if (this.invoiceUsages != null) { - - formData.put("invoice_usages", this.invoiceUsages); - } - - if (this.card != null) { - - // Single object - Map nestedData = this.card.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "card[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.paymentMethod != null) { - - // Single object - Map nestedData = this.paymentMethod.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "payment_method[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.paymentIntent != null) { - - // Single object - Map nestedData = this.paymentIntent.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "payment_intent[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.billingAddress != null) { - - // Single object - Map nestedData = this.billingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.shippingAddress != null) { - - // Single object - Map nestedData = this.shippingAddress.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "shipping_address[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.statementDescriptor != null) { - - // Single object - Map nestedData = this.statementDescriptor.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "statement_descriptor[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.customer != null) { - - // Single object - Map nestedData = this.customer.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "customer[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.contractTerm != null) { - - // Single object - Map nestedData = this.contractTerm.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "contract_term[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.billingOverride != null) { - - // Single object - Map nestedData = this.billingOverride.toFormData(); - for (Map.Entry entry : nestedData.entrySet()) { - String nestedKey = "billing_override[" + entry.getKey() + "]"; - formData.put(nestedKey, entry.getValue()); - } - } - - if (this.subscriptionItems != null) { - - // List of objects - for (int i = 0; i < this.subscriptionItems.size(); i++) { - SubscriptionItemsParams item = this.subscriptionItems.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "subscription_items[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.discounts != null) { - - // List of objects - for (int i = 0; i < this.discounts.size(); i++) { - DiscountsParams item = this.discounts.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "discounts[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.itemTiers != null) { - - // List of objects - for (int i = 0; i < this.itemTiers.size(); i++) { - ItemTiersParams item = this.itemTiers.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "item_tiers[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - if (this.coupons != null) { - - // List of objects - for (int i = 0; i < this.coupons.size(); i++) { - CouponsParams item = this.coupons.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "coupons[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - formData.putAll(customFields); - - return formData; - } - - /** Create a new builder for UpdateForItemsForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UpdateForItemsForSubscriptionBuilder builder() { - return new UpdateForItemsForSubscriptionBuilder(); - } - - public static final class UpdateForItemsForSubscriptionBuilder { - - private List mandatoryItemsToRemove; - - private Boolean replaceItemsList; - - private Long setupFee; - - private Integer netTermDays; - - private Timestamp invoiceDate; - - private Timestamp startDate; - - private Timestamp trialEnd; - - private Integer billingCycles; - - private String coupon; - - private Integer termsToCharge; - - private Timestamp reactivateFrom; - - private BillingAlignmentMode billingAlignmentMode; - - private AutoCollection autoCollection; - - private OfflinePaymentMethod offlinePaymentMethod; - - private String poNumber; - - private List couponIds; - - private Boolean replaceCouponList; - - private Boolean prorate; - - private Boolean endOfTerm; - - private Boolean forceTermReset; - - private Boolean reactivate; - - private String tokenId; - - private String invoiceNotes; - - private java.util.Map metaData; - - private Boolean invoiceImmediately; - - private Boolean overrideRelationship; - - private Timestamp changesScheduledAt; - - private ChangeOption changeOption; - - private Integer contractTermBillingCycleOnRenewal; - - private Integer freePeriod; - - private FreePeriodUnit freePeriodUnit; - - private Boolean createPendingInvoices; - - private Boolean autoCloseInvoices; - - private TrialEndAction trialEndAction; - - private PaymentInitiator paymentInitiator; - - private Boolean invoiceUsages; - - private CardParams card; - - private PaymentMethodParams paymentMethod; - - private PaymentIntentParams paymentIntent; - - private BillingAddressParams billingAddress; - - private ShippingAddressParams shippingAddress; - - private StatementDescriptorParams statementDescriptor; - - private CustomerParams customer; - - private ContractTermParams contractTerm; - - private BillingOverrideParams billingOverride; - - private List subscriptionItems; - - private List discounts; - - private List itemTiers; - - private List coupons; - - private Map customFields = new LinkedHashMap<>(); - - private UpdateForItemsForSubscriptionBuilder() {} - - public UpdateForItemsForSubscriptionBuilder mandatoryItemsToRemove(List value) { - this.mandatoryItemsToRemove = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder replaceItemsList(Boolean value) { - this.replaceItemsList = value; - return this; - } - - @Deprecated - public UpdateForItemsForSubscriptionBuilder setupFee(Long value) { - this.setupFee = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder netTermDays(Integer value) { - this.netTermDays = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder invoiceDate(Timestamp value) { - this.invoiceDate = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder startDate(Timestamp value) { - this.startDate = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - @Deprecated - public UpdateForItemsForSubscriptionBuilder coupon(String value) { - this.coupon = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder termsToCharge(Integer value) { - this.termsToCharge = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder reactivateFrom(Timestamp value) { - this.reactivateFrom = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder billingAlignmentMode(BillingAlignmentMode value) { - this.billingAlignmentMode = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder autoCollection(AutoCollection value) { - this.autoCollection = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder offlinePaymentMethod(OfflinePaymentMethod value) { - this.offlinePaymentMethod = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder poNumber(String value) { - this.poNumber = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder couponIds(List value) { - this.couponIds = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder replaceCouponList(Boolean value) { - this.replaceCouponList = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder prorate(Boolean value) { - this.prorate = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder endOfTerm(Boolean value) { - this.endOfTerm = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder forceTermReset(Boolean value) { - this.forceTermReset = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder reactivate(Boolean value) { - this.reactivate = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder tokenId(String value) { - this.tokenId = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder invoiceNotes(String value) { - this.invoiceNotes = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder metaData(java.util.Map value) { - this.metaData = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder invoiceImmediately(Boolean value) { - this.invoiceImmediately = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder overrideRelationship(Boolean value) { - this.overrideRelationship = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder changesScheduledAt(Timestamp value) { - this.changesScheduledAt = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder changeOption(ChangeOption value) { - this.changeOption = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder contractTermBillingCycleOnRenewal(Integer value) { - this.contractTermBillingCycleOnRenewal = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder freePeriod(Integer value) { - this.freePeriod = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder freePeriodUnit(FreePeriodUnit value) { - this.freePeriodUnit = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder createPendingInvoices(Boolean value) { - this.createPendingInvoices = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder autoCloseInvoices(Boolean value) { - this.autoCloseInvoices = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder trialEndAction(TrialEndAction value) { - this.trialEndAction = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder paymentInitiator(PaymentInitiator value) { - this.paymentInitiator = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder invoiceUsages(Boolean value) { - this.invoiceUsages = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder card(CardParams value) { - this.card = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder paymentMethod(PaymentMethodParams value) { - this.paymentMethod = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder paymentIntent(PaymentIntentParams value) { - this.paymentIntent = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder billingAddress(BillingAddressParams value) { - this.billingAddress = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder shippingAddress(ShippingAddressParams value) { - this.shippingAddress = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder statementDescriptor( - StatementDescriptorParams value) { - this.statementDescriptor = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder customer(CustomerParams value) { - this.customer = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder contractTerm(ContractTermParams value) { - this.contractTerm = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder billingOverride(BillingOverrideParams value) { - this.billingOverride = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder subscriptionItems( - List value) { - this.subscriptionItems = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder discounts(List value) { - this.discounts = value; - return this; - } - - public UpdateForItemsForSubscriptionBuilder itemTiers(List value) { - this.itemTiers = value; - return this; - } - - @Deprecated - public UpdateForItemsForSubscriptionBuilder coupons(List value) { - this.coupons = value; - return this; - } - - /** - * Add a custom field to the request. Custom fields must start with "cf_". - * - * @param fieldName the name of the custom field (e.g., "cf_custom_field_name") - * @param value the value of the custom field - * @return this builder - * @throws IllegalArgumentException if fieldName doesn't start with "cf_" - */ - public UpdateForItemsForSubscriptionBuilder customField(String fieldName, String value) { - if (fieldName == null || !fieldName.startsWith("cf_")) { - throw new IllegalArgumentException("Custom field name must start with 'cf_'"); - } - this.customFields.put(fieldName, value); - return this; - } - - /** - * Add multiple custom fields to the request. All field names must start with "cf_". - * - * @param customFields map of custom field names to values - * @return this builder - * @throws IllegalArgumentException if any field name doesn't start with "cf_" - */ - public UpdateForItemsForSubscriptionBuilder customFields(Map customFields) { - if (customFields != null) { - for (Map.Entry entry : customFields.entrySet()) { - if (entry.getKey() == null || !entry.getKey().startsWith("cf_")) { - throw new IllegalArgumentException( - "Custom field name must start with 'cf_': " + entry.getKey()); - } - this.customFields.put(entry.getKey(), entry.getValue()); - } - } - return this; - } - - public UpdateForItemsForSubscriptionParams build() { - return new UpdateForItemsForSubscriptionParams(this); - } - } - - public enum BillingAlignmentMode { - IMMEDIATE("immediate"), - - DELAYED("delayed"), - - /** - * An enum member indicating that BillingAlignmentMode was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - BillingAlignmentMode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static BillingAlignmentMode fromString(String value) { - if (value == null) return _UNKNOWN; - for (BillingAlignmentMode enumValue : BillingAlignmentMode.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum AutoCollection { - ON("on"), - - OFF("off"), - - /** An enum member indicating that AutoCollection was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - AutoCollection(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static AutoCollection fromString(String value) { - if (value == null) return _UNKNOWN; - for (AutoCollection enumValue : AutoCollection.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum OfflinePaymentMethod { - NO_PREFERENCE("no_preference"), - - CASH("cash"), - - CHECK("check"), - - BANK_TRANSFER("bank_transfer"), - - ACH_CREDIT("ach_credit"), - - SEPA_CREDIT("sepa_credit"), - - BOLETO("boleto"), - - US_AUTOMATED_BANK_TRANSFER("us_automated_bank_transfer"), - - EU_AUTOMATED_BANK_TRANSFER("eu_automated_bank_transfer"), - - UK_AUTOMATED_BANK_TRANSFER("uk_automated_bank_transfer"), - - JP_AUTOMATED_BANK_TRANSFER("jp_automated_bank_transfer"), - - MX_AUTOMATED_BANK_TRANSFER("mx_automated_bank_transfer"), - - CUSTOM("custom"), - - /** - * An enum member indicating that OfflinePaymentMethod was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - OfflinePaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OfflinePaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (OfflinePaymentMethod enumValue : OfflinePaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChangeOption { - IMMEDIATELY("immediately"), - - END_OF_TERM("end_of_term"), - - SPECIFIC_DATE("specific_date"), - - /** An enum member indicating that ChangeOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChangeOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChangeOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChangeOption enumValue : ChangeOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum FreePeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that FreePeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - FreePeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static FreePeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (FreePeriodUnit enumValue : FreePeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum TrialEndAction { - SITE_DEFAULT("site_default"), - - PLAN_DEFAULT("plan_default"), - - ACTIVATE_SUBSCRIPTION("activate_subscription"), - - CANCEL_SUBSCRIPTION("cancel_subscription"), - - /** An enum member indicating that TrialEndAction was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - TrialEndAction(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static TrialEndAction fromString(String value) { - if (value == null) return _UNKNOWN; - for (TrialEndAction enumValue : TrialEndAction.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PaymentInitiator { - CUSTOMER("customer"), - - MERCHANT("merchant"), - - /** An enum member indicating that PaymentInitiator was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentInitiator(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentInitiator fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentInitiator enumValue : PaymentInitiator.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class CardParams { - - private final Gateway gateway; - - private final String gatewayAccountId; - - private final String tmpToken; - - private final String firstName; - - private final String lastName; - - private final String number; - - private final Integer expiryMonth; - - private final Integer expiryYear; - - private final String cvv; - - private final PreferredScheme preferredScheme; - - private final String billingAddr1; - - private final String billingAddr2; - - private final String billingCity; - - private final String billingStateCode; - - private final String billingState; - - private final String billingZip; - - private final String billingCountry; - - private final String ipAddress; - - private final java.util.Map additionalInformation; - - private CardParams(CardBuilder builder) { - - this.gateway = builder.gateway; - - this.gatewayAccountId = builder.gatewayAccountId; - - this.tmpToken = builder.tmpToken; - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.number = builder.number; - - this.expiryMonth = builder.expiryMonth; - - this.expiryYear = builder.expiryYear; - - this.cvv = builder.cvv; - - this.preferredScheme = builder.preferredScheme; - - this.billingAddr1 = builder.billingAddr1; - - this.billingAddr2 = builder.billingAddr2; - - this.billingCity = builder.billingCity; - - this.billingStateCode = builder.billingStateCode; - - this.billingState = builder.billingState; - - this.billingZip = builder.billingZip; - - this.billingCountry = builder.billingCountry; - - this.ipAddress = builder.ipAddress; - - this.additionalInformation = builder.additionalInformation; - } - - public Gateway getGateway() { - return gateway; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getTmpToken() { - return tmpToken; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getNumber() { - return number; - } - - public Integer getExpiryMonth() { - return expiryMonth; - } - - public Integer getExpiryYear() { - return expiryYear; - } - - public String getCvv() { - return cvv; - } - - public PreferredScheme getPreferredScheme() { - return preferredScheme; - } - - public String getBillingAddr1() { - return billingAddr1; - } - - public String getBillingAddr2() { - return billingAddr2; - } - - public String getBillingCity() { - return billingCity; - } - - public String getBillingStateCode() { - return billingStateCode; - } - - public String getBillingState() { - return billingState; - } - - public String getBillingZip() { - return billingZip; - } - - public String getBillingCountry() { - return billingCountry; - } - - public String getIpAddress() { - return ipAddress; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.gateway != null) { - - formData.put("gateway", this.gateway); - } - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.tmpToken != null) { - - formData.put("tmp_token", this.tmpToken); - } - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.number != null) { - - formData.put("number", this.number); - } - - if (this.expiryMonth != null) { - - formData.put("expiry_month", this.expiryMonth); - } - - if (this.expiryYear != null) { - - formData.put("expiry_year", this.expiryYear); - } - - if (this.cvv != null) { - - formData.put("cvv", this.cvv); - } - - if (this.preferredScheme != null) { - - formData.put("preferred_scheme", this.preferredScheme); - } - - if (this.billingAddr1 != null) { - - formData.put("billing_addr1", this.billingAddr1); - } - - if (this.billingAddr2 != null) { - - formData.put("billing_addr2", this.billingAddr2); - } - - if (this.billingCity != null) { - - formData.put("billing_city", this.billingCity); - } - - if (this.billingStateCode != null) { - - formData.put("billing_state_code", this.billingStateCode); - } - - if (this.billingState != null) { - - formData.put("billing_state", this.billingState); - } - - if (this.billingZip != null) { - - formData.put("billing_zip", this.billingZip); - } - - if (this.billingCountry != null) { - - formData.put("billing_country", this.billingCountry); - } - - if (this.ipAddress != null) { - - formData.put("ip_address", this.ipAddress); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for CardParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CardBuilder builder() { - return new CardBuilder(); - } - - public static final class CardBuilder { - - private Gateway gateway; - - private String gatewayAccountId; - - private String tmpToken; - - private String firstName; - - private String lastName; - - private String number; - - private Integer expiryMonth; - - private Integer expiryYear; - - private String cvv; - - private PreferredScheme preferredScheme; - - private String billingAddr1; - - private String billingAddr2; - - private String billingCity; - - private String billingStateCode; - - private String billingState; - - private String billingZip; - - private String billingCountry; - - private String ipAddress; - - private java.util.Map additionalInformation; - - private CardBuilder() {} - - @Deprecated - public CardBuilder gateway(Gateway value) { - this.gateway = value; - return this; - } - - public CardBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - @Deprecated - public CardBuilder tmpToken(String value) { - this.tmpToken = value; - return this; - } - - public CardBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public CardBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public CardBuilder number(String value) { - this.number = value; - return this; - } - - public CardBuilder expiryMonth(Integer value) { - this.expiryMonth = value; - return this; - } - - public CardBuilder expiryYear(Integer value) { - this.expiryYear = value; - return this; - } - - public CardBuilder cvv(String value) { - this.cvv = value; - return this; - } - - public CardBuilder preferredScheme(PreferredScheme value) { - this.preferredScheme = value; - return this; - } - - public CardBuilder billingAddr1(String value) { - this.billingAddr1 = value; - return this; - } - - public CardBuilder billingAddr2(String value) { - this.billingAddr2 = value; - return this; - } - - public CardBuilder billingCity(String value) { - this.billingCity = value; - return this; - } - - public CardBuilder billingStateCode(String value) { - this.billingStateCode = value; - return this; - } - - public CardBuilder billingState(String value) { - this.billingState = value; - return this; - } - - public CardBuilder billingZip(String value) { - this.billingZip = value; - return this; - } - - public CardBuilder billingCountry(String value) { - this.billingCountry = value; - return this; - } - - @Deprecated - public CardBuilder ipAddress(String value) { - this.ipAddress = value; - return this; - } - - public CardBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public CardParams build() { - return new CardParams(this); - } - } - - public enum Gateway { - CHARGEBEE("chargebee"), - - CHARGEBEE_PAYMENTS("chargebee_payments"), - - ADYEN("adyen"), - - STRIPE("stripe"), - - WEPAY("wepay"), - - BRAINTREE("braintree"), - - AUTHORIZE_NET("authorize_net"), - - PAYPAL_PRO("paypal_pro"), - - PIN("pin"), - - EWAY("eway"), - - EWAY_RAPID("eway_rapid"), - - WORLDPAY("worldpay"), - - BALANCED_PAYMENTS("balanced_payments"), - - BEANSTREAM("beanstream"), - - BLUEPAY("bluepay"), - - ELAVON("elavon"), - - FIRST_DATA_GLOBAL("first_data_global"), - - HDFC("hdfc"), - - MIGS("migs"), - - NMI("nmi"), - - OGONE("ogone"), - - PAYMILL("paymill"), - - PAYPAL_PAYFLOW_PRO("paypal_payflow_pro"), - - SAGE_PAY("sage_pay"), - - TCO("tco"), - - WIRECARD("wirecard"), - - AMAZON_PAYMENTS("amazon_payments"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - ORBITAL("orbital"), - - MONERIS_US("moneris_us"), - - MONERIS("moneris"), - - BLUESNAP("bluesnap"), - - CYBERSOURCE("cybersource"), - - VANTIV("vantiv"), - - CHECKOUT_COM("checkout_com"), - - PAYPAL("paypal"), - - INGENICO_DIRECT("ingenico_direct"), - - EXACT("exact"), - - MOLLIE("mollie"), - - QUICKBOOKS("quickbooks"), - - RAZORPAY("razorpay"), - - GLOBAL_PAYMENTS("global_payments"), - - BANK_OF_AMERICA("bank_of_america"), - - ECENTRIC("ecentric"), - - METRICS_GLOBAL("metrics_global"), - - WINDCAVE("windcave"), - - PAY_COM("pay_com"), - - EBANX("ebanx"), - - DLOCAL("dlocal"), - - NUVEI("nuvei"), - - SOLIDGATE("solidgate"), - - PAYSTACK("paystack"), - - JP_MORGAN("jp_morgan"), - - DEUTSCHE_BANK("deutsche_bank"), - - EZIDEBIT("ezidebit"), - - /** An enum member indicating that Gateway was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Gateway(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Gateway fromString(String value) { - if (value == null) return _UNKNOWN; - for (Gateway enumValue : Gateway.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PreferredScheme { - CARTES_BANCAIRES("cartes_bancaires"), - - MASTERCARD("mastercard"), - - VISA("visa"), - - /** An enum member indicating that PreferredScheme was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PreferredScheme(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PreferredScheme fromString(String value) { - if (value == null) return _UNKNOWN; - for (PreferredScheme enumValue : PreferredScheme.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class PaymentMethodParams { - - private final Type type; - - private final Gateway gateway; - - private final String gatewayAccountId; - - private final String referenceId; - - private final String tmpToken; - - private final String issuingCountry; - - private final java.util.Map additionalInformation; - - private PaymentMethodParams(PaymentMethodBuilder builder) { - - this.type = builder.type; - - this.gateway = builder.gateway; - - this.gatewayAccountId = builder.gatewayAccountId; - - this.referenceId = builder.referenceId; - - this.tmpToken = builder.tmpToken; - - this.issuingCountry = builder.issuingCountry; - - this.additionalInformation = builder.additionalInformation; - } - - public Type getType() { - return type; - } - - public Gateway getGateway() { - return gateway; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getReferenceId() { - return referenceId; - } - - public String getTmpToken() { - return tmpToken; - } - - public String getIssuingCountry() { - return issuingCountry; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.type != null) { - - formData.put("type", this.type); - } - - if (this.gateway != null) { - - formData.put("gateway", this.gateway); - } - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.referenceId != null) { - - formData.put("reference_id", this.referenceId); - } - - if (this.tmpToken != null) { - - formData.put("tmp_token", this.tmpToken); - } - - if (this.issuingCountry != null) { - - formData.put("issuing_country", this.issuingCountry); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for PaymentMethodParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PaymentMethodBuilder builder() { - return new PaymentMethodBuilder(); - } - - public static final class PaymentMethodBuilder { - - private Type type; - - private Gateway gateway; - - private String gatewayAccountId; - - private String referenceId; - - private String tmpToken; - - private String issuingCountry; - - private java.util.Map additionalInformation; - - private PaymentMethodBuilder() {} - - public PaymentMethodBuilder type(Type value) { - this.type = value; - return this; - } - - @Deprecated - public PaymentMethodBuilder gateway(Gateway value) { - this.gateway = value; - return this; - } - - public PaymentMethodBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public PaymentMethodBuilder referenceId(String value) { - this.referenceId = value; - return this; - } - - public PaymentMethodBuilder tmpToken(String value) { - this.tmpToken = value; - return this; - } - - public PaymentMethodBuilder issuingCountry(String value) { - this.issuingCountry = value; - return this; - } - - public PaymentMethodBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public PaymentMethodParams build() { - return new PaymentMethodParams(this); - } - } - - public enum Type { - CARD("card"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - AMAZON_PAYMENTS("amazon_payments"), - - DIRECT_DEBIT("direct_debit"), - - GENERIC("generic"), - - ALIPAY("alipay"), - - UNIONPAY("unionpay"), - - APPLE_PAY("apple_pay"), - - WECHAT_PAY("wechat_pay"), - - IDEAL("ideal"), - - GOOGLE_PAY("google_pay"), - - SOFORT("sofort"), - - BANCONTACT("bancontact"), - - GIROPAY("giropay"), - - DOTPAY("dotpay"), - - UPI("upi"), - - NETBANKING_EMANDATES("netbanking_emandates"), - - VENMO("venmo"), - - PAY_TO("pay_to"), - - FASTER_PAYMENTS("faster_payments"), - - SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), - - AUTOMATED_BANK_TRANSFER("automated_bank_transfer"), - - KLARNA_PAY_NOW("klarna_pay_now"), - - ONLINE_BANKING_POLAND("online_banking_poland"), - - PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), - - ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), - - KBC_PAYMENT_BUTTON("kbc_payment_button"), - - PAY_BY_BANK("pay_by_bank"), - - TRUSTLY("trustly"), - - STABLECOIN("stablecoin"), - - /** An enum member indicating that Type was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Type(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Type fromString(String value) { - if (value == null) return _UNKNOWN; - for (Type enumValue : Type.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum Gateway { - CHARGEBEE_PAYMENTS("chargebee_payments"), - - ADYEN("adyen"), - - STRIPE("stripe"), - - WEPAY("wepay"), - - BRAINTREE("braintree"), - - AUTHORIZE_NET("authorize_net"), - - PAYPAL_PRO("paypal_pro"), - - PIN("pin"), - - EWAY("eway"), - - EWAY_RAPID("eway_rapid"), - - WORLDPAY("worldpay"), - - BALANCED_PAYMENTS("balanced_payments"), - - BEANSTREAM("beanstream"), - - BLUEPAY("bluepay"), - - ELAVON("elavon"), - - FIRST_DATA_GLOBAL("first_data_global"), - - HDFC("hdfc"), - - MIGS("migs"), - - NMI("nmi"), - - OGONE("ogone"), - - PAYMILL("paymill"), - - PAYPAL_PAYFLOW_PRO("paypal_payflow_pro"), - - SAGE_PAY("sage_pay"), - - TCO("tco"), - - WIRECARD("wirecard"), - - AMAZON_PAYMENTS("amazon_payments"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - GOCARDLESS("gocardless"), - - ORBITAL("orbital"), - - MONERIS_US("moneris_us"), - - MONERIS("moneris"), - - BLUESNAP("bluesnap"), - - CYBERSOURCE("cybersource"), - - VANTIV("vantiv"), - - CHECKOUT_COM("checkout_com"), - - PAYPAL("paypal"), - - INGENICO_DIRECT("ingenico_direct"), - - EXACT("exact"), - - MOLLIE("mollie"), - - QUICKBOOKS("quickbooks"), - - RAZORPAY("razorpay"), - - GLOBAL_PAYMENTS("global_payments"), - - BANK_OF_AMERICA("bank_of_america"), - - ECENTRIC("ecentric"), - - METRICS_GLOBAL("metrics_global"), - - WINDCAVE("windcave"), - - PAY_COM("pay_com"), - - EBANX("ebanx"), - - DLOCAL("dlocal"), - - NUVEI("nuvei"), - - SOLIDGATE("solidgate"), - - PAYSTACK("paystack"), - - JP_MORGAN("jp_morgan"), - - DEUTSCHE_BANK("deutsche_bank"), - - EZIDEBIT("ezidebit"), - - /** An enum member indicating that Gateway was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Gateway(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Gateway fromString(String value) { - if (value == null) return _UNKNOWN; - for (Gateway enumValue : Gateway.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class PaymentIntentParams { - - private final String id; - - private final String gatewayAccountId; - - private final String gwToken; - - private final PaymentMethodType paymentMethodType; - - private final String referenceId; - - private final String gwPaymentMethodId; - - private final java.util.Map additionalInformation; - - private PaymentIntentParams(PaymentIntentBuilder builder) { - - this.id = builder.id; - - this.gatewayAccountId = builder.gatewayAccountId; - - this.gwToken = builder.gwToken; - - this.paymentMethodType = builder.paymentMethodType; - - this.referenceId = builder.referenceId; - - this.gwPaymentMethodId = builder.gwPaymentMethodId; - - this.additionalInformation = builder.additionalInformation; - } - - public String getId() { - return id; - } - - public String getGatewayAccountId() { - return gatewayAccountId; - } - - public String getGwToken() { - return gwToken; - } - - public PaymentMethodType getPaymentMethodType() { - return paymentMethodType; - } - - public String getReferenceId() { - return referenceId; - } - - public String getGwPaymentMethodId() { - return gwPaymentMethodId; - } - - public java.util.Map getAdditionalInformation() { - return additionalInformation; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.gatewayAccountId != null) { - - formData.put("gateway_account_id", this.gatewayAccountId); - } - - if (this.gwToken != null) { - - formData.put("gw_token", this.gwToken); - } - - if (this.paymentMethodType != null) { - - formData.put("payment_method_type", this.paymentMethodType); - } - - if (this.referenceId != null) { - - formData.put("reference_id", this.referenceId); - } - - if (this.gwPaymentMethodId != null) { - - formData.put("gw_payment_method_id", this.gwPaymentMethodId); - } - - if (this.additionalInformation != null) { - - formData.put("additional_information", JsonUtil.toJson(this.additionalInformation)); - } - - return formData; - } - - /** Create a new builder for PaymentIntentParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static PaymentIntentBuilder builder() { - return new PaymentIntentBuilder(); - } - - public static final class PaymentIntentBuilder { - - private String id; - - private String gatewayAccountId; - - private String gwToken; - - private PaymentMethodType paymentMethodType; - - private String referenceId; - - private String gwPaymentMethodId; - - private java.util.Map additionalInformation; - - private PaymentIntentBuilder() {} - - public PaymentIntentBuilder id(String value) { - this.id = value; - return this; - } - - public PaymentIntentBuilder gatewayAccountId(String value) { - this.gatewayAccountId = value; - return this; - } - - public PaymentIntentBuilder gwToken(String value) { - this.gwToken = value; - return this; - } - - public PaymentIntentBuilder paymentMethodType(PaymentMethodType value) { - this.paymentMethodType = value; - return this; - } - - public PaymentIntentBuilder referenceId(String value) { - this.referenceId = value; - return this; - } - - @Deprecated - public PaymentIntentBuilder gwPaymentMethodId(String value) { - this.gwPaymentMethodId = value; - return this; - } - - public PaymentIntentBuilder additionalInformation(java.util.Map value) { - this.additionalInformation = value; - return this; - } - - public PaymentIntentParams build() { - return new PaymentIntentParams(this); - } - } - - public enum PaymentMethodType { - CARD("card"), - - IDEAL("ideal"), - - SOFORT("sofort"), - - BANCONTACT("bancontact"), - - GOOGLE_PAY("google_pay"), - - DOTPAY("dotpay"), - - GIROPAY("giropay"), - - APPLE_PAY("apple_pay"), - - UPI("upi"), - - NETBANKING_EMANDATES("netbanking_emandates"), - - PAYPAL_EXPRESS_CHECKOUT("paypal_express_checkout"), - - DIRECT_DEBIT("direct_debit"), - - BOLETO("boleto"), - - VENMO("venmo"), - - AMAZON_PAYMENTS("amazon_payments"), - - PAY_TO("pay_to"), - - FASTER_PAYMENTS("faster_payments"), - - SEPA_INSTANT_TRANSFER("sepa_instant_transfer"), - - KLARNA_PAY_NOW("klarna_pay_now"), - - ONLINE_BANKING_POLAND("online_banking_poland"), - - PAYCONIQ_BY_BANCONTACT("payconiq_by_bancontact"), - - ELECTRONIC_PAYMENT_STANDARD("electronic_payment_standard"), - - KBC_PAYMENT_BUTTON("kbc_payment_button"), - - PAY_BY_BANK("pay_by_bank"), - - TRUSTLY("trustly"), - - STABLECOIN("stablecoin"), - - /** - * An enum member indicating that PaymentMethodType was instantiated with an unknown value. - */ - _UNKNOWN(null); - private final String value; - - PaymentMethodType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethodType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethodType enumValue : PaymentMethodType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class BillingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private BillingAddressParams(BillingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for BillingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingAddressBuilder builder() { - return new BillingAddressBuilder(); - } - - public static final class BillingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private BillingAddressBuilder() {} - - public BillingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public BillingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public BillingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public BillingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public BillingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public BillingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public BillingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public BillingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public BillingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public BillingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public BillingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public BillingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public BillingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public BillingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public BillingAddressParams build() { - return new BillingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ShippingAddressParams { - - private final String firstName; - - private final String lastName; - - private final String email; - - private final String company; - - private final String phone; - - private final String line1; - - private final String line2; - - private final String line3; - - private final String city; - - private final String stateCode; - - private final String state; - - private final String zip; - - private final String country; - - private final ValidationStatus validationStatus; - - private ShippingAddressParams(ShippingAddressBuilder builder) { - - this.firstName = builder.firstName; - - this.lastName = builder.lastName; - - this.email = builder.email; - - this.company = builder.company; - - this.phone = builder.phone; - - this.line1 = builder.line1; - - this.line2 = builder.line2; - - this.line3 = builder.line3; - - this.city = builder.city; - - this.stateCode = builder.stateCode; - - this.state = builder.state; - - this.zip = builder.zip; - - this.country = builder.country; - - this.validationStatus = builder.validationStatus; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public String getCompany() { - return company; - } - - public String getPhone() { - return phone; - } - - public String getLine1() { - return line1; - } - - public String getLine2() { - return line2; - } - - public String getLine3() { - return line3; - } - - public String getCity() { - return city; - } - - public String getStateCode() { - return stateCode; - } - - public String getState() { - return state; - } - - public String getZip() { - return zip; - } - - public String getCountry() { - return country; - } - - public ValidationStatus getValidationStatus() { - return validationStatus; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.firstName != null) { - - formData.put("first_name", this.firstName); - } - - if (this.lastName != null) { - - formData.put("last_name", this.lastName); - } - - if (this.email != null) { - - formData.put("email", this.email); - } - - if (this.company != null) { - - formData.put("company", this.company); - } - - if (this.phone != null) { - - formData.put("phone", this.phone); - } - - if (this.line1 != null) { - - formData.put("line1", this.line1); - } - - if (this.line2 != null) { - - formData.put("line2", this.line2); - } - - if (this.line3 != null) { - - formData.put("line3", this.line3); - } - - if (this.city != null) { - - formData.put("city", this.city); - } - - if (this.stateCode != null) { - - formData.put("state_code", this.stateCode); - } - - if (this.state != null) { - - formData.put("state", this.state); - } - - if (this.zip != null) { - - formData.put("zip", this.zip); - } - - if (this.country != null) { - - formData.put("country", this.country); - } - - if (this.validationStatus != null) { - - formData.put("validation_status", this.validationStatus); - } - - return formData; - } - - /** Create a new builder for ShippingAddressParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ShippingAddressBuilder builder() { - return new ShippingAddressBuilder(); - } - - public static final class ShippingAddressBuilder { - - private String firstName; - - private String lastName; - - private String email; - - private String company; - - private String phone; - - private String line1; - - private String line2; - - private String line3; - - private String city; - - private String stateCode; - - private String state; - - private String zip; - - private String country; - - private ValidationStatus validationStatus; - - private ShippingAddressBuilder() {} - - public ShippingAddressBuilder firstName(String value) { - this.firstName = value; - return this; - } - - public ShippingAddressBuilder lastName(String value) { - this.lastName = value; - return this; - } - - public ShippingAddressBuilder email(String value) { - this.email = value; - return this; - } - - public ShippingAddressBuilder company(String value) { - this.company = value; - return this; - } - - public ShippingAddressBuilder phone(String value) { - this.phone = value; - return this; - } - - public ShippingAddressBuilder line1(String value) { - this.line1 = value; - return this; - } - - public ShippingAddressBuilder line2(String value) { - this.line2 = value; - return this; - } - - public ShippingAddressBuilder line3(String value) { - this.line3 = value; - return this; - } - - public ShippingAddressBuilder city(String value) { - this.city = value; - return this; - } - - public ShippingAddressBuilder stateCode(String value) { - this.stateCode = value; - return this; - } - - public ShippingAddressBuilder state(String value) { - this.state = value; - return this; - } - - public ShippingAddressBuilder zip(String value) { - this.zip = value; - return this; - } - - public ShippingAddressBuilder country(String value) { - this.country = value; - return this; - } - - public ShippingAddressBuilder validationStatus(ValidationStatus value) { - this.validationStatus = value; - return this; - } - - public ShippingAddressParams build() { - return new ShippingAddressParams(this); - } - } - - public enum ValidationStatus { - NOT_VALIDATED("not_validated"), - - VALID("valid"), - - PARTIALLY_VALID("partially_valid"), - - INVALID("invalid"), - - /** An enum member indicating that ValidationStatus was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ValidationStatus(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ValidationStatus fromString(String value) { - if (value == null) return _UNKNOWN; - for (ValidationStatus enumValue : ValidationStatus.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class StatementDescriptorParams { - - private final String descriptor; - - private StatementDescriptorParams(StatementDescriptorBuilder builder) { - - this.descriptor = builder.descriptor; - } - - public String getDescriptor() { - return descriptor; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.descriptor != null) { - - formData.put("descriptor", this.descriptor); - } - - return formData; - } - - /** Create a new builder for StatementDescriptorParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static StatementDescriptorBuilder builder() { - return new StatementDescriptorBuilder(); - } - - public static final class StatementDescriptorBuilder { - - private String descriptor; - - private StatementDescriptorBuilder() {} - - public StatementDescriptorBuilder descriptor(String value) { - this.descriptor = value; - return this; - } - - public StatementDescriptorParams build() { - return new StatementDescriptorParams(this); - } - } - } - - public static final class CustomerParams { - - private final String vatNumber; - - private final String vatNumberPrefix; - - private final String entityIdentifierScheme; - - private final Boolean isEinvoiceEnabled; - - private final EinvoicingMethod einvoicingMethod; - - private final String entityIdentifierStandard; - - private final Boolean businessCustomerWithoutVatNumber; - - private final Boolean registeredForGst; - - private CustomerParams(CustomerBuilder builder) { - - this.vatNumber = builder.vatNumber; - - this.vatNumberPrefix = builder.vatNumberPrefix; - - this.entityIdentifierScheme = builder.entityIdentifierScheme; - - this.isEinvoiceEnabled = builder.isEinvoiceEnabled; - - this.einvoicingMethod = builder.einvoicingMethod; - - this.entityIdentifierStandard = builder.entityIdentifierStandard; - - this.businessCustomerWithoutVatNumber = builder.businessCustomerWithoutVatNumber; - - this.registeredForGst = builder.registeredForGst; - } - - public String getVatNumber() { - return vatNumber; - } - - public String getVatNumberPrefix() { - return vatNumberPrefix; - } - - public String getEntityIdentifierScheme() { - return entityIdentifierScheme; - } - - public Boolean getIsEinvoiceEnabled() { - return isEinvoiceEnabled; - } - - public EinvoicingMethod getEinvoicingMethod() { - return einvoicingMethod; - } - - public String getEntityIdentifierStandard() { - return entityIdentifierStandard; - } - - public Boolean getBusinessCustomerWithoutVatNumber() { - return businessCustomerWithoutVatNumber; - } - - public Boolean getRegisteredForGst() { - return registeredForGst; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.vatNumber != null) { - - formData.put("vat_number", this.vatNumber); - } - - if (this.vatNumberPrefix != null) { - - formData.put("vat_number_prefix", this.vatNumberPrefix); - } - - if (this.entityIdentifierScheme != null) { - - formData.put("entity_identifier_scheme", this.entityIdentifierScheme); - } - - if (this.isEinvoiceEnabled != null) { - - formData.put("is_einvoice_enabled", this.isEinvoiceEnabled); - } - - if (this.einvoicingMethod != null) { - - formData.put("einvoicing_method", this.einvoicingMethod); - } - - if (this.entityIdentifierStandard != null) { - - formData.put("entity_identifier_standard", this.entityIdentifierStandard); - } - - if (this.businessCustomerWithoutVatNumber != null) { - - formData.put("business_customer_without_vat_number", this.businessCustomerWithoutVatNumber); - } - - if (this.registeredForGst != null) { - - formData.put("registered_for_gst", this.registeredForGst); - } - - return formData; - } - - /** Create a new builder for CustomerParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CustomerBuilder builder() { - return new CustomerBuilder(); - } - - public static final class CustomerBuilder { - - private String vatNumber; - - private String vatNumberPrefix; - - private String entityIdentifierScheme; - - private Boolean isEinvoiceEnabled; - - private EinvoicingMethod einvoicingMethod; - - private String entityIdentifierStandard; - - private Boolean businessCustomerWithoutVatNumber; - - private Boolean registeredForGst; - - private CustomerBuilder() {} - - public CustomerBuilder vatNumber(String value) { - this.vatNumber = value; - return this; - } - - public CustomerBuilder vatNumberPrefix(String value) { - this.vatNumberPrefix = value; - return this; - } - - public CustomerBuilder entityIdentifierScheme(String value) { - this.entityIdentifierScheme = value; - return this; - } - - public CustomerBuilder isEinvoiceEnabled(Boolean value) { - this.isEinvoiceEnabled = value; - return this; - } - - public CustomerBuilder einvoicingMethod(EinvoicingMethod value) { - this.einvoicingMethod = value; - return this; - } - - public CustomerBuilder entityIdentifierStandard(String value) { - this.entityIdentifierStandard = value; - return this; - } - - public CustomerBuilder businessCustomerWithoutVatNumber(Boolean value) { - this.businessCustomerWithoutVatNumber = value; - return this; - } - - public CustomerBuilder registeredForGst(Boolean value) { - this.registeredForGst = value; - return this; - } - - public CustomerParams build() { - return new CustomerParams(this); - } - } - - public enum EinvoicingMethod { - AUTOMATIC("automatic"), - - MANUAL("manual"), - - SITE_DEFAULT("site_default"), - - /** An enum member indicating that EinvoicingMethod was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - EinvoicingMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static EinvoicingMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (EinvoicingMethod enumValue : EinvoicingMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ContractTermParams { - - private final ActionAtTermEnd actionAtTermEnd; - - private final Integer cancellationCutoffPeriod; - - private final Timestamp contractStart; - - private ContractTermParams(ContractTermBuilder builder) { - - this.actionAtTermEnd = builder.actionAtTermEnd; - - this.cancellationCutoffPeriod = builder.cancellationCutoffPeriod; - - this.contractStart = builder.contractStart; - } - - public ActionAtTermEnd getActionAtTermEnd() { - return actionAtTermEnd; - } - - public Integer getCancellationCutoffPeriod() { - return cancellationCutoffPeriod; - } - - public Timestamp getContractStart() { - return contractStart; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.actionAtTermEnd != null) { - - formData.put("action_at_term_end", this.actionAtTermEnd); - } - - if (this.cancellationCutoffPeriod != null) { - - formData.put("cancellation_cutoff_period", this.cancellationCutoffPeriod); - } - - if (this.contractStart != null) { - - formData.put("contract_start", this.contractStart); - } - - return formData; - } - - /** Create a new builder for ContractTermParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ContractTermBuilder builder() { - return new ContractTermBuilder(); - } - - public static final class ContractTermBuilder { - - private ActionAtTermEnd actionAtTermEnd; - - private Integer cancellationCutoffPeriod; - - private Timestamp contractStart; - - private ContractTermBuilder() {} - - public ContractTermBuilder actionAtTermEnd(ActionAtTermEnd value) { - this.actionAtTermEnd = value; - return this; - } - - public ContractTermBuilder cancellationCutoffPeriod(Integer value) { - this.cancellationCutoffPeriod = value; - return this; - } - - @Deprecated - public ContractTermBuilder contractStart(Timestamp value) { - this.contractStart = value; - return this; - } - - public ContractTermParams build() { - return new ContractTermParams(this); - } - } - - public enum ActionAtTermEnd { - RENEW("renew"), - - EVERGREEN("evergreen"), - - CANCEL("cancel"), - - RENEW_ONCE("renew_once"), - - /** An enum member indicating that ActionAtTermEnd was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ActionAtTermEnd(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ActionAtTermEnd fromString(String value) { - if (value == null) return _UNKNOWN; - for (ActionAtTermEnd enumValue : ActionAtTermEnd.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class BillingOverrideParams { - - private final Long maxExcessPaymentUsage; - - private final Long maxRefundableCreditsUsage; - - private BillingOverrideParams(BillingOverrideBuilder builder) { - - this.maxExcessPaymentUsage = builder.maxExcessPaymentUsage; - - this.maxRefundableCreditsUsage = builder.maxRefundableCreditsUsage; - } - - public Long getMaxExcessPaymentUsage() { - return maxExcessPaymentUsage; - } - - public Long getMaxRefundableCreditsUsage() { - return maxRefundableCreditsUsage; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.maxExcessPaymentUsage != null) { - - formData.put("max_excess_payment_usage", this.maxExcessPaymentUsage); - } - - if (this.maxRefundableCreditsUsage != null) { - - formData.put("max_refundable_credits_usage", this.maxRefundableCreditsUsage); - } - - return formData; - } - - /** Create a new builder for BillingOverrideParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static BillingOverrideBuilder builder() { - return new BillingOverrideBuilder(); - } - - public static final class BillingOverrideBuilder { - - private Long maxExcessPaymentUsage; - - private Long maxRefundableCreditsUsage; - - private BillingOverrideBuilder() {} - - public BillingOverrideBuilder maxExcessPaymentUsage(Long value) { - this.maxExcessPaymentUsage = value; - return this; - } - - public BillingOverrideBuilder maxRefundableCreditsUsage(Long value) { - this.maxRefundableCreditsUsage = value; - return this; - } - - public BillingOverrideParams build() { - return new BillingOverrideParams(this); - } - } - } - - public static final class SubscriptionItemsParams { - - private final String itemPriceId; - - private final Integer quantity; - - private final String quantityInDecimal; - - private final Long unitPrice; - - private final String unitPriceInDecimal; - - private final Integer billingCycles; - - private final Timestamp trialEnd; - - private final Integer servicePeriodDays; - - private final ChargeOnEvent chargeOnEvent; - - private final Boolean chargeOnce; - - private final ChargeOnOption chargeOnOption; - - private final ItemType itemType; - - private final ProrationType prorationType; - - private final UsageAccumulationResetFrequency usageAccumulationResetFrequency; - - private SubscriptionItemsParams(SubscriptionItemsBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.quantityInDecimal = builder.quantityInDecimal; - - this.unitPrice = builder.unitPrice; - - this.unitPriceInDecimal = builder.unitPriceInDecimal; - - this.billingCycles = builder.billingCycles; - - this.trialEnd = builder.trialEnd; - - this.servicePeriodDays = builder.servicePeriodDays; - - this.chargeOnEvent = builder.chargeOnEvent; - - this.chargeOnce = builder.chargeOnce; - - this.chargeOnOption = builder.chargeOnOption; - - this.itemType = builder.itemType; - - this.prorationType = builder.prorationType; - - this.usageAccumulationResetFrequency = builder.usageAccumulationResetFrequency; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public String getQuantityInDecimal() { - return quantityInDecimal; - } - - public Long getUnitPrice() { - return unitPrice; - } - - public String getUnitPriceInDecimal() { - return unitPriceInDecimal; - } - - public Integer getBillingCycles() { - return billingCycles; - } - - public Timestamp getTrialEnd() { - return trialEnd; - } - - public Integer getServicePeriodDays() { - return servicePeriodDays; - } - - public ChargeOnEvent getChargeOnEvent() { - return chargeOnEvent; - } - - public Boolean getChargeOnce() { - return chargeOnce; - } - - public ChargeOnOption getChargeOnOption() { - return chargeOnOption; - } - - public ItemType getItemType() { - return itemType; - } - - public ProrationType getProrationType() { - return prorationType; - } - - public UsageAccumulationResetFrequency getUsageAccumulationResetFrequency() { - return usageAccumulationResetFrequency; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.quantityInDecimal != null) { - - formData.put("quantity_in_decimal", this.quantityInDecimal); - } - - if (this.unitPrice != null) { - - formData.put("unit_price", this.unitPrice); - } - - if (this.unitPriceInDecimal != null) { - - formData.put("unit_price_in_decimal", this.unitPriceInDecimal); - } - - if (this.billingCycles != null) { - - formData.put("billing_cycles", this.billingCycles); - } - - if (this.trialEnd != null) { - - formData.put("trial_end", this.trialEnd); - } - - if (this.servicePeriodDays != null) { - - formData.put("service_period_days", this.servicePeriodDays); - } - - if (this.chargeOnEvent != null) { - - formData.put("charge_on_event", this.chargeOnEvent); - } - - if (this.chargeOnce != null) { - - formData.put("charge_once", this.chargeOnce); - } - - if (this.chargeOnOption != null) { - - formData.put("charge_on_option", this.chargeOnOption); - } - - if (this.itemType != null) { - - formData.put("item_type", this.itemType); - } - - if (this.prorationType != null) { - - formData.put("proration_type", this.prorationType); - } - - if (this.usageAccumulationResetFrequency != null) { - - formData.put("usage_accumulation_reset_frequency", this.usageAccumulationResetFrequency); - } - - return formData; - } - - /** Create a new builder for SubscriptionItemsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionItemsBuilder builder() { - return new SubscriptionItemsBuilder(); - } - - public static final class SubscriptionItemsBuilder { - - private String itemPriceId; - - private Integer quantity; - - private String quantityInDecimal; - - private Long unitPrice; - - private String unitPriceInDecimal; - - private Integer billingCycles; - - private Timestamp trialEnd; - - private Integer servicePeriodDays; - - private ChargeOnEvent chargeOnEvent; - - private Boolean chargeOnce; - - private ChargeOnOption chargeOnOption; - - private ItemType itemType; - - private ProrationType prorationType; - - private UsageAccumulationResetFrequency usageAccumulationResetFrequency; - - private SubscriptionItemsBuilder() {} - - public SubscriptionItemsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public SubscriptionItemsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public SubscriptionItemsBuilder quantityInDecimal(String value) { - this.quantityInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder unitPrice(Long value) { - this.unitPrice = value; - return this; - } - - public SubscriptionItemsBuilder unitPriceInDecimal(String value) { - this.unitPriceInDecimal = value; - return this; - } - - public SubscriptionItemsBuilder billingCycles(Integer value) { - this.billingCycles = value; - return this; - } - - public SubscriptionItemsBuilder trialEnd(Timestamp value) { - this.trialEnd = value; - return this; - } - - public SubscriptionItemsBuilder servicePeriodDays(Integer value) { - this.servicePeriodDays = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnEvent(ChargeOnEvent value) { - this.chargeOnEvent = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnce(Boolean value) { - this.chargeOnce = value; - return this; - } - - public SubscriptionItemsBuilder chargeOnOption(ChargeOnOption value) { - this.chargeOnOption = value; - return this; - } - - public SubscriptionItemsBuilder itemType(ItemType value) { - this.itemType = value; - return this; - } - - public SubscriptionItemsBuilder prorationType(ProrationType value) { - this.prorationType = value; - return this; - } - - public SubscriptionItemsBuilder usageAccumulationResetFrequency( - UsageAccumulationResetFrequency value) { - this.usageAccumulationResetFrequency = value; - return this; - } - - public SubscriptionItemsParams build() { - return new SubscriptionItemsParams(this); - } - } - - public enum ChargeOnEvent { - SUBSCRIPTION_CREATION("subscription_creation"), - - SUBSCRIPTION_TRIAL_START("subscription_trial_start"), - - PLAN_ACTIVATION("plan_activation"), - - SUBSCRIPTION_ACTIVATION("subscription_activation"), - - CONTRACT_TERMINATION("contract_termination"), - - /** An enum member indicating that ChargeOnEvent was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnEvent(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnEvent fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnEvent enumValue : ChargeOnEvent.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ChargeOnOption { - IMMEDIATELY("immediately"), - - ON_EVENT("on_event"), - - /** An enum member indicating that ChargeOnOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ChargeOnOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ChargeOnOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (ChargeOnOption enumValue : ChargeOnOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ItemType { - PLAN("plan"), - - ADDON("addon"), - - CHARGE("charge"), - - /** An enum member indicating that ItemType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ItemType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ItemType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ItemType enumValue : ItemType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum ProrationType { - FULL_TERM("full_term"), - - PARTIAL_TERM("partial_term"), - - NONE("none"), - - /** An enum member indicating that ProrationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ProrationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ProrationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (ProrationType enumValue : ProrationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum UsageAccumulationResetFrequency { - NEVER("never"), - - SUBSCRIPTION_BILLING_FREQUENCY("subscription_billing_frequency"), - - /** - * An enum member indicating that UsageAccumulationResetFrequency was instantiated with an - * unknown value. - */ - _UNKNOWN(null); - private final String value; - - UsageAccumulationResetFrequency(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static UsageAccumulationResetFrequency fromString(String value) { - if (value == null) return _UNKNOWN; - for (UsageAccumulationResetFrequency enumValue : UsageAccumulationResetFrequency.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class DiscountsParams { - - private final ApplyOn applyOn; - - private final DurationType durationType; - - private final Number percentage; - - private final Long amount; - - private final Integer period; - - private final PeriodUnit periodUnit; - - private final Boolean includedInMrr; - - private final String itemPriceId; - - private final Integer quantity; - - private final OperationType operationType; - - private final String id; - - private DiscountsParams(DiscountsBuilder builder) { - - this.applyOn = builder.applyOn; - - this.durationType = builder.durationType; - - this.percentage = builder.percentage; - - this.amount = builder.amount; - - this.period = builder.period; - - this.periodUnit = builder.periodUnit; - - this.includedInMrr = builder.includedInMrr; - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.operationType = builder.operationType; - - this.id = builder.id; - } - - public ApplyOn getApplyOn() { - return applyOn; - } - - public DurationType getDurationType() { - return durationType; - } - - public Number getPercentage() { - return percentage; - } - - public Long getAmount() { - return amount; - } - - public Integer getPeriod() { - return period; - } - - public PeriodUnit getPeriodUnit() { - return periodUnit; - } - - public Boolean getIncludedInMrr() { - return includedInMrr; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getQuantity() { - return quantity; - } - - public OperationType getOperationType() { - return operationType; - } - - public String getId() { - return id; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.applyOn != null) { - - formData.put("apply_on", this.applyOn); - } - - if (this.durationType != null) { - - formData.put("duration_type", this.durationType); - } - - if (this.percentage != null) { - - formData.put("percentage", this.percentage); - } - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.period != null) { - - formData.put("period", this.period); - } - - if (this.periodUnit != null) { - - formData.put("period_unit", this.periodUnit); - } - - if (this.includedInMrr != null) { - - formData.put("included_in_mrr", this.includedInMrr); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.operationType != null) { - - formData.put("operation_type", this.operationType); - } - - if (this.id != null) { - - formData.put("id", this.id); - } - - return formData; - } - - /** Create a new builder for DiscountsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DiscountsBuilder builder() { - return new DiscountsBuilder(); - } - - public static final class DiscountsBuilder { - - private ApplyOn applyOn; - - private DurationType durationType; - - private Number percentage; - - private Long amount; - - private Integer period; - - private PeriodUnit periodUnit; - - private Boolean includedInMrr; - - private String itemPriceId; - - private Integer quantity; - - private OperationType operationType; - - private String id; - - private DiscountsBuilder() {} - - public DiscountsBuilder applyOn(ApplyOn value) { - this.applyOn = value; - return this; - } - - public DiscountsBuilder durationType(DurationType value) { - this.durationType = value; - return this; - } - - public DiscountsBuilder percentage(Number value) { - this.percentage = value; - return this; - } - - public DiscountsBuilder amount(Long value) { - this.amount = value; - return this; - } - - public DiscountsBuilder period(Integer value) { - this.period = value; - return this; - } - - public DiscountsBuilder periodUnit(PeriodUnit value) { - this.periodUnit = value; - return this; - } - - public DiscountsBuilder includedInMrr(Boolean value) { - this.includedInMrr = value; - return this; - } - - public DiscountsBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public DiscountsBuilder quantity(Integer value) { - this.quantity = value; - return this; - } - - public DiscountsBuilder operationType(OperationType value) { - this.operationType = value; - return this; - } - - public DiscountsBuilder id(String value) { - this.id = value; - return this; - } - - public DiscountsParams build() { - return new DiscountsParams(this); - } - } - - public enum ApplyOn { - INVOICE_AMOUNT("invoice_amount"), - - SPECIFIC_ITEM_PRICE("specific_item_price"), - - /** An enum member indicating that ApplyOn was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - ApplyOn(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ApplyOn fromString(String value) { - if (value == null) return _UNKNOWN; - for (ApplyOn enumValue : ApplyOn.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum DurationType { - ONE_TIME("one_time"), - - FOREVER("forever"), - - LIMITED_PERIOD("limited_period"), - - /** An enum member indicating that DurationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DurationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DurationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (DurationType enumValue : DurationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum PeriodUnit { - DAY("day"), - - WEEK("week"), - - MONTH("month"), - - YEAR("year"), - - /** An enum member indicating that PeriodUnit was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PeriodUnit(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PeriodUnit fromString(String value) { - if (value == null) return _UNKNOWN; - for (PeriodUnit enumValue : PeriodUnit.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum OperationType { - ADD("add"), - - REMOVE("remove"), - - /** An enum member indicating that OperationType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - OperationType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static OperationType fromString(String value) { - if (value == null) return _UNKNOWN; - for (OperationType enumValue : OperationType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class ItemTiersParams { - - private final String itemPriceId; - - private final Integer startingUnit; - - private final Integer endingUnit; - - private final Long price; - - private final String startingUnitInDecimal; - - private final String endingUnitInDecimal; - - private final String priceInDecimal; - - private final PricingType pricingType; - - private final Integer packageSize; - - private ItemTiersParams(ItemTiersBuilder builder) { - - this.itemPriceId = builder.itemPriceId; - - this.startingUnit = builder.startingUnit; - - this.endingUnit = builder.endingUnit; - - this.price = builder.price; - - this.startingUnitInDecimal = builder.startingUnitInDecimal; - - this.endingUnitInDecimal = builder.endingUnitInDecimal; - - this.priceInDecimal = builder.priceInDecimal; - - this.pricingType = builder.pricingType; - - this.packageSize = builder.packageSize; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public Integer getStartingUnit() { - return startingUnit; - } - - public Integer getEndingUnit() { - return endingUnit; - } - - public Long getPrice() { - return price; - } - - public String getStartingUnitInDecimal() { - return startingUnitInDecimal; - } - - public String getEndingUnitInDecimal() { - return endingUnitInDecimal; - } - - public String getPriceInDecimal() { - return priceInDecimal; - } - - public PricingType getPricingType() { - return pricingType; - } - - public Integer getPackageSize() { - return packageSize; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.startingUnit != null) { - - formData.put("starting_unit", this.startingUnit); - } - - if (this.endingUnit != null) { - - formData.put("ending_unit", this.endingUnit); - } - - if (this.price != null) { - - formData.put("price", this.price); - } - - if (this.startingUnitInDecimal != null) { - - formData.put("starting_unit_in_decimal", this.startingUnitInDecimal); - } - - if (this.endingUnitInDecimal != null) { - - formData.put("ending_unit_in_decimal", this.endingUnitInDecimal); - } - - if (this.priceInDecimal != null) { - - formData.put("price_in_decimal", this.priceInDecimal); - } - - if (this.pricingType != null) { - - formData.put("pricing_type", this.pricingType); - } - - if (this.packageSize != null) { - - formData.put("package_size", this.packageSize); - } - - return formData; - } - - /** Create a new builder for ItemTiersParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ItemTiersBuilder builder() { - return new ItemTiersBuilder(); - } - - public static final class ItemTiersBuilder { - - private String itemPriceId; - - private Integer startingUnit; - - private Integer endingUnit; - - private Long price; - - private String startingUnitInDecimal; - - private String endingUnitInDecimal; - - private String priceInDecimal; - - private PricingType pricingType; - - private Integer packageSize; - - private ItemTiersBuilder() {} - - public ItemTiersBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public ItemTiersBuilder startingUnit(Integer value) { - this.startingUnit = value; - return this; - } - - public ItemTiersBuilder endingUnit(Integer value) { - this.endingUnit = value; - return this; - } - - public ItemTiersBuilder price(Long value) { - this.price = value; - return this; - } - - public ItemTiersBuilder startingUnitInDecimal(String value) { - this.startingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder endingUnitInDecimal(String value) { - this.endingUnitInDecimal = value; - return this; - } - - public ItemTiersBuilder priceInDecimal(String value) { - this.priceInDecimal = value; - return this; - } - - public ItemTiersBuilder pricingType(PricingType value) { - this.pricingType = value; - return this; - } - - public ItemTiersBuilder packageSize(Integer value) { - this.packageSize = value; - return this; - } - - public ItemTiersParams build() { - return new ItemTiersParams(this); - } - } - - public enum PricingType { - PER_UNIT("per_unit"), - - FLAT_FEE("flat_fee"), - - PACKAGE("package"), - - /** An enum member indicating that PricingType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PricingType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PricingType fromString(String value) { - if (value == null) return _UNKNOWN; - for (PricingType enumValue : PricingType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - } - - public static final class CouponsParams { - - private final String couponId; - - private final Timestamp applyTill; - - private CouponsParams(CouponsBuilder builder) { - - this.couponId = builder.couponId; - - this.applyTill = builder.applyTill; - } - - public String getCouponId() { - return couponId; - } - - public Timestamp getApplyTill() { - return applyTill; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.couponId != null) { - - formData.put("coupon_id", this.couponId); - } - - if (this.applyTill != null) { - - formData.put("apply_till", this.applyTill); - } - - return formData; - } - - /** Create a new builder for CouponsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static CouponsBuilder builder() { - return new CouponsBuilder(); - } - - public static final class CouponsBuilder { - - private String couponId; - - private Timestamp applyTill; - - private CouponsBuilder() {} - - public CouponsBuilder couponId(String value) { - this.couponId = value; - return this; - } - - public CouponsBuilder applyTill(Timestamp value) { - this.applyTill = value; - return this; - } - - public CouponsParams build() { - return new CouponsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/AddChargeAtTermEndForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/AddChargeAtTermEndForSubscriptionResponse.java deleted file mode 100644 index 54b9a160..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/AddChargeAtTermEndForSubscriptionResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddChargeAtTermEndForSubscription operation. Contains the response - * data from the API. - */ -public final class AddChargeAtTermEndForSubscriptionResponse extends BaseResponse { - private final Estimate estimate; - - private AddChargeAtTermEndForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into AddChargeAtTermEndForSubscriptionResponse object. */ - public static AddChargeAtTermEndForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into AddChargeAtTermEndForSubscriptionResponse object with HTTP response. - */ - public static AddChargeAtTermEndForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse AddChargeAtTermEndForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for AddChargeAtTermEndForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddChargeAtTermEndForSubscriptionResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddChargeAtTermEndForSubscriptionResponse build() { - return new AddChargeAtTermEndForSubscriptionResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/AddSubscriptionForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/AddSubscriptionForCustomerResponse.java deleted file mode 100644 index 218f41d8..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/AddSubscriptionForCustomerResponse.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddSubscriptionForCustomer operation. Contains the response data - * from the API. - */ -public final class AddSubscriptionForCustomerResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private final List unbilledCharges; - - private AddSubscriptionForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - - this.unbilledCharges = builder.unbilledCharges; - } - - /** Parse JSON response into AddSubscriptionForCustomerResponse object. */ - public static AddSubscriptionForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddSubscriptionForCustomerResponse object with HTTP response. */ - public static AddSubscriptionForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddSubscriptionForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for AddSubscriptionForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddSubscriptionForCustomerResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private List unbilledCharges; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddSubscriptionForCustomerResponse build() { - return new AddSubscriptionForCustomerResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/CancelForItemsForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/CancelForItemsForSubscriptionResponse.java deleted file mode 100644 index 4959bf7e..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/CancelForItemsForSubscriptionResponse.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CancelForItemsForSubscription operation. Contains the response data - * from the API. - */ -public final class CancelForItemsForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private final List unbilledCharges; - - private final List creditNotes; - - private CancelForItemsForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - - this.unbilledCharges = builder.unbilledCharges; - - this.creditNotes = builder.creditNotes; - } - - /** Parse JSON response into CancelForItemsForSubscriptionResponse object. */ - public static CancelForItemsForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into CancelForItemsForSubscriptionResponse object with HTTP response. */ - public static CancelForItemsForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.creditNotes( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() - .map(CreditNote::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse CancelForItemsForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for CancelForItemsForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CancelForItemsForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private List unbilledCharges; - - private List creditNotes; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder creditNotes(List creditNotes) { - this.creditNotes = creditNotes; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CancelForItemsForSubscriptionResponse build() { - return new CancelForItemsForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } - - /** Get the creditNotes from the response. */ - public List getCreditNotes() { - return creditNotes; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/CancelForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/CancelForSubscriptionResponse.java deleted file mode 100644 index 0c6ae5d7..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/CancelForSubscriptionResponse.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for CancelForSubscription operation. Contains the response data from - * the API. - */ -public final class CancelForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private final List unbilledCharges; - - private final List creditNotes; - - private CancelForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - - this.unbilledCharges = builder.unbilledCharges; - - this.creditNotes = builder.creditNotes; - } - - /** Parse JSON response into CancelForSubscriptionResponse object. */ - public static CancelForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into CancelForSubscriptionResponse object with HTTP response. */ - public static CancelForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.creditNotes( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() - .map(CreditNote::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse CancelForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for CancelForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CancelForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private List unbilledCharges; - - private List creditNotes; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder creditNotes(List creditNotes) { - this.creditNotes = creditNotes; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public CancelForSubscriptionResponse build() { - return new CancelForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } - - /** Get the creditNotes from the response. */ - public List getCreditNotes() { - return creditNotes; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/ChangeTermEndForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/ChangeTermEndForSubscriptionResponse.java deleted file mode 100644 index a830ca8d..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/ChangeTermEndForSubscriptionResponse.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ChangeTermEndForSubscription operation. Contains the response data - * from the API. - */ -public final class ChangeTermEndForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private final List unbilledCharges; - - private final List creditNotes; - - private ChangeTermEndForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - - this.unbilledCharges = builder.unbilledCharges; - - this.creditNotes = builder.creditNotes; - } - - /** Parse JSON response into ChangeTermEndForSubscriptionResponse object. */ - public static ChangeTermEndForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ChangeTermEndForSubscriptionResponse object with HTTP response. */ - public static ChangeTermEndForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.creditNotes( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() - .map(CreditNote::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ChangeTermEndForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ChangeTermEndForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ChangeTermEndForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private List unbilledCharges; - - private List creditNotes; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder creditNotes(List creditNotes) { - this.creditNotes = creditNotes; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ChangeTermEndForSubscriptionResponse build() { - return new ChangeTermEndForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } - - /** Get the creditNotes from the response. */ - public List getCreditNotes() { - return creditNotes; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/ChargeAddonAtTermEndForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/ChargeAddonAtTermEndForSubscriptionResponse.java deleted file mode 100644 index 5c0de812..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/ChargeAddonAtTermEndForSubscriptionResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.estimate.Estimate; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ChargeAddonAtTermEndForSubscription operation. Contains the - * response data from the API. - */ -public final class ChargeAddonAtTermEndForSubscriptionResponse extends BaseResponse { - private final Estimate estimate; - - private ChargeAddonAtTermEndForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.estimate = builder.estimate; - } - - /** Parse JSON response into ChargeAddonAtTermEndForSubscriptionResponse object. */ - public static ChargeAddonAtTermEndForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into ChargeAddonAtTermEndForSubscriptionResponse object with HTTP response. - */ - public static ChargeAddonAtTermEndForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __estimateJson = JsonUtil.getObject(json, "estimate"); - if (__estimateJson != null) { - builder.estimate(Estimate.fromJson(__estimateJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ChargeAddonAtTermEndForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ChargeAddonAtTermEndForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ChargeAddonAtTermEndForSubscriptionResponse. */ - public static class Builder { - - private Estimate estimate; - - private Response httpResponse; - - private Builder() {} - - public Builder estimate(Estimate estimate) { - this.estimate = estimate; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ChargeAddonAtTermEndForSubscriptionResponse build() { - return new ChargeAddonAtTermEndForSubscriptionResponse(this); - } - } - - /** Get the estimate from the response. */ - public Estimate getEstimate() { - return estimate; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/ChargeFutureRenewalsForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/ChargeFutureRenewalsForSubscriptionResponse.java deleted file mode 100644 index b7051536..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/ChargeFutureRenewalsForSubscriptionResponse.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.advanceInvoiceSchedule.AdvanceInvoiceSchedule; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ChargeFutureRenewalsForSubscription operation. Contains the - * response data from the API. - */ -public final class ChargeFutureRenewalsForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private final List advanceInvoiceSchedules; - - private ChargeFutureRenewalsForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - - this.advanceInvoiceSchedules = builder.advanceInvoiceSchedules; - } - - /** Parse JSON response into ChargeFutureRenewalsForSubscriptionResponse object. */ - public static ChargeFutureRenewalsForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into ChargeFutureRenewalsForSubscriptionResponse object with HTTP response. - */ - public static ChargeFutureRenewalsForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.advanceInvoiceSchedules( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "advance_invoice_schedules")).stream() - .map(AdvanceInvoiceSchedule::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ChargeFutureRenewalsForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ChargeFutureRenewalsForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ChargeFutureRenewalsForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private List advanceInvoiceSchedules; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder advanceInvoiceSchedules(List advanceInvoiceSchedules) { - this.advanceInvoiceSchedules = advanceInvoiceSchedules; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ChargeFutureRenewalsForSubscriptionResponse build() { - return new ChargeFutureRenewalsForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the advanceInvoiceSchedules from the response. */ - public List getAdvanceInvoiceSchedules() { - return advanceInvoiceSchedules; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/ContractTermsForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/ContractTermsForSubscriptionResponse.java index a6c4cedb..9c9a5c87 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/ContractTermsForSubscriptionResponse.java +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/ContractTermsForSubscriptionResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.contractTerm.ContractTerm; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.SubscriptionService; @@ -110,9 +111,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public ContractTermsForSubscriptionResponse nextPage() throws Exception { + public ContractTermsForSubscriptionResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/DeleteSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/DeleteSubscriptionResponse.java deleted file mode 100644 index cebfed69..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/DeleteSubscriptionResponse.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteSubscription operation. Contains the response data from the - * API. - */ -public final class DeleteSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private DeleteSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into DeleteSubscriptionResponse object. */ - public static DeleteSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteSubscriptionResponse object with HTTP response. */ - public static DeleteSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for DeleteSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteSubscriptionResponse build() { - return new DeleteSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/DiscountsForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/DiscountsForSubscriptionResponse.java deleted file mode 100644 index 7c6ba194..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/DiscountsForSubscriptionResponse.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.discount.Discount; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.SubscriptionService; -import com.chargebee.v4.models.subscription.params.DiscountsForSubscriptionParams; - -/** - * Immutable response object for DiscountsForSubscription operation. Contains paginated list data. - */ -public final class DiscountsForSubscriptionResponse { - - private final List list; - - private final String nextOffset; - - private final String subscriptionId; - - private final SubscriptionService service; - private final DiscountsForSubscriptionParams originalParams; - private final Response httpResponse; - - private DiscountsForSubscriptionResponse( - List list, - String nextOffset, - String subscriptionId, - SubscriptionService service, - DiscountsForSubscriptionParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.subscriptionId = subscriptionId; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into DiscountsForSubscriptionResponse object (no service context). Use this - * when you only need to read a single page (no nextPage()). - */ - public static DiscountsForSubscriptionResponse fromJson(String json) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(SubscriptionDiscountsForSubscriptionItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new DiscountsForSubscriptionResponse(list, nextOffset, null, null, null, null); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DiscountsForSubscriptionResponse from JSON", e); - } - } - - /** - * Parse JSON response into DiscountsForSubscriptionResponse object with service context for - * pagination (enables nextPage()). - */ - public static DiscountsForSubscriptionResponse fromJson( - String json, - SubscriptionService service, - DiscountsForSubscriptionParams originalParams, - String subscriptionId, - Response httpResponse) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(SubscriptionDiscountsForSubscriptionItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new DiscountsForSubscriptionResponse( - list, nextOffset, subscriptionId, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DiscountsForSubscriptionResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public DiscountsForSubscriptionResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - DiscountsForSubscriptionParams nextParams = - (originalParams != null - ? originalParams.toBuilder() - : DiscountsForSubscriptionParams.builder()) - .offset(nextOffset) - .build(); - - return service.discountsForSubscription(subscriptionId, nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } - - public static class SubscriptionDiscountsForSubscriptionItem { - - private Discount discount; - - public Discount getDiscount() { - return discount; - } - - public static SubscriptionDiscountsForSubscriptionItem fromJson(String json) { - SubscriptionDiscountsForSubscriptionItem item = - new SubscriptionDiscountsForSubscriptionItem(); - - String __discountJson = JsonUtil.getObject(json, "discount"); - if (__discountJson != null) { - item.discount = Discount.fromJson(__discountJson); - } - - return item; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/EditAdvanceInvoiceScheduleForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/EditAdvanceInvoiceScheduleForSubscriptionResponse.java deleted file mode 100644 index 73cf5153..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/EditAdvanceInvoiceScheduleForSubscriptionResponse.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.advanceInvoiceSchedule.AdvanceInvoiceSchedule; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for EditAdvanceInvoiceScheduleForSubscription operation. Contains the - * response data from the API. - */ -public final class EditAdvanceInvoiceScheduleForSubscriptionResponse extends BaseResponse { - private final List advanceInvoiceSchedules; - - private EditAdvanceInvoiceScheduleForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.advanceInvoiceSchedules = builder.advanceInvoiceSchedules; - } - - /** Parse JSON response into EditAdvanceInvoiceScheduleForSubscriptionResponse object. */ - public static EditAdvanceInvoiceScheduleForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into EditAdvanceInvoiceScheduleForSubscriptionResponse object with HTTP - * response. - */ - public static EditAdvanceInvoiceScheduleForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.advanceInvoiceSchedules( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "advance_invoice_schedules")).stream() - .map(AdvanceInvoiceSchedule::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse EditAdvanceInvoiceScheduleForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for EditAdvanceInvoiceScheduleForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for EditAdvanceInvoiceScheduleForSubscriptionResponse. */ - public static class Builder { - - private List advanceInvoiceSchedules; - - private Response httpResponse; - - private Builder() {} - - public Builder advanceInvoiceSchedules(List advanceInvoiceSchedules) { - this.advanceInvoiceSchedules = advanceInvoiceSchedules; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public EditAdvanceInvoiceScheduleForSubscriptionResponse build() { - return new EditAdvanceInvoiceScheduleForSubscriptionResponse(this); - } - } - - /** Get the advanceInvoiceSchedules from the response. */ - public List getAdvanceInvoiceSchedules() { - return advanceInvoiceSchedules; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/ImportContractTermForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/ImportContractTermForSubscriptionResponse.java deleted file mode 100644 index ee136e1b..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/ImportContractTermForSubscriptionResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.contractTerm.ContractTerm; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ImportContractTermForSubscription operation. Contains the response - * data from the API. - */ -public final class ImportContractTermForSubscriptionResponse extends BaseResponse { - private final ContractTerm contractTerm; - - private ImportContractTermForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.contractTerm = builder.contractTerm; - } - - /** Parse JSON response into ImportContractTermForSubscriptionResponse object. */ - public static ImportContractTermForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into ImportContractTermForSubscriptionResponse object with HTTP response. - */ - public static ImportContractTermForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __contractTermJson = JsonUtil.getObject(json, "contract_term"); - if (__contractTermJson != null) { - builder.contractTerm(ContractTerm.fromJson(__contractTermJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ImportContractTermForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ImportContractTermForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ImportContractTermForSubscriptionResponse. */ - public static class Builder { - - private ContractTerm contractTerm; - - private Response httpResponse; - - private Builder() {} - - public Builder contractTerm(ContractTerm contractTerm) { - this.contractTerm = contractTerm; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ImportContractTermForSubscriptionResponse build() { - return new ImportContractTermForSubscriptionResponse(this); - } - } - - /** Get the contractTerm from the response. */ - public ContractTerm getContractTerm() { - return contractTerm; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/ImportSubscriptionForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/ImportSubscriptionForCustomerResponse.java deleted file mode 100644 index 55e1911f..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/ImportSubscriptionForCustomerResponse.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ImportSubscriptionForCustomer operation. Contains the response data - * from the API. - */ -public final class ImportSubscriptionForCustomerResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private ImportSubscriptionForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - } - - /** Parse JSON response into ImportSubscriptionForCustomerResponse object. */ - public static ImportSubscriptionForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ImportSubscriptionForCustomerResponse object with HTTP response. */ - public static ImportSubscriptionForCustomerResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ImportSubscriptionForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for ImportSubscriptionForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ImportSubscriptionForCustomerResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ImportSubscriptionForCustomerResponse build() { - return new ImportSubscriptionForCustomerResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/ImportUnbilledChargesForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/ImportUnbilledChargesForSubscriptionResponse.java deleted file mode 100644 index c4aea6b0..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/ImportUnbilledChargesForSubscriptionResponse.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ImportUnbilledChargesForSubscription operation. Contains the - * response data from the API. - */ -public final class ImportUnbilledChargesForSubscriptionResponse extends BaseResponse { - private final List unbilledCharges; - - private ImportUnbilledChargesForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.unbilledCharges = builder.unbilledCharges; - } - - /** Parse JSON response into ImportUnbilledChargesForSubscriptionResponse object. */ - public static ImportUnbilledChargesForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into ImportUnbilledChargesForSubscriptionResponse object with HTTP - * response. - */ - public static ImportUnbilledChargesForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ImportUnbilledChargesForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ImportUnbilledChargesForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ImportUnbilledChargesForSubscriptionResponse. */ - public static class Builder { - - private List unbilledCharges; - - private Response httpResponse; - - private Builder() {} - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ImportUnbilledChargesForSubscriptionResponse build() { - return new ImportUnbilledChargesForSubscriptionResponse(this); - } - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/MoveForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/MoveForSubscriptionResponse.java deleted file mode 100644 index cabeacee..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/MoveForSubscriptionResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for MoveForSubscription operation. Contains the response data from the - * API. - */ -public final class MoveForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private MoveForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - } - - /** Parse JSON response into MoveForSubscriptionResponse object. */ - public static MoveForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into MoveForSubscriptionResponse object with HTTP response. */ - public static MoveForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse MoveForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for MoveForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for MoveForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public MoveForSubscriptionResponse build() { - return new MoveForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/OverrideBillingProfileForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/OverrideBillingProfileForSubscriptionResponse.java deleted file mode 100644 index 3132052b..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/OverrideBillingProfileForSubscriptionResponse.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.paymentSource.PaymentSource; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for OverrideBillingProfileForSubscription operation. Contains the - * response data from the API. - */ -public final class OverrideBillingProfileForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final PaymentSource paymentSource; - - private OverrideBillingProfileForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.paymentSource = builder.paymentSource; - } - - /** Parse JSON response into OverrideBillingProfileForSubscriptionResponse object. */ - public static OverrideBillingProfileForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into OverrideBillingProfileForSubscriptionResponse object with HTTP - * response. - */ - public static OverrideBillingProfileForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); - if (__paymentSourceJson != null) { - builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse OverrideBillingProfileForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for OverrideBillingProfileForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for OverrideBillingProfileForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private PaymentSource paymentSource; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder paymentSource(PaymentSource paymentSource) { - this.paymentSource = paymentSource; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public OverrideBillingProfileForSubscriptionResponse build() { - return new OverrideBillingProfileForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the paymentSource from the response. */ - public PaymentSource getPaymentSource() { - return paymentSource; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/PauseForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/PauseForSubscriptionResponse.java deleted file mode 100644 index 59014296..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/PauseForSubscriptionResponse.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for PauseForSubscription operation. Contains the response data from the - * API. - */ -public final class PauseForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private final List unbilledCharges; - - private final List creditNotes; - - private PauseForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - - this.unbilledCharges = builder.unbilledCharges; - - this.creditNotes = builder.creditNotes; - } - - /** Parse JSON response into PauseForSubscriptionResponse object. */ - public static PauseForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into PauseForSubscriptionResponse object with HTTP response. */ - public static PauseForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.creditNotes( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() - .map(CreditNote::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse PauseForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for PauseForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for PauseForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private List unbilledCharges; - - private List creditNotes; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder creditNotes(List creditNotes) { - this.creditNotes = creditNotes; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public PauseForSubscriptionResponse build() { - return new PauseForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } - - /** Get the creditNotes from the response. */ - public List getCreditNotes() { - return creditNotes; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/ReactivateForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/ReactivateForSubscriptionResponse.java deleted file mode 100644 index 63edc4a4..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/ReactivateForSubscriptionResponse.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ReactivateForSubscription operation. Contains the response data - * from the API. - */ -public final class ReactivateForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private final List unbilledCharges; - - private ReactivateForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - - this.unbilledCharges = builder.unbilledCharges; - } - - /** Parse JSON response into ReactivateForSubscriptionResponse object. */ - public static ReactivateForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ReactivateForSubscriptionResponse object with HTTP response. */ - public static ReactivateForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ReactivateForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ReactivateForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ReactivateForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private List unbilledCharges; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ReactivateForSubscriptionResponse build() { - return new ReactivateForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/RegenerateInvoiceForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/RegenerateInvoiceForSubscriptionResponse.java deleted file mode 100644 index 6609a207..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/RegenerateInvoiceForSubscriptionResponse.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RegenerateInvoiceForSubscription operation. Contains the response - * data from the API. - */ -public final class RegenerateInvoiceForSubscriptionResponse extends BaseResponse { - private final Invoice invoice; - - private final List unbilledCharges; - - private RegenerateInvoiceForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.invoice = builder.invoice; - - this.unbilledCharges = builder.unbilledCharges; - } - - /** Parse JSON response into RegenerateInvoiceForSubscriptionResponse object. */ - public static RegenerateInvoiceForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into RegenerateInvoiceForSubscriptionResponse object with HTTP response. - */ - public static RegenerateInvoiceForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RegenerateInvoiceForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RegenerateInvoiceForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RegenerateInvoiceForSubscriptionResponse. */ - public static class Builder { - - private Invoice invoice; - - private List unbilledCharges; - - private Response httpResponse; - - private Builder() {} - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RegenerateInvoiceForSubscriptionResponse build() { - return new RegenerateInvoiceForSubscriptionResponse(this); - } - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveAdvanceInvoiceScheduleForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveAdvanceInvoiceScheduleForSubscriptionResponse.java deleted file mode 100644 index 6918f217..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveAdvanceInvoiceScheduleForSubscriptionResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.advanceInvoiceSchedule.AdvanceInvoiceSchedule; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RemoveAdvanceInvoiceScheduleForSubscription operation. Contains the - * response data from the API. - */ -public final class RemoveAdvanceInvoiceScheduleForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final List advanceInvoiceSchedules; - - private RemoveAdvanceInvoiceScheduleForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.advanceInvoiceSchedules = builder.advanceInvoiceSchedules; - } - - /** Parse JSON response into RemoveAdvanceInvoiceScheduleForSubscriptionResponse object. */ - public static RemoveAdvanceInvoiceScheduleForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into RemoveAdvanceInvoiceScheduleForSubscriptionResponse object with HTTP - * response. - */ - public static RemoveAdvanceInvoiceScheduleForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - builder.advanceInvoiceSchedules( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "advance_invoice_schedules")).stream() - .map(AdvanceInvoiceSchedule::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RemoveAdvanceInvoiceScheduleForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RemoveAdvanceInvoiceScheduleForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RemoveAdvanceInvoiceScheduleForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private List advanceInvoiceSchedules; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder advanceInvoiceSchedules(List advanceInvoiceSchedules) { - this.advanceInvoiceSchedules = advanceInvoiceSchedules; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RemoveAdvanceInvoiceScheduleForSubscriptionResponse build() { - return new RemoveAdvanceInvoiceScheduleForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the advanceInvoiceSchedules from the response. */ - public List getAdvanceInvoiceSchedules() { - return advanceInvoiceSchedules; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveCouponsForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveCouponsForSubscriptionResponse.java deleted file mode 100644 index 4e8871af..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveCouponsForSubscriptionResponse.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RemoveCouponsForSubscription operation. Contains the response data - * from the API. - */ -public final class RemoveCouponsForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private RemoveCouponsForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into RemoveCouponsForSubscriptionResponse object. */ - public static RemoveCouponsForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RemoveCouponsForSubscriptionResponse object with HTTP response. */ - public static RemoveCouponsForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RemoveCouponsForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RemoveCouponsForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RemoveCouponsForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RemoveCouponsForSubscriptionResponse build() { - return new RemoveCouponsForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledCancellationForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledCancellationForSubscriptionResponse.java deleted file mode 100644 index 99fd5834..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledCancellationForSubscriptionResponse.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RemoveScheduledCancellationForSubscription operation. Contains the - * response data from the API. - */ -public final class RemoveScheduledCancellationForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private RemoveScheduledCancellationForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into RemoveScheduledCancellationForSubscriptionResponse object. */ - public static RemoveScheduledCancellationForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into RemoveScheduledCancellationForSubscriptionResponse object with HTTP - * response. - */ - public static RemoveScheduledCancellationForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RemoveScheduledCancellationForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RemoveScheduledCancellationForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RemoveScheduledCancellationForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RemoveScheduledCancellationForSubscriptionResponse build() { - return new RemoveScheduledCancellationForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledChangesForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledChangesForSubscriptionResponse.java deleted file mode 100644 index ac5e7c53..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledChangesForSubscriptionResponse.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RemoveScheduledChangesForSubscription operation. Contains the - * response data from the API. - */ -public final class RemoveScheduledChangesForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final List creditNotes; - - private RemoveScheduledChangesForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.creditNotes = builder.creditNotes; - } - - /** Parse JSON response into RemoveScheduledChangesForSubscriptionResponse object. */ - public static RemoveScheduledChangesForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into RemoveScheduledChangesForSubscriptionResponse object with HTTP - * response. - */ - public static RemoveScheduledChangesForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.creditNotes( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() - .map(CreditNote::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RemoveScheduledChangesForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RemoveScheduledChangesForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RemoveScheduledChangesForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private List creditNotes; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder creditNotes(List creditNotes) { - this.creditNotes = creditNotes; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RemoveScheduledChangesForSubscriptionResponse build() { - return new RemoveScheduledChangesForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the creditNotes from the response. */ - public List getCreditNotes() { - return creditNotes; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledPauseForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledPauseForSubscriptionResponse.java deleted file mode 100644 index d763937b..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledPauseForSubscriptionResponse.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RemoveScheduledPauseForSubscription operation. Contains the - * response data from the API. - */ -public final class RemoveScheduledPauseForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private RemoveScheduledPauseForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into RemoveScheduledPauseForSubscriptionResponse object. */ - public static RemoveScheduledPauseForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into RemoveScheduledPauseForSubscriptionResponse object with HTTP response. - */ - public static RemoveScheduledPauseForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RemoveScheduledPauseForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RemoveScheduledPauseForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RemoveScheduledPauseForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RemoveScheduledPauseForSubscriptionResponse build() { - return new RemoveScheduledPauseForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledResumptionForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledResumptionForSubscriptionResponse.java deleted file mode 100644 index 708ec850..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/RemoveScheduledResumptionForSubscriptionResponse.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RemoveScheduledResumptionForSubscription operation. Contains the - * response data from the API. - */ -public final class RemoveScheduledResumptionForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private RemoveScheduledResumptionForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into RemoveScheduledResumptionForSubscriptionResponse object. */ - public static RemoveScheduledResumptionForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into RemoveScheduledResumptionForSubscriptionResponse object with HTTP - * response. - */ - public static RemoveScheduledResumptionForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RemoveScheduledResumptionForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RemoveScheduledResumptionForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RemoveScheduledResumptionForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RemoveScheduledResumptionForSubscriptionResponse build() { - return new RemoveScheduledResumptionForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/ResumeForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/ResumeForSubscriptionResponse.java deleted file mode 100644 index dafff998..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/ResumeForSubscriptionResponse.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ResumeForSubscription operation. Contains the response data from - * the API. - */ -public final class ResumeForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private final List unbilledCharges; - - private ResumeForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - - this.unbilledCharges = builder.unbilledCharges; - } - - /** Parse JSON response into ResumeForSubscriptionResponse object. */ - public static ResumeForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ResumeForSubscriptionResponse object with HTTP response. */ - public static ResumeForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ResumeForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for ResumeForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ResumeForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private List unbilledCharges; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ResumeForSubscriptionResponse build() { - return new ResumeForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/RetrieveAdvanceInvoiceScheduleForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/RetrieveAdvanceInvoiceScheduleForSubscriptionResponse.java deleted file mode 100644 index 2611e034..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/RetrieveAdvanceInvoiceScheduleForSubscriptionResponse.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.advanceInvoiceSchedule.AdvanceInvoiceSchedule; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import java.util.List; - -/** - * Immutable response object for RetrieveAdvanceInvoiceScheduleForSubscription operation. Contains - * the response data from a single resource get operation. - */ -public final class RetrieveAdvanceInvoiceScheduleForSubscriptionResponse extends BaseResponse { - private final List advanceInvoiceSchedules; - - private RetrieveAdvanceInvoiceScheduleForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.advanceInvoiceSchedules = builder.advanceInvoiceSchedules; - } - - /** Parse JSON response into RetrieveAdvanceInvoiceScheduleForSubscriptionResponse object. */ - public static RetrieveAdvanceInvoiceScheduleForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into RetrieveAdvanceInvoiceScheduleForSubscriptionResponse object with HTTP - * response. - */ - public static RetrieveAdvanceInvoiceScheduleForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __advanceInvoiceSchedulesJson = JsonUtil.getArray(json, "advance_invoice_schedules"); - if (__advanceInvoiceSchedulesJson != null) { - builder.advanceInvoiceSchedules( - JsonUtil.parseObjectArray(__advanceInvoiceSchedulesJson).stream() - .map(AdvanceInvoiceSchedule::fromJson) - .collect(java.util.stream.Collectors.toList())); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RetrieveAdvanceInvoiceScheduleForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RetrieveAdvanceInvoiceScheduleForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RetrieveAdvanceInvoiceScheduleForSubscriptionResponse. */ - public static class Builder { - - private List advanceInvoiceSchedules; - - private Response httpResponse; - - private Builder() {} - - public Builder advanceInvoiceSchedules(List advanceInvoiceSchedules) { - this.advanceInvoiceSchedules = advanceInvoiceSchedules; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RetrieveAdvanceInvoiceScheduleForSubscriptionResponse build() { - return new RetrieveAdvanceInvoiceScheduleForSubscriptionResponse(this); - } - } - - /** Get the advanceInvoiceSchedules from the response. */ - public List getAdvanceInvoiceSchedules() { - return advanceInvoiceSchedules; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/RetrieveWithScheduledChangesForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/RetrieveWithScheduledChangesForSubscriptionResponse.java deleted file mode 100644 index dc7f7b3d..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/RetrieveWithScheduledChangesForSubscriptionResponse.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RetrieveWithScheduledChangesForSubscription operation. Contains the - * response data from a single resource get operation. - */ -public final class RetrieveWithScheduledChangesForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private RetrieveWithScheduledChangesForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - } - - /** Parse JSON response into RetrieveWithScheduledChangesForSubscriptionResponse object. */ - public static RetrieveWithScheduledChangesForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into RetrieveWithScheduledChangesForSubscriptionResponse object with HTTP - * response. - */ - public static RetrieveWithScheduledChangesForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RetrieveWithScheduledChangesForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for RetrieveWithScheduledChangesForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RetrieveWithScheduledChangesForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RetrieveWithScheduledChangesForSubscriptionResponse build() { - return new RetrieveWithScheduledChangesForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionAddChargeAtTermEndResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionAddChargeAtTermEndResponse.java new file mode 100644 index 00000000..4fc17658 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionAddChargeAtTermEndResponse.java @@ -0,0 +1,79 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionAddChargeAtTermEnd operation. Contains the response + * data from the API. + */ +public final class SubscriptionAddChargeAtTermEndResponse extends BaseResponse { + private final Estimate estimate; + + private SubscriptionAddChargeAtTermEndResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into SubscriptionAddChargeAtTermEndResponse object. */ + public static SubscriptionAddChargeAtTermEndResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionAddChargeAtTermEndResponse object with HTTP response. */ + public static SubscriptionAddChargeAtTermEndResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionAddChargeAtTermEndResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionAddChargeAtTermEndResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionAddChargeAtTermEndResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionAddChargeAtTermEndResponse build() { + return new SubscriptionAddChargeAtTermEndResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCancelForItemsResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCancelForItemsResponse.java new file mode 100644 index 00000000..3ea020da --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCancelForItemsResponse.java @@ -0,0 +1,194 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionCancelForItems operation. Contains the response data + * from the API. + */ +public final class SubscriptionCancelForItemsResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private final List unbilledCharges; + + private final List creditNotes; + + private SubscriptionCancelForItemsResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + + this.unbilledCharges = builder.unbilledCharges; + + this.creditNotes = builder.creditNotes; + } + + /** Parse JSON response into SubscriptionCancelForItemsResponse object. */ + public static SubscriptionCancelForItemsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionCancelForItemsResponse object with HTTP response. */ + public static SubscriptionCancelForItemsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.creditNotes( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() + .map(CreditNote::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionCancelForItemsResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionCancelForItemsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionCancelForItemsResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private List unbilledCharges; + + private List creditNotes; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder creditNotes(List creditNotes) { + this.creditNotes = creditNotes; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionCancelForItemsResponse build() { + return new SubscriptionCancelForItemsResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } + + /** Get the creditNotes from the response. */ + public List getCreditNotes() { + return creditNotes; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCancelResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCancelResponse.java new file mode 100644 index 00000000..b63fa89a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCancelResponse.java @@ -0,0 +1,194 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionCancel operation. Contains the response data from the + * API. + */ +public final class SubscriptionCancelResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private final List unbilledCharges; + + private final List creditNotes; + + private SubscriptionCancelResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + + this.unbilledCharges = builder.unbilledCharges; + + this.creditNotes = builder.creditNotes; + } + + /** Parse JSON response into SubscriptionCancelResponse object. */ + public static SubscriptionCancelResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionCancelResponse object with HTTP response. */ + public static SubscriptionCancelResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.creditNotes( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() + .map(CreditNote::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionCancelResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionCancelResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionCancelResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private List unbilledCharges; + + private List creditNotes; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder creditNotes(List creditNotes) { + this.creditNotes = creditNotes; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionCancelResponse build() { + return new SubscriptionCancelResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } + + /** Get the creditNotes from the response. */ + public List getCreditNotes() { + return creditNotes; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionChangeTermEndResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionChangeTermEndResponse.java new file mode 100644 index 00000000..8d7efbf6 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionChangeTermEndResponse.java @@ -0,0 +1,194 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionChangeTermEnd operation. Contains the response data + * from the API. + */ +public final class SubscriptionChangeTermEndResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private final List unbilledCharges; + + private final List creditNotes; + + private SubscriptionChangeTermEndResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + + this.unbilledCharges = builder.unbilledCharges; + + this.creditNotes = builder.creditNotes; + } + + /** Parse JSON response into SubscriptionChangeTermEndResponse object. */ + public static SubscriptionChangeTermEndResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionChangeTermEndResponse object with HTTP response. */ + public static SubscriptionChangeTermEndResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.creditNotes( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() + .map(CreditNote::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionChangeTermEndResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionChangeTermEndResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionChangeTermEndResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private List unbilledCharges; + + private List creditNotes; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder creditNotes(List creditNotes) { + this.creditNotes = creditNotes; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionChangeTermEndResponse build() { + return new SubscriptionChangeTermEndResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } + + /** Get the creditNotes from the response. */ + public List getCreditNotes() { + return creditNotes; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionChargeAddonAtTermEndResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionChargeAddonAtTermEndResponse.java new file mode 100644 index 00000000..d690bf35 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionChargeAddonAtTermEndResponse.java @@ -0,0 +1,81 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.estimate.Estimate; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionChargeAddonAtTermEnd operation. Contains the response + * data from the API. + */ +public final class SubscriptionChargeAddonAtTermEndResponse extends BaseResponse { + private final Estimate estimate; + + private SubscriptionChargeAddonAtTermEndResponse(Builder builder) { + super(builder.httpResponse); + + this.estimate = builder.estimate; + } + + /** Parse JSON response into SubscriptionChargeAddonAtTermEndResponse object. */ + public static SubscriptionChargeAddonAtTermEndResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionChargeAddonAtTermEndResponse object with HTTP response. + */ + public static SubscriptionChargeAddonAtTermEndResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __estimateJson = JsonUtil.getObject(json, "estimate"); + if (__estimateJson != null) { + builder.estimate(Estimate.fromJson(__estimateJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionChargeAddonAtTermEndResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionChargeAddonAtTermEndResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionChargeAddonAtTermEndResponse. */ + public static class Builder { + + private Estimate estimate; + + private Response httpResponse; + + private Builder() {} + + public Builder estimate(Estimate estimate) { + this.estimate = estimate; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionChargeAddonAtTermEndResponse build() { + return new SubscriptionChargeAddonAtTermEndResponse(this); + } + } + + /** Get the estimate from the response. */ + public Estimate getEstimate() { + return estimate; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionChargeFutureRenewalsResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionChargeFutureRenewalsResponse.java new file mode 100644 index 00000000..8859c8e7 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionChargeFutureRenewalsResponse.java @@ -0,0 +1,175 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.advanceInvoiceSchedule.AdvanceInvoiceSchedule; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionChargeFutureRenewals operation. Contains the response + * data from the API. + */ +public final class SubscriptionChargeFutureRenewalsResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private final List advanceInvoiceSchedules; + + private SubscriptionChargeFutureRenewalsResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + + this.advanceInvoiceSchedules = builder.advanceInvoiceSchedules; + } + + /** Parse JSON response into SubscriptionChargeFutureRenewalsResponse object. */ + public static SubscriptionChargeFutureRenewalsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionChargeFutureRenewalsResponse object with HTTP response. + */ + public static SubscriptionChargeFutureRenewalsResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.advanceInvoiceSchedules( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "advance_invoice_schedules")).stream() + .map(AdvanceInvoiceSchedule::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionChargeFutureRenewalsResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionChargeFutureRenewalsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionChargeFutureRenewalsResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private List advanceInvoiceSchedules; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder advanceInvoiceSchedules(List advanceInvoiceSchedules) { + this.advanceInvoiceSchedules = advanceInvoiceSchedules; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionChargeFutureRenewalsResponse build() { + return new SubscriptionChargeFutureRenewalsResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the advanceInvoiceSchedules from the response. */ + public List getAdvanceInvoiceSchedules() { + return advanceInvoiceSchedules; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCreateForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCreateForCustomerResponse.java new file mode 100644 index 00000000..d71ad773 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCreateForCustomerResponse.java @@ -0,0 +1,172 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionCreateForCustomer operation. Contains the response data + * from the API. + */ +public final class SubscriptionCreateForCustomerResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private final List unbilledCharges; + + private SubscriptionCreateForCustomerResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + + this.unbilledCharges = builder.unbilledCharges; + } + + /** Parse JSON response into SubscriptionCreateForCustomerResponse object. */ + public static SubscriptionCreateForCustomerResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionCreateForCustomerResponse object with HTTP response. */ + public static SubscriptionCreateForCustomerResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionCreateForCustomerResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionCreateForCustomerResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionCreateForCustomerResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private List unbilledCharges; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionCreateForCustomerResponse build() { + return new SubscriptionCreateForCustomerResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCreateWithItemsResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCreateWithItemsResponse.java new file mode 100644 index 00000000..68514e08 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionCreateWithItemsResponse.java @@ -0,0 +1,172 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionCreateWithItems operation. Contains the response data + * from the API. + */ +public final class SubscriptionCreateWithItemsResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private final List unbilledCharges; + + private SubscriptionCreateWithItemsResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + + this.unbilledCharges = builder.unbilledCharges; + } + + /** Parse JSON response into SubscriptionCreateWithItemsResponse object. */ + public static SubscriptionCreateWithItemsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionCreateWithItemsResponse object with HTTP response. */ + public static SubscriptionCreateWithItemsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionCreateWithItemsResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionCreateWithItemsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionCreateWithItemsResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private List unbilledCharges; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionCreateWithItemsResponse build() { + return new SubscriptionCreateWithItemsResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionDeleteResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionDeleteResponse.java new file mode 100644 index 00000000..180a2fc3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionDeleteResponse.java @@ -0,0 +1,123 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionDelete operation. Contains the response data from the + * API. + */ +public final class SubscriptionDeleteResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private SubscriptionDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into SubscriptionDeleteResponse object. */ + public static SubscriptionDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionDeleteResponse object with HTTP response. */ + public static SubscriptionDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionDeleteResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionDeleteResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionDeleteResponse build() { + return new SubscriptionDeleteResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionEditAdvanceInvoiceScheduleResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionEditAdvanceInvoiceScheduleResponse.java new file mode 100644 index 00000000..6790cc41 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionEditAdvanceInvoiceScheduleResponse.java @@ -0,0 +1,84 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.advanceInvoiceSchedule.AdvanceInvoiceSchedule; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionEditAdvanceInvoiceSchedule operation. Contains the + * response data from the API. + */ +public final class SubscriptionEditAdvanceInvoiceScheduleResponse extends BaseResponse { + private final List advanceInvoiceSchedules; + + private SubscriptionEditAdvanceInvoiceScheduleResponse(Builder builder) { + super(builder.httpResponse); + + this.advanceInvoiceSchedules = builder.advanceInvoiceSchedules; + } + + /** Parse JSON response into SubscriptionEditAdvanceInvoiceScheduleResponse object. */ + public static SubscriptionEditAdvanceInvoiceScheduleResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionEditAdvanceInvoiceScheduleResponse object with HTTP + * response. + */ + public static SubscriptionEditAdvanceInvoiceScheduleResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.advanceInvoiceSchedules( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "advance_invoice_schedules")).stream() + .map(AdvanceInvoiceSchedule::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionEditAdvanceInvoiceScheduleResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionEditAdvanceInvoiceScheduleResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionEditAdvanceInvoiceScheduleResponse. */ + public static class Builder { + + private List advanceInvoiceSchedules; + + private Response httpResponse; + + private Builder() {} + + public Builder advanceInvoiceSchedules(List advanceInvoiceSchedules) { + this.advanceInvoiceSchedules = advanceInvoiceSchedules; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionEditAdvanceInvoiceScheduleResponse build() { + return new SubscriptionEditAdvanceInvoiceScheduleResponse(this); + } + } + + /** Get the advanceInvoiceSchedules from the response. */ + public List getAdvanceInvoiceSchedules() { + return advanceInvoiceSchedules; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionForItemsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionForItemsForCustomerResponse.java deleted file mode 100644 index e7798997..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionForItemsForCustomerResponse.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for SubscriptionForItemsForCustomer operation. Contains the response - * data from the API. - */ -public final class SubscriptionForItemsForCustomerResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private final List unbilledCharges; - - private SubscriptionForItemsForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - - this.unbilledCharges = builder.unbilledCharges; - } - - /** Parse JSON response into SubscriptionForItemsForCustomerResponse object. */ - public static SubscriptionForItemsForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into SubscriptionForItemsForCustomerResponse object with HTTP response. */ - public static SubscriptionForItemsForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse SubscriptionForItemsForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for SubscriptionForItemsForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for SubscriptionForItemsForCustomerResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private List unbilledCharges; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public SubscriptionForItemsForCustomerResponse build() { - return new SubscriptionForItemsForCustomerResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportContractTermResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportContractTermResponse.java new file mode 100644 index 00000000..aa0a33ff --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportContractTermResponse.java @@ -0,0 +1,79 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.contractTerm.ContractTerm; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionImportContractTerm operation. Contains the response + * data from the API. + */ +public final class SubscriptionImportContractTermResponse extends BaseResponse { + private final ContractTerm contractTerm; + + private SubscriptionImportContractTermResponse(Builder builder) { + super(builder.httpResponse); + + this.contractTerm = builder.contractTerm; + } + + /** Parse JSON response into SubscriptionImportContractTermResponse object. */ + public static SubscriptionImportContractTermResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionImportContractTermResponse object with HTTP response. */ + public static SubscriptionImportContractTermResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __contractTermJson = JsonUtil.getObject(json, "contract_term"); + if (__contractTermJson != null) { + builder.contractTerm(ContractTerm.fromJson(__contractTermJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionImportContractTermResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionImportContractTermResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionImportContractTermResponse. */ + public static class Builder { + + private ContractTerm contractTerm; + + private Response httpResponse; + + private Builder() {} + + public Builder contractTerm(ContractTerm contractTerm) { + this.contractTerm = contractTerm; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionImportContractTermResponse build() { + return new SubscriptionImportContractTermResponse(this); + } + } + + /** Get the contractTerm from the response. */ + public ContractTerm getContractTerm() { + return contractTerm; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportForCustomerResponse.java new file mode 100644 index 00000000..525b2eb8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportForCustomerResponse.java @@ -0,0 +1,147 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionImportForCustomer operation. Contains the response data + * from the API. + */ +public final class SubscriptionImportForCustomerResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private SubscriptionImportForCustomerResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + } + + /** Parse JSON response into SubscriptionImportForCustomerResponse object. */ + public static SubscriptionImportForCustomerResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionImportForCustomerResponse object with HTTP response. */ + public static SubscriptionImportForCustomerResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionImportForCustomerResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionImportForCustomerResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionImportForCustomerResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionImportForCustomerResponse build() { + return new SubscriptionImportForCustomerResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportForItemsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportForItemsForCustomerResponse.java deleted file mode 100644 index 2c7250b3..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportForItemsForCustomerResponse.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for SubscriptionImportForItemsForCustomer operation. Contains the - * response data from the API. - */ -public final class SubscriptionImportForItemsForCustomerResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private SubscriptionImportForItemsForCustomerResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - } - - /** Parse JSON response into SubscriptionImportForItemsForCustomerResponse object. */ - public static SubscriptionImportForItemsForCustomerResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into SubscriptionImportForItemsForCustomerResponse object with HTTP - * response. - */ - public static SubscriptionImportForItemsForCustomerResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse SubscriptionImportForItemsForCustomerResponse from JSON", e); - } - } - - /** Create a new builder for SubscriptionImportForItemsForCustomerResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for SubscriptionImportForItemsForCustomerResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public SubscriptionImportForItemsForCustomerResponse build() { - return new SubscriptionImportForItemsForCustomerResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportForItemsResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportForItemsResponse.java new file mode 100644 index 00000000..88874408 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportForItemsResponse.java @@ -0,0 +1,146 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionImportForItems operation. Contains the response data + * from the API. + */ +public final class SubscriptionImportForItemsResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private SubscriptionImportForItemsResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + } + + /** Parse JSON response into SubscriptionImportForItemsResponse object. */ + public static SubscriptionImportForItemsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionImportForItemsResponse object with HTTP response. */ + public static SubscriptionImportForItemsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionImportForItemsResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionImportForItemsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionImportForItemsResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionImportForItemsResponse build() { + return new SubscriptionImportForItemsResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportUnbilledChargesResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportUnbilledChargesResponse.java new file mode 100644 index 00000000..4fb02239 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionImportUnbilledChargesResponse.java @@ -0,0 +1,83 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionImportUnbilledCharges operation. Contains the response + * data from the API. + */ +public final class SubscriptionImportUnbilledChargesResponse extends BaseResponse { + private final List unbilledCharges; + + private SubscriptionImportUnbilledChargesResponse(Builder builder) { + super(builder.httpResponse); + + this.unbilledCharges = builder.unbilledCharges; + } + + /** Parse JSON response into SubscriptionImportUnbilledChargesResponse object. */ + public static SubscriptionImportUnbilledChargesResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionImportUnbilledChargesResponse object with HTTP response. + */ + public static SubscriptionImportUnbilledChargesResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionImportUnbilledChargesResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionImportUnbilledChargesResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionImportUnbilledChargesResponse. */ + public static class Builder { + + private List unbilledCharges; + + private Response httpResponse; + + private Builder() {} + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionImportUnbilledChargesResponse build() { + return new SubscriptionImportUnbilledChargesResponse(this); + } + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionListDiscountsResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionListDiscountsResponse.java new file mode 100644 index 00000000..964d691b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionListDiscountsResponse.java @@ -0,0 +1,176 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.discount.Discount; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.SubscriptionService; +import com.chargebee.v4.models.subscription.params.SubscriptionListDiscountsParams; + +/** + * Immutable response object for SubscriptionListDiscounts operation. Contains paginated list data. + */ +public final class SubscriptionListDiscountsResponse { + + private final List list; + + private final String nextOffset; + + private final String subscriptionId; + + private final SubscriptionService service; + private final SubscriptionListDiscountsParams originalParams; + private final Response httpResponse; + + private SubscriptionListDiscountsResponse( + List list, + String nextOffset, + String subscriptionId, + SubscriptionService service, + SubscriptionListDiscountsParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.subscriptionId = subscriptionId; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into SubscriptionListDiscountsResponse object (no service context). Use + * this when you only need to read a single page (no nextPage()). + */ + public static SubscriptionListDiscountsResponse fromJson(String json) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(SubscriptionListDiscountsItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new SubscriptionListDiscountsResponse(list, nextOffset, null, null, null, null); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionListDiscountsResponse from JSON", e); + } + } + + /** + * Parse JSON response into SubscriptionListDiscountsResponse object with service context for + * pagination (enables nextPage()). + */ + public static SubscriptionListDiscountsResponse fromJson( + String json, + SubscriptionService service, + SubscriptionListDiscountsParams originalParams, + String subscriptionId, + Response httpResponse) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(SubscriptionListDiscountsItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new SubscriptionListDiscountsResponse( + list, nextOffset, subscriptionId, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionListDiscountsResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public SubscriptionListDiscountsResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + SubscriptionListDiscountsParams nextParams = + (originalParams != null + ? originalParams.toBuilder() + : SubscriptionListDiscountsParams.builder()) + .offset(nextOffset) + .build(); + + return service.listDiscounts(subscriptionId, nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + public static class SubscriptionListDiscountsItem { + + private Discount discount; + + public Discount getDiscount() { + return discount; + } + + public static SubscriptionListDiscountsItem fromJson(String json) { + SubscriptionListDiscountsItem item = new SubscriptionListDiscountsItem(); + + String __discountJson = JsonUtil.getObject(json, "discount"); + if (__discountJson != null) { + item.discount = Discount.fromJson(__discountJson); + } + + return item; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionListResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionListResponse.java index e5f8129e..acd5e968 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionListResponse.java +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionListResponse.java @@ -8,6 +8,7 @@ import com.chargebee.v4.models.card.Card; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.SubscriptionService; @@ -102,9 +103,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public SubscriptionListResponse nextPage() throws Exception { + public SubscriptionListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionMoveResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionMoveResponse.java new file mode 100644 index 00000000..c9eccee0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionMoveResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionMove operation. Contains the response data from the + * API. + */ +public final class SubscriptionMoveResponse extends BaseResponse { + private final Subscription subscription; + + private SubscriptionMoveResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + } + + /** Parse JSON response into SubscriptionMoveResponse object. */ + public static SubscriptionMoveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionMoveResponse object with HTTP response. */ + public static SubscriptionMoveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionMoveResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionMoveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionMoveResponse. */ + public static class Builder { + + private Subscription subscription; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionMoveResponse build() { + return new SubscriptionMoveResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionOverrideBillingProfileResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionOverrideBillingProfileResponse.java new file mode 100644 index 00000000..09b7ed93 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionOverrideBillingProfileResponse.java @@ -0,0 +1,104 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.paymentSource.PaymentSource; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionOverrideBillingProfile operation. Contains the response + * data from the API. + */ +public final class SubscriptionOverrideBillingProfileResponse extends BaseResponse { + private final Subscription subscription; + + private final PaymentSource paymentSource; + + private SubscriptionOverrideBillingProfileResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.paymentSource = builder.paymentSource; + } + + /** Parse JSON response into SubscriptionOverrideBillingProfileResponse object. */ + public static SubscriptionOverrideBillingProfileResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionOverrideBillingProfileResponse object with HTTP response. + */ + public static SubscriptionOverrideBillingProfileResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __paymentSourceJson = JsonUtil.getObject(json, "payment_source"); + if (__paymentSourceJson != null) { + builder.paymentSource(PaymentSource.fromJson(__paymentSourceJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionOverrideBillingProfileResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionOverrideBillingProfileResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionOverrideBillingProfileResponse. */ + public static class Builder { + + private Subscription subscription; + + private PaymentSource paymentSource; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder paymentSource(PaymentSource paymentSource) { + this.paymentSource = paymentSource; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionOverrideBillingProfileResponse build() { + return new SubscriptionOverrideBillingProfileResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the paymentSource from the response. */ + public PaymentSource getPaymentSource() { + return paymentSource; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionPauseResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionPauseResponse.java new file mode 100644 index 00000000..f60bc792 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionPauseResponse.java @@ -0,0 +1,194 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionPause operation. Contains the response data from the + * API. + */ +public final class SubscriptionPauseResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private final List unbilledCharges; + + private final List creditNotes; + + private SubscriptionPauseResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + + this.unbilledCharges = builder.unbilledCharges; + + this.creditNotes = builder.creditNotes; + } + + /** Parse JSON response into SubscriptionPauseResponse object. */ + public static SubscriptionPauseResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionPauseResponse object with HTTP response. */ + public static SubscriptionPauseResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.creditNotes( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() + .map(CreditNote::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionPauseResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionPauseResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionPauseResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private List unbilledCharges; + + private List creditNotes; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder creditNotes(List creditNotes) { + this.creditNotes = creditNotes; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionPauseResponse build() { + return new SubscriptionPauseResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } + + /** Get the creditNotes from the response. */ + public List getCreditNotes() { + return creditNotes; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionReactivateResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionReactivateResponse.java new file mode 100644 index 00000000..c036573b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionReactivateResponse.java @@ -0,0 +1,171 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionReactivate operation. Contains the response data from + * the API. + */ +public final class SubscriptionReactivateResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private final List unbilledCharges; + + private SubscriptionReactivateResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + + this.unbilledCharges = builder.unbilledCharges; + } + + /** Parse JSON response into SubscriptionReactivateResponse object. */ + public static SubscriptionReactivateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionReactivateResponse object with HTTP response. */ + public static SubscriptionReactivateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionReactivateResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionReactivateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionReactivateResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private List unbilledCharges; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionReactivateResponse build() { + return new SubscriptionReactivateResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRegenerateInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRegenerateInvoiceResponse.java new file mode 100644 index 00000000..0394c59e --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRegenerateInvoiceResponse.java @@ -0,0 +1,103 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionRegenerateInvoice operation. Contains the response data + * from the API. + */ +public final class SubscriptionRegenerateInvoiceResponse extends BaseResponse { + private final Invoice invoice; + + private final List unbilledCharges; + + private SubscriptionRegenerateInvoiceResponse(Builder builder) { + super(builder.httpResponse); + + this.invoice = builder.invoice; + + this.unbilledCharges = builder.unbilledCharges; + } + + /** Parse JSON response into SubscriptionRegenerateInvoiceResponse object. */ + public static SubscriptionRegenerateInvoiceResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionRegenerateInvoiceResponse object with HTTP response. */ + public static SubscriptionRegenerateInvoiceResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionRegenerateInvoiceResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionRegenerateInvoiceResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionRegenerateInvoiceResponse. */ + public static class Builder { + + private Invoice invoice; + + private List unbilledCharges; + + private Response httpResponse; + + private Builder() {} + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionRegenerateInvoiceResponse build() { + return new SubscriptionRegenerateInvoiceResponse(this); + } + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveAdvanceInvoiceScheduleResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveAdvanceInvoiceScheduleResponse.java new file mode 100644 index 00000000..f13dbdae --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveAdvanceInvoiceScheduleResponse.java @@ -0,0 +1,107 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.advanceInvoiceSchedule.AdvanceInvoiceSchedule; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionRemoveAdvanceInvoiceSchedule operation. Contains the + * response data from the API. + */ +public final class SubscriptionRemoveAdvanceInvoiceScheduleResponse extends BaseResponse { + private final Subscription subscription; + + private final List advanceInvoiceSchedules; + + private SubscriptionRemoveAdvanceInvoiceScheduleResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.advanceInvoiceSchedules = builder.advanceInvoiceSchedules; + } + + /** Parse JSON response into SubscriptionRemoveAdvanceInvoiceScheduleResponse object. */ + public static SubscriptionRemoveAdvanceInvoiceScheduleResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionRemoveAdvanceInvoiceScheduleResponse object with HTTP + * response. + */ + public static SubscriptionRemoveAdvanceInvoiceScheduleResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + builder.advanceInvoiceSchedules( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "advance_invoice_schedules")).stream() + .map(AdvanceInvoiceSchedule::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionRemoveAdvanceInvoiceScheduleResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionRemoveAdvanceInvoiceScheduleResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionRemoveAdvanceInvoiceScheduleResponse. */ + public static class Builder { + + private Subscription subscription; + + private List advanceInvoiceSchedules; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder advanceInvoiceSchedules(List advanceInvoiceSchedules) { + this.advanceInvoiceSchedules = advanceInvoiceSchedules; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionRemoveAdvanceInvoiceScheduleResponse build() { + return new SubscriptionRemoveAdvanceInvoiceScheduleResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the advanceInvoiceSchedules from the response. */ + public List getAdvanceInvoiceSchedules() { + return advanceInvoiceSchedules; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveCouponsResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveCouponsResponse.java new file mode 100644 index 00000000..bb694d5c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveCouponsResponse.java @@ -0,0 +1,123 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionRemoveCoupons operation. Contains the response data + * from the API. + */ +public final class SubscriptionRemoveCouponsResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private SubscriptionRemoveCouponsResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into SubscriptionRemoveCouponsResponse object. */ + public static SubscriptionRemoveCouponsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionRemoveCouponsResponse object with HTTP response. */ + public static SubscriptionRemoveCouponsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionRemoveCouponsResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionRemoveCouponsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionRemoveCouponsResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionRemoveCouponsResponse build() { + return new SubscriptionRemoveCouponsResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledCancellationResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledCancellationResponse.java new file mode 100644 index 00000000..1d806b52 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledCancellationResponse.java @@ -0,0 +1,128 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionRemoveScheduledCancellation operation. Contains the + * response data from the API. + */ +public final class SubscriptionRemoveScheduledCancellationResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private SubscriptionRemoveScheduledCancellationResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into SubscriptionRemoveScheduledCancellationResponse object. */ + public static SubscriptionRemoveScheduledCancellationResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionRemoveScheduledCancellationResponse object with HTTP + * response. + */ + public static SubscriptionRemoveScheduledCancellationResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionRemoveScheduledCancellationResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionRemoveScheduledCancellationResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionRemoveScheduledCancellationResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionRemoveScheduledCancellationResponse build() { + return new SubscriptionRemoveScheduledCancellationResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledChangesResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledChangesResponse.java new file mode 100644 index 00000000..ad5a4b91 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledChangesResponse.java @@ -0,0 +1,152 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionRemoveScheduledChanges operation. Contains the response + * data from the API. + */ +public final class SubscriptionRemoveScheduledChangesResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final List creditNotes; + + private SubscriptionRemoveScheduledChangesResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.creditNotes = builder.creditNotes; + } + + /** Parse JSON response into SubscriptionRemoveScheduledChangesResponse object. */ + public static SubscriptionRemoveScheduledChangesResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionRemoveScheduledChangesResponse object with HTTP response. + */ + public static SubscriptionRemoveScheduledChangesResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.creditNotes( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() + .map(CreditNote::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionRemoveScheduledChangesResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionRemoveScheduledChangesResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionRemoveScheduledChangesResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private List creditNotes; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder creditNotes(List creditNotes) { + this.creditNotes = creditNotes; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionRemoveScheduledChangesResponse build() { + return new SubscriptionRemoveScheduledChangesResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the creditNotes from the response. */ + public List getCreditNotes() { + return creditNotes; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledPauseResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledPauseResponse.java new file mode 100644 index 00000000..5f262bd3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledPauseResponse.java @@ -0,0 +1,127 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionRemoveScheduledPause operation. Contains the response + * data from the API. + */ +public final class SubscriptionRemoveScheduledPauseResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private SubscriptionRemoveScheduledPauseResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into SubscriptionRemoveScheduledPauseResponse object. */ + public static SubscriptionRemoveScheduledPauseResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionRemoveScheduledPauseResponse object with HTTP response. + */ + public static SubscriptionRemoveScheduledPauseResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionRemoveScheduledPauseResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionRemoveScheduledPauseResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionRemoveScheduledPauseResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionRemoveScheduledPauseResponse build() { + return new SubscriptionRemoveScheduledPauseResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledResumptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledResumptionResponse.java new file mode 100644 index 00000000..2140194c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRemoveScheduledResumptionResponse.java @@ -0,0 +1,128 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionRemoveScheduledResumption operation. Contains the + * response data from the API. + */ +public final class SubscriptionRemoveScheduledResumptionResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private SubscriptionRemoveScheduledResumptionResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into SubscriptionRemoveScheduledResumptionResponse object. */ + public static SubscriptionRemoveScheduledResumptionResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionRemoveScheduledResumptionResponse object with HTTP + * response. + */ + public static SubscriptionRemoveScheduledResumptionResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionRemoveScheduledResumptionResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionRemoveScheduledResumptionResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionRemoveScheduledResumptionResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionRemoveScheduledResumptionResponse build() { + return new SubscriptionRemoveScheduledResumptionResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionResumeResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionResumeResponse.java new file mode 100644 index 00000000..510efb76 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionResumeResponse.java @@ -0,0 +1,171 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionResume operation. Contains the response data from the + * API. + */ +public final class SubscriptionResumeResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private final List unbilledCharges; + + private SubscriptionResumeResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + + this.unbilledCharges = builder.unbilledCharges; + } + + /** Parse JSON response into SubscriptionResumeResponse object. */ + public static SubscriptionResumeResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionResumeResponse object with HTTP response. */ + public static SubscriptionResumeResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionResumeResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionResumeResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionResumeResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private List unbilledCharges; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionResumeResponse build() { + return new SubscriptionResumeResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRetrieveAdvanceInvoiceScheduleResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRetrieveAdvanceInvoiceScheduleResponse.java new file mode 100644 index 00000000..ba3dae96 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRetrieveAdvanceInvoiceScheduleResponse.java @@ -0,0 +1,86 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.advanceInvoiceSchedule.AdvanceInvoiceSchedule; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import java.util.List; + +/** + * Immutable response object for SubscriptionRetrieveAdvanceInvoiceSchedule operation. Contains the + * response data from a single resource get operation. + */ +public final class SubscriptionRetrieveAdvanceInvoiceScheduleResponse extends BaseResponse { + private final List advanceInvoiceSchedules; + + private SubscriptionRetrieveAdvanceInvoiceScheduleResponse(Builder builder) { + super(builder.httpResponse); + + this.advanceInvoiceSchedules = builder.advanceInvoiceSchedules; + } + + /** Parse JSON response into SubscriptionRetrieveAdvanceInvoiceScheduleResponse object. */ + public static SubscriptionRetrieveAdvanceInvoiceScheduleResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionRetrieveAdvanceInvoiceScheduleResponse object with HTTP + * response. + */ + public static SubscriptionRetrieveAdvanceInvoiceScheduleResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __advanceInvoiceSchedulesJson = JsonUtil.getArray(json, "advance_invoice_schedules"); + if (__advanceInvoiceSchedulesJson != null) { + builder.advanceInvoiceSchedules( + JsonUtil.parseObjectArray(__advanceInvoiceSchedulesJson).stream() + .map(AdvanceInvoiceSchedule::fromJson) + .collect(java.util.stream.Collectors.toList())); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionRetrieveAdvanceInvoiceScheduleResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionRetrieveAdvanceInvoiceScheduleResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionRetrieveAdvanceInvoiceScheduleResponse. */ + public static class Builder { + + private List advanceInvoiceSchedules; + + private Response httpResponse; + + private Builder() {} + + public Builder advanceInvoiceSchedules(List advanceInvoiceSchedules) { + this.advanceInvoiceSchedules = advanceInvoiceSchedules; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionRetrieveAdvanceInvoiceScheduleResponse build() { + return new SubscriptionRetrieveAdvanceInvoiceScheduleResponse(this); + } + } + + /** Get the advanceInvoiceSchedules from the response. */ + public List getAdvanceInvoiceSchedules() { + return advanceInvoiceSchedules; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRetrieveWithScheduledChangesResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRetrieveWithScheduledChangesResponse.java new file mode 100644 index 00000000..cd14db3e --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionRetrieveWithScheduledChangesResponse.java @@ -0,0 +1,128 @@ +package com.chargebee.v4.models.subscription.responses; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionRetrieveWithScheduledChanges operation. Contains the + * response data from a single resource get operation. + */ +public final class SubscriptionRetrieveWithScheduledChangesResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private SubscriptionRetrieveWithScheduledChangesResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + } + + /** Parse JSON response into SubscriptionRetrieveWithScheduledChangesResponse object. */ + public static SubscriptionRetrieveWithScheduledChangesResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SubscriptionRetrieveWithScheduledChangesResponse object with HTTP + * response. + */ + public static SubscriptionRetrieveWithScheduledChangesResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionRetrieveWithScheduledChangesResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionRetrieveWithScheduledChangesResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionRetrieveWithScheduledChangesResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionRetrieveWithScheduledChangesResponse build() { + return new SubscriptionRetrieveWithScheduledChangesResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionUpdateForItemsResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionUpdateForItemsResponse.java new file mode 100644 index 00000000..97a8b849 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionUpdateForItemsResponse.java @@ -0,0 +1,194 @@ +package com.chargebee.v4.models.subscription.responses; + +import java.util.List; + +import com.chargebee.v4.models.invoice.Invoice; + +import com.chargebee.v4.models.customer.Customer; + +import com.chargebee.v4.models.creditNote.CreditNote; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.subscription.Subscription; + +import com.chargebee.v4.models.card.Card; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionUpdateForItems operation. Contains the response data + * from the API. + */ +public final class SubscriptionUpdateForItemsResponse extends BaseResponse { + private final Subscription subscription; + + private final Customer customer; + + private final Card card; + + private final Invoice invoice; + + private final List unbilledCharges; + + private final List creditNotes; + + private SubscriptionUpdateForItemsResponse(Builder builder) { + super(builder.httpResponse); + + this.subscription = builder.subscription; + + this.customer = builder.customer; + + this.card = builder.card; + + this.invoice = builder.invoice; + + this.unbilledCharges = builder.unbilledCharges; + + this.creditNotes = builder.creditNotes; + } + + /** Parse JSON response into SubscriptionUpdateForItemsResponse object. */ + public static SubscriptionUpdateForItemsResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionUpdateForItemsResponse object with HTTP response. */ + public static SubscriptionUpdateForItemsResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __subscriptionJson = JsonUtil.getObject(json, "subscription"); + if (__subscriptionJson != null) { + builder.subscription(Subscription.fromJson(__subscriptionJson)); + } + + String __customerJson = JsonUtil.getObject(json, "customer"); + if (__customerJson != null) { + builder.customer(Customer.fromJson(__customerJson)); + } + + String __cardJson = JsonUtil.getObject(json, "card"); + if (__cardJson != null) { + builder.card(Card.fromJson(__cardJson)); + } + + String __invoiceJson = JsonUtil.getObject(json, "invoice"); + if (__invoiceJson != null) { + builder.invoice(Invoice.fromJson(__invoiceJson)); + } + + builder.unbilledCharges( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() + .map(UnbilledCharge::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.creditNotes( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() + .map(CreditNote::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SubscriptionUpdateForItemsResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionUpdateForItemsResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionUpdateForItemsResponse. */ + public static class Builder { + + private Subscription subscription; + + private Customer customer; + + private Card card; + + private Invoice invoice; + + private List unbilledCharges; + + private List creditNotes; + + private Response httpResponse; + + private Builder() {} + + public Builder subscription(Subscription subscription) { + this.subscription = subscription; + return this; + } + + public Builder customer(Customer customer) { + this.customer = customer; + return this; + } + + public Builder card(Card card) { + this.card = card; + return this; + } + + public Builder invoice(Invoice invoice) { + this.invoice = invoice; + return this; + } + + public Builder unbilledCharges(List unbilledCharges) { + this.unbilledCharges = unbilledCharges; + return this; + } + + public Builder creditNotes(List creditNotes) { + this.creditNotes = creditNotes; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionUpdateForItemsResponse build() { + return new SubscriptionUpdateForItemsResponse(this); + } + } + + /** Get the subscription from the response. */ + public Subscription getSubscription() { + return subscription; + } + + /** Get the customer from the response. */ + public Customer getCustomer() { + return customer; + } + + /** Get the card from the response. */ + public Card getCard() { + return card; + } + + /** Get the invoice from the response. */ + public Invoice getInvoice() { + return invoice; + } + + /** Get the unbilledCharges from the response. */ + public List getUnbilledCharges() { + return unbilledCharges; + } + + /** Get the creditNotes from the response. */ + public List getCreditNotes() { + return creditNotes; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionsForCustomerResponse.java index dabbdc9a..6c0d27c1 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionsForCustomerResponse.java +++ b/src/main/java/com/chargebee/v4/models/subscription/responses/SubscriptionsForCustomerResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.subscription.Subscription; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.SubscriptionService; @@ -107,9 +108,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public SubscriptionsForCustomerResponse nextPage() throws Exception { + public SubscriptionsForCustomerResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/subscription/responses/UpdateForItemsForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscription/responses/UpdateForItemsForSubscriptionResponse.java deleted file mode 100644 index 644d1298..00000000 --- a/src/main/java/com/chargebee/v4/models/subscription/responses/UpdateForItemsForSubscriptionResponse.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.chargebee.v4.models.subscription.responses; - -import java.util.List; - -import com.chargebee.v4.models.invoice.Invoice; - -import com.chargebee.v4.models.customer.Customer; - -import com.chargebee.v4.models.creditNote.CreditNote; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.subscription.Subscription; - -import com.chargebee.v4.models.card.Card; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UpdateForItemsForSubscription operation. Contains the response data - * from the API. - */ -public final class UpdateForItemsForSubscriptionResponse extends BaseResponse { - private final Subscription subscription; - - private final Customer customer; - - private final Card card; - - private final Invoice invoice; - - private final List unbilledCharges; - - private final List creditNotes; - - private UpdateForItemsForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.subscription = builder.subscription; - - this.customer = builder.customer; - - this.card = builder.card; - - this.invoice = builder.invoice; - - this.unbilledCharges = builder.unbilledCharges; - - this.creditNotes = builder.creditNotes; - } - - /** Parse JSON response into UpdateForItemsForSubscriptionResponse object. */ - public static UpdateForItemsForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UpdateForItemsForSubscriptionResponse object with HTTP response. */ - public static UpdateForItemsForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __subscriptionJson = JsonUtil.getObject(json, "subscription"); - if (__subscriptionJson != null) { - builder.subscription(Subscription.fromJson(__subscriptionJson)); - } - - String __customerJson = JsonUtil.getObject(json, "customer"); - if (__customerJson != null) { - builder.customer(Customer.fromJson(__customerJson)); - } - - String __cardJson = JsonUtil.getObject(json, "card"); - if (__cardJson != null) { - builder.card(Card.fromJson(__cardJson)); - } - - String __invoiceJson = JsonUtil.getObject(json, "invoice"); - if (__invoiceJson != null) { - builder.invoice(Invoice.fromJson(__invoiceJson)); - } - - builder.unbilledCharges( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "unbilled_charges")).stream() - .map(UnbilledCharge::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.creditNotes( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "credit_notes")).stream() - .map(CreditNote::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse UpdateForItemsForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for UpdateForItemsForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UpdateForItemsForSubscriptionResponse. */ - public static class Builder { - - private Subscription subscription; - - private Customer customer; - - private Card card; - - private Invoice invoice; - - private List unbilledCharges; - - private List creditNotes; - - private Response httpResponse; - - private Builder() {} - - public Builder subscription(Subscription subscription) { - this.subscription = subscription; - return this; - } - - public Builder customer(Customer customer) { - this.customer = customer; - return this; - } - - public Builder card(Card card) { - this.card = card; - return this; - } - - public Builder invoice(Invoice invoice) { - this.invoice = invoice; - return this; - } - - public Builder unbilledCharges(List unbilledCharges) { - this.unbilledCharges = unbilledCharges; - return this; - } - - public Builder creditNotes(List creditNotes) { - this.creditNotes = creditNotes; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UpdateForItemsForSubscriptionResponse build() { - return new UpdateForItemsForSubscriptionResponse(this); - } - } - - /** Get the subscription from the response. */ - public Subscription getSubscription() { - return subscription; - } - - /** Get the customer from the response. */ - public Customer getCustomer() { - return customer; - } - - /** Get the card from the response. */ - public Card getCard() { - return card; - } - - /** Get the invoice from the response. */ - public Invoice getInvoice() { - return invoice; - } - - /** Get the unbilledCharges from the response. */ - public List getUnbilledCharges() { - return unbilledCharges; - } - - /** Get the creditNotes from the response. */ - public List getCreditNotes() { - return creditNotes; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/params/SetSubscriptionEntitlementAvailabilityParams.java b/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/params/SetSubscriptionEntitlementAvailabilityParams.java new file mode 100644 index 00000000..fbc2bb82 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/params/SetSubscriptionEntitlementAvailabilityParams.java @@ -0,0 +1,141 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.subscriptionEntitlement.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class SetSubscriptionEntitlementAvailabilityParams { + + private final Boolean isEnabled; + + private final List subscriptionEntitlements; + + private SetSubscriptionEntitlementAvailabilityParams( + SetSubscriptionEntitlementAvailabilityBuilder builder) { + + this.isEnabled = builder.isEnabled; + + this.subscriptionEntitlements = builder.subscriptionEntitlements; + } + + public Boolean getIsEnabled() { + return isEnabled; + } + + public List getSubscriptionEntitlements() { + return subscriptionEntitlements; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.isEnabled != null) { + + formData.put("is_enabled", this.isEnabled); + } + + if (this.subscriptionEntitlements != null) { + + // List of objects + for (int i = 0; i < this.subscriptionEntitlements.size(); i++) { + SubscriptionEntitlementsParams item = this.subscriptionEntitlements.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "subscription_entitlements[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for SetSubscriptionEntitlementAvailabilityParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SetSubscriptionEntitlementAvailabilityBuilder builder() { + return new SetSubscriptionEntitlementAvailabilityBuilder(); + } + + public static final class SetSubscriptionEntitlementAvailabilityBuilder { + + private Boolean isEnabled; + + private List subscriptionEntitlements; + + private SetSubscriptionEntitlementAvailabilityBuilder() {} + + public SetSubscriptionEntitlementAvailabilityBuilder isEnabled(Boolean value) { + this.isEnabled = value; + return this; + } + + public SetSubscriptionEntitlementAvailabilityBuilder subscriptionEntitlements( + List value) { + this.subscriptionEntitlements = value; + return this; + } + + public SetSubscriptionEntitlementAvailabilityParams build() { + return new SetSubscriptionEntitlementAvailabilityParams(this); + } + } + + public static final class SubscriptionEntitlementsParams { + + private final String featureId; + + private SubscriptionEntitlementsParams(SubscriptionEntitlementsBuilder builder) { + + this.featureId = builder.featureId; + } + + public String getFeatureId() { + return featureId; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.featureId != null) { + + formData.put("feature_id", this.featureId); + } + + return formData; + } + + /** Create a new builder for SubscriptionEntitlementsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionEntitlementsBuilder builder() { + return new SubscriptionEntitlementsBuilder(); + } + + public static final class SubscriptionEntitlementsBuilder { + + private String featureId; + + private SubscriptionEntitlementsBuilder() {} + + public SubscriptionEntitlementsBuilder featureId(String value) { + this.featureId = value; + return this; + } + + public SubscriptionEntitlementsParams build() { + return new SubscriptionEntitlementsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/params/SubscriptionEntitlementsSetAvailabilityForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/params/SubscriptionEntitlementsSetAvailabilityForSubscriptionParams.java deleted file mode 100644 index 6a2bb5cd..00000000 --- a/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/params/SubscriptionEntitlementsSetAvailabilityForSubscriptionParams.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.subscriptionEntitlement.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class SubscriptionEntitlementsSetAvailabilityForSubscriptionParams { - - private final Boolean isEnabled; - - private final List subscriptionEntitlements; - - private SubscriptionEntitlementsSetAvailabilityForSubscriptionParams( - SubscriptionEntitlementsSetAvailabilityForSubscriptionBuilder builder) { - - this.isEnabled = builder.isEnabled; - - this.subscriptionEntitlements = builder.subscriptionEntitlements; - } - - public Boolean getIsEnabled() { - return isEnabled; - } - - public List getSubscriptionEntitlements() { - return subscriptionEntitlements; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.isEnabled != null) { - - formData.put("is_enabled", this.isEnabled); - } - - if (this.subscriptionEntitlements != null) { - - // List of objects - for (int i = 0; i < this.subscriptionEntitlements.size(); i++) { - SubscriptionEntitlementsParams item = this.subscriptionEntitlements.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "subscription_entitlements[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for SubscriptionEntitlementsSetAvailabilityForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionEntitlementsSetAvailabilityForSubscriptionBuilder builder() { - return new SubscriptionEntitlementsSetAvailabilityForSubscriptionBuilder(); - } - - public static final class SubscriptionEntitlementsSetAvailabilityForSubscriptionBuilder { - - private Boolean isEnabled; - - private List subscriptionEntitlements; - - private SubscriptionEntitlementsSetAvailabilityForSubscriptionBuilder() {} - - public SubscriptionEntitlementsSetAvailabilityForSubscriptionBuilder isEnabled(Boolean value) { - this.isEnabled = value; - return this; - } - - public SubscriptionEntitlementsSetAvailabilityForSubscriptionBuilder subscriptionEntitlements( - List value) { - this.subscriptionEntitlements = value; - return this; - } - - public SubscriptionEntitlementsSetAvailabilityForSubscriptionParams build() { - return new SubscriptionEntitlementsSetAvailabilityForSubscriptionParams(this); - } - } - - public static final class SubscriptionEntitlementsParams { - - private final String featureId; - - private SubscriptionEntitlementsParams(SubscriptionEntitlementsBuilder builder) { - - this.featureId = builder.featureId; - } - - public String getFeatureId() { - return featureId; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.featureId != null) { - - formData.put("feature_id", this.featureId); - } - - return formData; - } - - /** Create a new builder for SubscriptionEntitlementsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SubscriptionEntitlementsBuilder builder() { - return new SubscriptionEntitlementsBuilder(); - } - - public static final class SubscriptionEntitlementsBuilder { - - private String featureId; - - private SubscriptionEntitlementsBuilder() {} - - public SubscriptionEntitlementsBuilder featureId(String value) { - this.featureId = value; - return this; - } - - public SubscriptionEntitlementsParams build() { - return new SubscriptionEntitlementsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/responses/SetSubscriptionEntitlementAvailabilityResponse.java b/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/responses/SetSubscriptionEntitlementAvailabilityResponse.java new file mode 100644 index 00000000..31065b34 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/responses/SetSubscriptionEntitlementAvailabilityResponse.java @@ -0,0 +1,84 @@ +package com.chargebee.v4.models.subscriptionEntitlement.responses; + +import java.util.List; + +import com.chargebee.v4.models.subscriptionEntitlement.SubscriptionEntitlement; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SetSubscriptionEntitlementAvailability operation. Contains the + * response data from the API. + */ +public final class SetSubscriptionEntitlementAvailabilityResponse extends BaseResponse { + private final List list; + + private SetSubscriptionEntitlementAvailabilityResponse(Builder builder) { + super(builder.httpResponse); + + this.list = builder.list; + } + + /** Parse JSON response into SetSubscriptionEntitlementAvailabilityResponse object. */ + public static SetSubscriptionEntitlementAvailabilityResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into SetSubscriptionEntitlementAvailabilityResponse object with HTTP + * response. + */ + public static SetSubscriptionEntitlementAvailabilityResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.list( + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(SubscriptionEntitlement::fromJson) + .collect(java.util.stream.Collectors.toList())); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SetSubscriptionEntitlementAvailabilityResponse from JSON", e); + } + } + + /** Create a new builder for SetSubscriptionEntitlementAvailabilityResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SetSubscriptionEntitlementAvailabilityResponse. */ + public static class Builder { + + private List list; + + private Response httpResponse; + + private Builder() {} + + public Builder list(List list) { + this.list = list; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SetSubscriptionEntitlementAvailabilityResponse build() { + return new SetSubscriptionEntitlementAvailabilityResponse(this); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/responses/SubscriptionEntitlementsForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/responses/SubscriptionEntitlementsForSubscriptionResponse.java index c732c9c1..5d783637 100644 --- a/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/responses/SubscriptionEntitlementsForSubscriptionResponse.java +++ b/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/responses/SubscriptionEntitlementsForSubscriptionResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.subscriptionEntitlement.SubscriptionEntitlement; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.SubscriptionEntitlementService; @@ -111,9 +112,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public SubscriptionEntitlementsForSubscriptionResponse nextPage() throws Exception { + public SubscriptionEntitlementsForSubscriptionResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/responses/SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/responses/SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse.java deleted file mode 100644 index daf1c09e..00000000 --- a/src/main/java/com/chargebee/v4/models/subscriptionEntitlement/responses/SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.chargebee.v4.models.subscriptionEntitlement.responses; - -import java.util.List; - -import com.chargebee.v4.models.subscriptionEntitlement.SubscriptionEntitlement; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for SubscriptionEntitlementsSetAvailabilityForSubscription operation. - * Contains the response data from the API. - */ -public final class SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse - extends BaseResponse { - private final List list; - - private SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.list = builder.list; - } - - /** - * Parse JSON response into SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse object. - */ - public static SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse fromJson( - String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse object - * with HTTP response. - */ - public static SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.list( - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(SubscriptionEntitlement::fromJson) - .collect(java.util.stream.Collectors.toList())); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse from JSON", - e); - } - } - - /** Create a new builder for SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse. */ - public static class Builder { - - private List list; - - private Response httpResponse; - - private Builder() {} - - public Builder list(List list) { - this.list = list; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse build() { - return new SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse(this); - } - } - - /** Get the list from the response. */ - public List getList() { - return list; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscriptionSetting/params/RetrieveSubscriptionSettingParams.java b/src/main/java/com/chargebee/v4/models/subscriptionSetting/params/RetrieveSubscriptionSettingParams.java deleted file mode 100644 index cfcaccaf..00000000 --- a/src/main/java/com/chargebee/v4/models/subscriptionSetting/params/RetrieveSubscriptionSettingParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.subscriptionSetting.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RetrieveSubscriptionSettingParams { - - private final Map queryParams; - - private RetrieveSubscriptionSettingParams(RetrieveSubscriptionSettingBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public RetrieveSubscriptionSettingBuilder toBuilder() { - RetrieveSubscriptionSettingBuilder builder = new RetrieveSubscriptionSettingBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for RetrieveSubscriptionSettingParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RetrieveSubscriptionSettingBuilder builder() { - return new RetrieveSubscriptionSettingBuilder(); - } - - public static final class RetrieveSubscriptionSettingBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private RetrieveSubscriptionSettingBuilder() {} - - public RetrieveSubscriptionSettingParams build() { - return new RetrieveSubscriptionSettingParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscriptionSetting/params/SubscriptionSettingRetrieveParams.java b/src/main/java/com/chargebee/v4/models/subscriptionSetting/params/SubscriptionSettingRetrieveParams.java new file mode 100644 index 00000000..9ec1c10a --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscriptionSetting/params/SubscriptionSettingRetrieveParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.subscriptionSetting.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SubscriptionSettingRetrieveParams { + + private final Map queryParams; + + private SubscriptionSettingRetrieveParams(SubscriptionSettingRetrieveBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public SubscriptionSettingRetrieveBuilder toBuilder() { + SubscriptionSettingRetrieveBuilder builder = new SubscriptionSettingRetrieveBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for SubscriptionSettingRetrieveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SubscriptionSettingRetrieveBuilder builder() { + return new SubscriptionSettingRetrieveBuilder(); + } + + public static final class SubscriptionSettingRetrieveBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private SubscriptionSettingRetrieveBuilder() {} + + public SubscriptionSettingRetrieveParams build() { + return new SubscriptionSettingRetrieveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/subscriptionSetting/responses/RetrieveSubscriptionSettingResponse.java b/src/main/java/com/chargebee/v4/models/subscriptionSetting/responses/RetrieveSubscriptionSettingResponse.java deleted file mode 100644 index 2d5915da..00000000 --- a/src/main/java/com/chargebee/v4/models/subscriptionSetting/responses/RetrieveSubscriptionSettingResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.chargebee.v4.models.subscriptionSetting.responses; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RetrieveSubscriptionSetting operation. Contains the response data - * from a single resource get operation. - */ -public final class RetrieveSubscriptionSettingResponse extends BaseResponse { - private final Object subscriptionSetting; - - private RetrieveSubscriptionSettingResponse(Builder builder) { - super(builder.httpResponse); - - this.subscriptionSetting = builder.subscriptionSetting; - } - - /** Parse JSON response into RetrieveSubscriptionSettingResponse object. */ - public static RetrieveSubscriptionSettingResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RetrieveSubscriptionSettingResponse object with HTTP response. */ - public static RetrieveSubscriptionSettingResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.subscriptionSetting(JsonUtil.getObject(json, "subscription_setting")); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RetrieveSubscriptionSettingResponse from JSON", e); - } - } - - /** Create a new builder for RetrieveSubscriptionSettingResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RetrieveSubscriptionSettingResponse. */ - public static class Builder { - - private Object subscriptionSetting; - - private Response httpResponse; - - private Builder() {} - - public Builder subscriptionSetting(Object subscriptionSetting) { - this.subscriptionSetting = subscriptionSetting; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RetrieveSubscriptionSettingResponse build() { - return new RetrieveSubscriptionSettingResponse(this); - } - } - - /** Get the subscriptionSetting from the response. */ - public Object getSubscriptionSetting() { - return subscriptionSetting; - } -} diff --git a/src/main/java/com/chargebee/v4/models/subscriptionSetting/responses/SubscriptionSettingRetrieveResponse.java b/src/main/java/com/chargebee/v4/models/subscriptionSetting/responses/SubscriptionSettingRetrieveResponse.java new file mode 100644 index 00000000..28a26ff8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/subscriptionSetting/responses/SubscriptionSettingRetrieveResponse.java @@ -0,0 +1,73 @@ +package com.chargebee.v4.models.subscriptionSetting.responses; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SubscriptionSettingRetrieve operation. Contains the response data + * from a single resource get operation. + */ +public final class SubscriptionSettingRetrieveResponse extends BaseResponse { + private final Object subscriptionSetting; + + private SubscriptionSettingRetrieveResponse(Builder builder) { + super(builder.httpResponse); + + this.subscriptionSetting = builder.subscriptionSetting; + } + + /** Parse JSON response into SubscriptionSettingRetrieveResponse object. */ + public static SubscriptionSettingRetrieveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SubscriptionSettingRetrieveResponse object with HTTP response. */ + public static SubscriptionSettingRetrieveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.subscriptionSetting(JsonUtil.getObject(json, "subscription_setting")); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse SubscriptionSettingRetrieveResponse from JSON", e); + } + } + + /** Create a new builder for SubscriptionSettingRetrieveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SubscriptionSettingRetrieveResponse. */ + public static class Builder { + + private Object subscriptionSetting; + + private Response httpResponse; + + private Builder() {} + + public Builder subscriptionSetting(Object subscriptionSetting) { + this.subscriptionSetting = subscriptionSetting; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SubscriptionSettingRetrieveResponse build() { + return new SubscriptionSettingRetrieveResponse(this); + } + } + + /** Get the subscriptionSetting from the response. */ + public Object getSubscriptionSetting() { + return subscriptionSetting; + } +} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationCreateParams.java b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationCreateParams.java deleted file mode 100644 index 2a9ebd80..00000000 --- a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationCreateParams.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.thirdPartyConfiguration.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class ThirdPartyConfigurationCreateParams { - - private final String integrationName; - - private final java.util.Map configJson; - - private final java.util.Map authJson; - - private final Timestamp lastSyncAt; - - private ThirdPartyConfigurationCreateParams(ThirdPartyConfigurationCreateBuilder builder) { - - this.integrationName = builder.integrationName; - - this.configJson = builder.configJson; - - this.authJson = builder.authJson; - - this.lastSyncAt = builder.lastSyncAt; - } - - public String getIntegrationName() { - return integrationName; - } - - public java.util.Map getConfigJson() { - return configJson; - } - - public java.util.Map getAuthJson() { - return authJson; - } - - public Timestamp getLastSyncAt() { - return lastSyncAt; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.integrationName != null) { - - formData.put("integration_name", this.integrationName); - } - - if (this.configJson != null) { - - formData.put("config_json", JsonUtil.toJson(this.configJson)); - } - - if (this.authJson != null) { - - formData.put("auth_json", JsonUtil.toJson(this.authJson)); - } - - if (this.lastSyncAt != null) { - - formData.put("last_sync_at", this.lastSyncAt); - } - - return formData; - } - - /** Create a new builder for ThirdPartyConfigurationCreateParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ThirdPartyConfigurationCreateBuilder builder() { - return new ThirdPartyConfigurationCreateBuilder(); - } - - public static final class ThirdPartyConfigurationCreateBuilder { - - private String integrationName; - - private java.util.Map configJson; - - private java.util.Map authJson; - - private Timestamp lastSyncAt; - - private ThirdPartyConfigurationCreateBuilder() {} - - public ThirdPartyConfigurationCreateBuilder integrationName(String value) { - this.integrationName = value; - return this; - } - - public ThirdPartyConfigurationCreateBuilder configJson(java.util.Map value) { - this.configJson = value; - return this; - } - - public ThirdPartyConfigurationCreateBuilder authJson(java.util.Map value) { - this.authJson = value; - return this; - } - - public ThirdPartyConfigurationCreateBuilder lastSyncAt(Timestamp value) { - this.lastSyncAt = value; - return this; - } - - public ThirdPartyConfigurationCreateParams build() { - return new ThirdPartyConfigurationCreateParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationExecuteParams.java b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationExecuteParams.java deleted file mode 100644 index 5ad5f7d8..00000000 --- a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationExecuteParams.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.thirdPartyConfiguration.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ThirdPartyConfigurationExecuteParams { - - private final Map queryParams; - - private ThirdPartyConfigurationExecuteParams(ThirdPartyConfigurationExecuteBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public ThirdPartyConfigurationExecuteBuilder toBuilder() { - ThirdPartyConfigurationExecuteBuilder builder = new ThirdPartyConfigurationExecuteBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for ThirdPartyConfigurationExecuteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ThirdPartyConfigurationExecuteBuilder builder() { - return new ThirdPartyConfigurationExecuteBuilder(); - } - - public static final class ThirdPartyConfigurationExecuteBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private ThirdPartyConfigurationExecuteBuilder() {} - - public ThirdPartyConfigurationExecuteBuilder integrationName(String value) { - queryParams.put("integration_name", value); - return this; - } - - public ThirdPartyConfigurationExecuteParams build() { - return new ThirdPartyConfigurationExecuteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationRetrieveParams.java b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationRetrieveParams.java new file mode 100644 index 00000000..57f35768 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationRetrieveParams.java @@ -0,0 +1,55 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.thirdPartyConfiguration.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ThirdPartyConfigurationRetrieveParams { + + private final Map queryParams; + + private ThirdPartyConfigurationRetrieveParams(ThirdPartyConfigurationRetrieveBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public ThirdPartyConfigurationRetrieveBuilder toBuilder() { + ThirdPartyConfigurationRetrieveBuilder builder = new ThirdPartyConfigurationRetrieveBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for ThirdPartyConfigurationRetrieveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ThirdPartyConfigurationRetrieveBuilder builder() { + return new ThirdPartyConfigurationRetrieveBuilder(); + } + + public static final class ThirdPartyConfigurationRetrieveBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private ThirdPartyConfigurationRetrieveBuilder() {} + + public ThirdPartyConfigurationRetrieveBuilder integrationName(String value) { + queryParams.put("integration_name", value); + return this; + } + + public ThirdPartyConfigurationRetrieveParams build() { + return new ThirdPartyConfigurationRetrieveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationUpdateParams.java b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationUpdateParams.java new file mode 100644 index 00000000..7ae998d8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/params/ThirdPartyConfigurationUpdateParams.java @@ -0,0 +1,122 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.thirdPartyConfiguration.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class ThirdPartyConfigurationUpdateParams { + + private final String integrationName; + + private final java.util.Map configJson; + + private final java.util.Map authJson; + + private final Timestamp lastSyncAt; + + private ThirdPartyConfigurationUpdateParams(ThirdPartyConfigurationUpdateBuilder builder) { + + this.integrationName = builder.integrationName; + + this.configJson = builder.configJson; + + this.authJson = builder.authJson; + + this.lastSyncAt = builder.lastSyncAt; + } + + public String getIntegrationName() { + return integrationName; + } + + public java.util.Map getConfigJson() { + return configJson; + } + + public java.util.Map getAuthJson() { + return authJson; + } + + public Timestamp getLastSyncAt() { + return lastSyncAt; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.integrationName != null) { + + formData.put("integration_name", this.integrationName); + } + + if (this.configJson != null) { + + formData.put("config_json", JsonUtil.toJson(this.configJson)); + } + + if (this.authJson != null) { + + formData.put("auth_json", JsonUtil.toJson(this.authJson)); + } + + if (this.lastSyncAt != null) { + + formData.put("last_sync_at", this.lastSyncAt); + } + + return formData; + } + + /** Create a new builder for ThirdPartyConfigurationUpdateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ThirdPartyConfigurationUpdateBuilder builder() { + return new ThirdPartyConfigurationUpdateBuilder(); + } + + public static final class ThirdPartyConfigurationUpdateBuilder { + + private String integrationName; + + private java.util.Map configJson; + + private java.util.Map authJson; + + private Timestamp lastSyncAt; + + private ThirdPartyConfigurationUpdateBuilder() {} + + public ThirdPartyConfigurationUpdateBuilder integrationName(String value) { + this.integrationName = value; + return this; + } + + public ThirdPartyConfigurationUpdateBuilder configJson(java.util.Map value) { + this.configJson = value; + return this; + } + + public ThirdPartyConfigurationUpdateBuilder authJson(java.util.Map value) { + this.authJson = value; + return this; + } + + public ThirdPartyConfigurationUpdateBuilder lastSyncAt(Timestamp value) { + this.lastSyncAt = value; + return this; + } + + public ThirdPartyConfigurationUpdateParams build() { + return new ThirdPartyConfigurationUpdateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationCreateResponse.java b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationCreateResponse.java deleted file mode 100644 index fdd51daf..00000000 --- a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationCreateResponse.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.chargebee.v4.models.thirdPartyConfiguration.responses; - -import com.chargebee.v4.models.thirdPartyConfiguration.ThirdPartyConfiguration; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ThirdPartyConfigurationCreate operation. Contains the response data - * from the API. - */ -public final class ThirdPartyConfigurationCreateResponse extends BaseResponse { - private final ThirdPartyConfiguration thirdPartyConfiguration; - - private ThirdPartyConfigurationCreateResponse(Builder builder) { - super(builder.httpResponse); - - this.thirdPartyConfiguration = builder.thirdPartyConfiguration; - } - - /** Parse JSON response into ThirdPartyConfigurationCreateResponse object. */ - public static ThirdPartyConfigurationCreateResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ThirdPartyConfigurationCreateResponse object with HTTP response. */ - public static ThirdPartyConfigurationCreateResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __thirdPartyConfigurationJson = JsonUtil.getObject(json, "third_party_configuration"); - if (__thirdPartyConfigurationJson != null) { - builder.thirdPartyConfiguration( - ThirdPartyConfiguration.fromJson(__thirdPartyConfigurationJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ThirdPartyConfigurationCreateResponse from JSON", e); - } - } - - /** Create a new builder for ThirdPartyConfigurationCreateResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ThirdPartyConfigurationCreateResponse. */ - public static class Builder { - - private ThirdPartyConfiguration thirdPartyConfiguration; - - private Response httpResponse; - - private Builder() {} - - public Builder thirdPartyConfiguration(ThirdPartyConfiguration thirdPartyConfiguration) { - this.thirdPartyConfiguration = thirdPartyConfiguration; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ThirdPartyConfigurationCreateResponse build() { - return new ThirdPartyConfigurationCreateResponse(this); - } - } - - /** Get the thirdPartyConfiguration from the response. */ - public ThirdPartyConfiguration getThirdPartyConfiguration() { - return thirdPartyConfiguration; - } -} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationExecuteResponse.java b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationExecuteResponse.java deleted file mode 100644 index 2914a52f..00000000 --- a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationExecuteResponse.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.chargebee.v4.models.thirdPartyConfiguration.responses; - -import com.chargebee.v4.models.thirdPartyConfiguration.ThirdPartyConfiguration; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ThirdPartyConfigurationExecute operation. Contains the response - * data from a single resource get operation. - */ -public final class ThirdPartyConfigurationExecuteResponse extends BaseResponse { - private final ThirdPartyConfiguration thirdPartyConfiguration; - - private ThirdPartyConfigurationExecuteResponse(Builder builder) { - super(builder.httpResponse); - - this.thirdPartyConfiguration = builder.thirdPartyConfiguration; - } - - /** Parse JSON response into ThirdPartyConfigurationExecuteResponse object. */ - public static ThirdPartyConfigurationExecuteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ThirdPartyConfigurationExecuteResponse object with HTTP response. */ - public static ThirdPartyConfigurationExecuteResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __thirdPartyConfigurationJson = JsonUtil.getObject(json, "third_party_configuration"); - if (__thirdPartyConfigurationJson != null) { - builder.thirdPartyConfiguration( - ThirdPartyConfiguration.fromJson(__thirdPartyConfigurationJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ThirdPartyConfigurationExecuteResponse from JSON", e); - } - } - - /** Create a new builder for ThirdPartyConfigurationExecuteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ThirdPartyConfigurationExecuteResponse. */ - public static class Builder { - - private ThirdPartyConfiguration thirdPartyConfiguration; - - private Response httpResponse; - - private Builder() {} - - public Builder thirdPartyConfiguration(ThirdPartyConfiguration thirdPartyConfiguration) { - this.thirdPartyConfiguration = thirdPartyConfiguration; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ThirdPartyConfigurationExecuteResponse build() { - return new ThirdPartyConfigurationExecuteResponse(this); - } - } - - /** Get the thirdPartyConfiguration from the response. */ - public ThirdPartyConfiguration getThirdPartyConfiguration() { - return thirdPartyConfiguration; - } -} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationRetrieveResponse.java b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationRetrieveResponse.java new file mode 100644 index 00000000..77390791 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationRetrieveResponse.java @@ -0,0 +1,80 @@ +package com.chargebee.v4.models.thirdPartyConfiguration.responses; + +import com.chargebee.v4.models.thirdPartyConfiguration.ThirdPartyConfiguration; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for ThirdPartyConfigurationRetrieve operation. Contains the response + * data from a single resource get operation. + */ +public final class ThirdPartyConfigurationRetrieveResponse extends BaseResponse { + private final ThirdPartyConfiguration thirdPartyConfiguration; + + private ThirdPartyConfigurationRetrieveResponse(Builder builder) { + super(builder.httpResponse); + + this.thirdPartyConfiguration = builder.thirdPartyConfiguration; + } + + /** Parse JSON response into ThirdPartyConfigurationRetrieveResponse object. */ + public static ThirdPartyConfigurationRetrieveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into ThirdPartyConfigurationRetrieveResponse object with HTTP response. */ + public static ThirdPartyConfigurationRetrieveResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __thirdPartyConfigurationJson = JsonUtil.getObject(json, "third_party_configuration"); + if (__thirdPartyConfigurationJson != null) { + builder.thirdPartyConfiguration( + ThirdPartyConfiguration.fromJson(__thirdPartyConfigurationJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse ThirdPartyConfigurationRetrieveResponse from JSON", e); + } + } + + /** Create a new builder for ThirdPartyConfigurationRetrieveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ThirdPartyConfigurationRetrieveResponse. */ + public static class Builder { + + private ThirdPartyConfiguration thirdPartyConfiguration; + + private Response httpResponse; + + private Builder() {} + + public Builder thirdPartyConfiguration(ThirdPartyConfiguration thirdPartyConfiguration) { + this.thirdPartyConfiguration = thirdPartyConfiguration; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public ThirdPartyConfigurationRetrieveResponse build() { + return new ThirdPartyConfigurationRetrieveResponse(this); + } + } + + /** Get the thirdPartyConfiguration from the response. */ + public ThirdPartyConfiguration getThirdPartyConfiguration() { + return thirdPartyConfiguration; + } +} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationUpdateResponse.java b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationUpdateResponse.java new file mode 100644 index 00000000..a40a3c40 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/thirdPartyConfiguration/responses/ThirdPartyConfigurationUpdateResponse.java @@ -0,0 +1,79 @@ +package com.chargebee.v4.models.thirdPartyConfiguration.responses; + +import com.chargebee.v4.models.thirdPartyConfiguration.ThirdPartyConfiguration; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for ThirdPartyConfigurationUpdate operation. Contains the response data + * from the API. + */ +public final class ThirdPartyConfigurationUpdateResponse extends BaseResponse { + private final ThirdPartyConfiguration thirdPartyConfiguration; + + private ThirdPartyConfigurationUpdateResponse(Builder builder) { + super(builder.httpResponse); + + this.thirdPartyConfiguration = builder.thirdPartyConfiguration; + } + + /** Parse JSON response into ThirdPartyConfigurationUpdateResponse object. */ + public static ThirdPartyConfigurationUpdateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into ThirdPartyConfigurationUpdateResponse object with HTTP response. */ + public static ThirdPartyConfigurationUpdateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __thirdPartyConfigurationJson = JsonUtil.getObject(json, "third_party_configuration"); + if (__thirdPartyConfigurationJson != null) { + builder.thirdPartyConfiguration( + ThirdPartyConfiguration.fromJson(__thirdPartyConfigurationJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse ThirdPartyConfigurationUpdateResponse from JSON", e); + } + } + + /** Create a new builder for ThirdPartyConfigurationUpdateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ThirdPartyConfigurationUpdateResponse. */ + public static class Builder { + + private ThirdPartyConfiguration thirdPartyConfiguration; + + private Response httpResponse; + + private Builder() {} + + public Builder thirdPartyConfiguration(ThirdPartyConfiguration thirdPartyConfiguration) { + this.thirdPartyConfiguration = thirdPartyConfiguration; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public ThirdPartyConfigurationUpdateResponse build() { + return new ThirdPartyConfigurationUpdateResponse(this); + } + } + + /** Get the thirdPartyConfiguration from the response. */ + public ThirdPartyConfiguration getThirdPartyConfiguration() { + return thirdPartyConfiguration; + } +} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/params/RetrieveThirdPartyEntityMappingParams.java b/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/params/RetrieveThirdPartyEntityMappingParams.java deleted file mode 100644 index 0e6c3555..00000000 --- a/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/params/RetrieveThirdPartyEntityMappingParams.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.thirdPartyEntityMapping.params; - -import com.chargebee.v4.internal.Recommended; - -import java.sql.Timestamp; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RetrieveThirdPartyEntityMappingParams { - - private final Map queryParams; - - private RetrieveThirdPartyEntityMappingParams(RetrieveThirdPartyEntityMappingBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public RetrieveThirdPartyEntityMappingBuilder toBuilder() { - RetrieveThirdPartyEntityMappingBuilder builder = new RetrieveThirdPartyEntityMappingBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for RetrieveThirdPartyEntityMappingParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RetrieveThirdPartyEntityMappingBuilder builder() { - return new RetrieveThirdPartyEntityMappingBuilder(); - } - - public static final class RetrieveThirdPartyEntityMappingBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private RetrieveThirdPartyEntityMappingBuilder() {} - - public RetrieveThirdPartyEntityMappingBuilder entityType(EntityType value) { - queryParams.put("entity_type", value); - return this; - } - - public RetrieveThirdPartyEntityMappingBuilder entityId(String value) { - queryParams.put("entity_id", value); - return this; - } - - public RetrieveThirdPartyEntityMappingBuilder integrationName(String value) { - queryParams.put("integration_name", value); - return this; - } - - public RetrieveThirdPartyEntityMappingBuilder createdAt(Timestamp value) { - queryParams.put("created_at", value); - return this; - } - - public RetrieveThirdPartyEntityMappingBuilder modifiedAt(Timestamp value) { - queryParams.put("modified_at", value); - return this; - } - - public RetrieveThirdPartyEntityMappingParams build() { - return new RetrieveThirdPartyEntityMappingParams(this); - } - } - - public enum EntityType { - CUSTOMER("customer"), - - INVOICE("invoice"), - - CREDIT_NOTE("credit_note"), - - TRANSACTION("transaction"), - - PLAN("plan"), - - ADDON("addon"), - - COUPON("coupon"), - - SUBSCRIPTION("subscription"), - - ORDER("order"), - - QUOTE("quote"), - - ITEM_FAMILY("item_family"), - - ITEM("item"), - - ITEM_PRICE("item_price"), - - TAX_RATE("tax_rate"), - - TAX_GROUP("tax_group"), - - /** An enum member indicating that EntityType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - EntityType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static EntityType fromString(String value) { - if (value == null) return _UNKNOWN; - for (EntityType enumValue : EntityType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/params/ThirdPartyEntityMappingRetrieveEntityParams.java b/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/params/ThirdPartyEntityMappingRetrieveEntityParams.java new file mode 100644 index 00000000..520a528b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/params/ThirdPartyEntityMappingRetrieveEntityParams.java @@ -0,0 +1,132 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.thirdPartyEntityMapping.params; + +import com.chargebee.v4.internal.Recommended; + +import java.sql.Timestamp; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ThirdPartyEntityMappingRetrieveEntityParams { + + private final Map queryParams; + + private ThirdPartyEntityMappingRetrieveEntityParams( + ThirdPartyEntityMappingRetrieveEntityBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public ThirdPartyEntityMappingRetrieveEntityBuilder toBuilder() { + ThirdPartyEntityMappingRetrieveEntityBuilder builder = + new ThirdPartyEntityMappingRetrieveEntityBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for ThirdPartyEntityMappingRetrieveEntityParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ThirdPartyEntityMappingRetrieveEntityBuilder builder() { + return new ThirdPartyEntityMappingRetrieveEntityBuilder(); + } + + public static final class ThirdPartyEntityMappingRetrieveEntityBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private ThirdPartyEntityMappingRetrieveEntityBuilder() {} + + public ThirdPartyEntityMappingRetrieveEntityBuilder entityType(EntityType value) { + queryParams.put("entity_type", value); + return this; + } + + public ThirdPartyEntityMappingRetrieveEntityBuilder entityId(String value) { + queryParams.put("entity_id", value); + return this; + } + + public ThirdPartyEntityMappingRetrieveEntityBuilder integrationName(String value) { + queryParams.put("integration_name", value); + return this; + } + + public ThirdPartyEntityMappingRetrieveEntityBuilder createdAt(Timestamp value) { + queryParams.put("created_at", value); + return this; + } + + public ThirdPartyEntityMappingRetrieveEntityBuilder modifiedAt(Timestamp value) { + queryParams.put("modified_at", value); + return this; + } + + public ThirdPartyEntityMappingRetrieveEntityParams build() { + return new ThirdPartyEntityMappingRetrieveEntityParams(this); + } + } + + public enum EntityType { + CUSTOMER("customer"), + + INVOICE("invoice"), + + CREDIT_NOTE("credit_note"), + + TRANSACTION("transaction"), + + PLAN("plan"), + + ADDON("addon"), + + COUPON("coupon"), + + SUBSCRIPTION("subscription"), + + ORDER("order"), + + QUOTE("quote"), + + ITEM_FAMILY("item_family"), + + ITEM("item"), + + ITEM_PRICE("item_price"), + + TAX_RATE("tax_rate"), + + TAX_GROUP("tax_group"), + + /** An enum member indicating that EntityType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + EntityType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static EntityType fromString(String value) { + if (value == null) return _UNKNOWN; + for (EntityType enumValue : EntityType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/responses/RetrieveThirdPartyEntityMappingResponse.java b/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/responses/RetrieveThirdPartyEntityMappingResponse.java deleted file mode 100644 index c1c1abfd..00000000 --- a/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/responses/RetrieveThirdPartyEntityMappingResponse.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.chargebee.v4.models.thirdPartyEntityMapping.responses; - -import com.chargebee.v4.models.thirdPartyEntityMapping.ThirdPartyEntityMapping; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RetrieveThirdPartyEntityMapping operation. Contains the response - * data from a single resource get operation. - */ -public final class RetrieveThirdPartyEntityMappingResponse extends BaseResponse { - private final ThirdPartyEntityMapping thirdPartyEntityMapping; - - private RetrieveThirdPartyEntityMappingResponse(Builder builder) { - super(builder.httpResponse); - - this.thirdPartyEntityMapping = builder.thirdPartyEntityMapping; - } - - /** Parse JSON response into RetrieveThirdPartyEntityMappingResponse object. */ - public static RetrieveThirdPartyEntityMappingResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RetrieveThirdPartyEntityMappingResponse object with HTTP response. */ - public static RetrieveThirdPartyEntityMappingResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __thirdPartyEntityMappingJson = JsonUtil.getObject(json, "third_party_entity_mapping"); - if (__thirdPartyEntityMappingJson != null) { - builder.thirdPartyEntityMapping( - ThirdPartyEntityMapping.fromJson(__thirdPartyEntityMappingJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse RetrieveThirdPartyEntityMappingResponse from JSON", e); - } - } - - /** Create a new builder for RetrieveThirdPartyEntityMappingResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RetrieveThirdPartyEntityMappingResponse. */ - public static class Builder { - - private ThirdPartyEntityMapping thirdPartyEntityMapping; - - private Response httpResponse; - - private Builder() {} - - public Builder thirdPartyEntityMapping(ThirdPartyEntityMapping thirdPartyEntityMapping) { - this.thirdPartyEntityMapping = thirdPartyEntityMapping; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RetrieveThirdPartyEntityMappingResponse build() { - return new RetrieveThirdPartyEntityMappingResponse(this); - } - } - - /** Get the thirdPartyEntityMapping from the response. */ - public ThirdPartyEntityMapping getThirdPartyEntityMapping() { - return thirdPartyEntityMapping; - } -} diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/responses/ThirdPartyEntityMappingListResponse.java b/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/responses/ThirdPartyEntityMappingListResponse.java index 697a7375..6432857c 100644 --- a/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/responses/ThirdPartyEntityMappingListResponse.java +++ b/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/responses/ThirdPartyEntityMappingListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.thirdPartyEntityMapping.ThirdPartyEntityMapping; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.ThirdPartyEntityMappingService; @@ -104,9 +105,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public ThirdPartyEntityMappingListResponse nextPage() throws Exception { + public ThirdPartyEntityMappingListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/responses/ThirdPartyEntityMappingRetrieveEntityResponse.java b/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/responses/ThirdPartyEntityMappingRetrieveEntityResponse.java new file mode 100644 index 00000000..ebc254f6 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/thirdPartyEntityMapping/responses/ThirdPartyEntityMappingRetrieveEntityResponse.java @@ -0,0 +1,83 @@ +package com.chargebee.v4.models.thirdPartyEntityMapping.responses; + +import com.chargebee.v4.models.thirdPartyEntityMapping.ThirdPartyEntityMapping; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for ThirdPartyEntityMappingRetrieveEntity operation. Contains the + * response data from a single resource get operation. + */ +public final class ThirdPartyEntityMappingRetrieveEntityResponse extends BaseResponse { + private final ThirdPartyEntityMapping thirdPartyEntityMapping; + + private ThirdPartyEntityMappingRetrieveEntityResponse(Builder builder) { + super(builder.httpResponse); + + this.thirdPartyEntityMapping = builder.thirdPartyEntityMapping; + } + + /** Parse JSON response into ThirdPartyEntityMappingRetrieveEntityResponse object. */ + public static ThirdPartyEntityMappingRetrieveEntityResponse fromJson(String json) { + return fromJson(json, null); + } + + /** + * Parse JSON response into ThirdPartyEntityMappingRetrieveEntityResponse object with HTTP + * response. + */ + public static ThirdPartyEntityMappingRetrieveEntityResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __thirdPartyEntityMappingJson = JsonUtil.getObject(json, "third_party_entity_mapping"); + if (__thirdPartyEntityMappingJson != null) { + builder.thirdPartyEntityMapping( + ThirdPartyEntityMapping.fromJson(__thirdPartyEntityMappingJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse ThirdPartyEntityMappingRetrieveEntityResponse from JSON", e); + } + } + + /** Create a new builder for ThirdPartyEntityMappingRetrieveEntityResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ThirdPartyEntityMappingRetrieveEntityResponse. */ + public static class Builder { + + private ThirdPartyEntityMapping thirdPartyEntityMapping; + + private Response httpResponse; + + private Builder() {} + + public Builder thirdPartyEntityMapping(ThirdPartyEntityMapping thirdPartyEntityMapping) { + this.thirdPartyEntityMapping = thirdPartyEntityMapping; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public ThirdPartyEntityMappingRetrieveEntityResponse build() { + return new ThirdPartyEntityMappingRetrieveEntityResponse(this); + } + } + + /** Get the thirdPartyEntityMapping from the response. */ + public ThirdPartyEntityMapping getThirdPartyEntityMapping() { + return thirdPartyEntityMapping; + } +} diff --git a/src/main/java/com/chargebee/v4/models/timeMachine/params/StartAfreshForTimeMachineParams.java b/src/main/java/com/chargebee/v4/models/timeMachine/params/StartAfreshForTimeMachineParams.java deleted file mode 100644 index 682ad245..00000000 --- a/src/main/java/com/chargebee/v4/models/timeMachine/params/StartAfreshForTimeMachineParams.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.timeMachine.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class StartAfreshForTimeMachineParams { - - private final Timestamp genesisTime; - - private StartAfreshForTimeMachineParams(StartAfreshForTimeMachineBuilder builder) { - - this.genesisTime = builder.genesisTime; - } - - public Timestamp getGenesisTime() { - return genesisTime; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.genesisTime != null) { - - formData.put("genesis_time", this.genesisTime); - } - - return formData; - } - - /** Create a new builder for StartAfreshForTimeMachineParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static StartAfreshForTimeMachineBuilder builder() { - return new StartAfreshForTimeMachineBuilder(); - } - - public static final class StartAfreshForTimeMachineBuilder { - - private Timestamp genesisTime; - - private StartAfreshForTimeMachineBuilder() {} - - public StartAfreshForTimeMachineBuilder genesisTime(Timestamp value) { - this.genesisTime = value; - return this; - } - - public StartAfreshForTimeMachineParams build() { - return new StartAfreshForTimeMachineParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/timeMachine/params/TimeMachineStartAfreshParams.java b/src/main/java/com/chargebee/v4/models/timeMachine/params/TimeMachineStartAfreshParams.java new file mode 100644 index 00000000..68dd9c7c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/timeMachine/params/TimeMachineStartAfreshParams.java @@ -0,0 +1,61 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.timeMachine.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class TimeMachineStartAfreshParams { + + private final Timestamp genesisTime; + + private TimeMachineStartAfreshParams(TimeMachineStartAfreshBuilder builder) { + + this.genesisTime = builder.genesisTime; + } + + public Timestamp getGenesisTime() { + return genesisTime; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.genesisTime != null) { + + formData.put("genesis_time", this.genesisTime); + } + + return formData; + } + + /** Create a new builder for TimeMachineStartAfreshParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TimeMachineStartAfreshBuilder builder() { + return new TimeMachineStartAfreshBuilder(); + } + + public static final class TimeMachineStartAfreshBuilder { + + private Timestamp genesisTime; + + private TimeMachineStartAfreshBuilder() {} + + public TimeMachineStartAfreshBuilder genesisTime(Timestamp value) { + this.genesisTime = value; + return this; + } + + public TimeMachineStartAfreshParams build() { + return new TimeMachineStartAfreshParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/timeMachine/params/TimeMachineTravelForwardParams.java b/src/main/java/com/chargebee/v4/models/timeMachine/params/TimeMachineTravelForwardParams.java new file mode 100644 index 00000000..56db0411 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/timeMachine/params/TimeMachineTravelForwardParams.java @@ -0,0 +1,61 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.timeMachine.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class TimeMachineTravelForwardParams { + + private final Timestamp destinationTime; + + private TimeMachineTravelForwardParams(TimeMachineTravelForwardBuilder builder) { + + this.destinationTime = builder.destinationTime; + } + + public Timestamp getDestinationTime() { + return destinationTime; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.destinationTime != null) { + + formData.put("destination_time", this.destinationTime); + } + + return formData; + } + + /** Create a new builder for TimeMachineTravelForwardParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TimeMachineTravelForwardBuilder builder() { + return new TimeMachineTravelForwardBuilder(); + } + + public static final class TimeMachineTravelForwardBuilder { + + private Timestamp destinationTime; + + private TimeMachineTravelForwardBuilder() {} + + public TimeMachineTravelForwardBuilder destinationTime(Timestamp value) { + this.destinationTime = value; + return this; + } + + public TimeMachineTravelForwardParams build() { + return new TimeMachineTravelForwardParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/timeMachine/params/TravelForwardForTimeMachineParams.java b/src/main/java/com/chargebee/v4/models/timeMachine/params/TravelForwardForTimeMachineParams.java deleted file mode 100644 index b3dab844..00000000 --- a/src/main/java/com/chargebee/v4/models/timeMachine/params/TravelForwardForTimeMachineParams.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.timeMachine.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class TravelForwardForTimeMachineParams { - - private final Timestamp destinationTime; - - private TravelForwardForTimeMachineParams(TravelForwardForTimeMachineBuilder builder) { - - this.destinationTime = builder.destinationTime; - } - - public Timestamp getDestinationTime() { - return destinationTime; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.destinationTime != null) { - - formData.put("destination_time", this.destinationTime); - } - - return formData; - } - - /** Create a new builder for TravelForwardForTimeMachineParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static TravelForwardForTimeMachineBuilder builder() { - return new TravelForwardForTimeMachineBuilder(); - } - - public static final class TravelForwardForTimeMachineBuilder { - - private Timestamp destinationTime; - - private TravelForwardForTimeMachineBuilder() {} - - public TravelForwardForTimeMachineBuilder destinationTime(Timestamp value) { - this.destinationTime = value; - return this; - } - - public TravelForwardForTimeMachineParams build() { - return new TravelForwardForTimeMachineParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/timeMachine/responses/StartAfreshForTimeMachineResponse.java b/src/main/java/com/chargebee/v4/models/timeMachine/responses/StartAfreshForTimeMachineResponse.java deleted file mode 100644 index 08d63c35..00000000 --- a/src/main/java/com/chargebee/v4/models/timeMachine/responses/StartAfreshForTimeMachineResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.timeMachine.responses; - -import com.chargebee.v4.models.timeMachine.TimeMachine; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for StartAfreshForTimeMachine operation. Contains the response data - * from the API. - */ -public final class StartAfreshForTimeMachineResponse extends BaseResponse { - private final TimeMachine timeMachine; - - private StartAfreshForTimeMachineResponse(Builder builder) { - super(builder.httpResponse); - - this.timeMachine = builder.timeMachine; - } - - /** Parse JSON response into StartAfreshForTimeMachineResponse object. */ - public static StartAfreshForTimeMachineResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into StartAfreshForTimeMachineResponse object with HTTP response. */ - public static StartAfreshForTimeMachineResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __timeMachineJson = JsonUtil.getObject(json, "time_machine"); - if (__timeMachineJson != null) { - builder.timeMachine(TimeMachine.fromJson(__timeMachineJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse StartAfreshForTimeMachineResponse from JSON", e); - } - } - - /** Create a new builder for StartAfreshForTimeMachineResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for StartAfreshForTimeMachineResponse. */ - public static class Builder { - - private TimeMachine timeMachine; - - private Response httpResponse; - - private Builder() {} - - public Builder timeMachine(TimeMachine timeMachine) { - this.timeMachine = timeMachine; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public StartAfreshForTimeMachineResponse build() { - return new StartAfreshForTimeMachineResponse(this); - } - } - - /** Get the timeMachine from the response. */ - public TimeMachine getTimeMachine() { - return timeMachine; - } -} diff --git a/src/main/java/com/chargebee/v4/models/timeMachine/responses/TimeMachineStartAfreshResponse.java b/src/main/java/com/chargebee/v4/models/timeMachine/responses/TimeMachineStartAfreshResponse.java new file mode 100644 index 00000000..14354d6d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/timeMachine/responses/TimeMachineStartAfreshResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.timeMachine.responses; + +import com.chargebee.v4.models.timeMachine.TimeMachine; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for TimeMachineStartAfresh operation. Contains the response data from + * the API. + */ +public final class TimeMachineStartAfreshResponse extends BaseResponse { + private final TimeMachine timeMachine; + + private TimeMachineStartAfreshResponse(Builder builder) { + super(builder.httpResponse); + + this.timeMachine = builder.timeMachine; + } + + /** Parse JSON response into TimeMachineStartAfreshResponse object. */ + public static TimeMachineStartAfreshResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into TimeMachineStartAfreshResponse object with HTTP response. */ + public static TimeMachineStartAfreshResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __timeMachineJson = JsonUtil.getObject(json, "time_machine"); + if (__timeMachineJson != null) { + builder.timeMachine(TimeMachine.fromJson(__timeMachineJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse TimeMachineStartAfreshResponse from JSON", e); + } + } + + /** Create a new builder for TimeMachineStartAfreshResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for TimeMachineStartAfreshResponse. */ + public static class Builder { + + private TimeMachine timeMachine; + + private Response httpResponse; + + private Builder() {} + + public Builder timeMachine(TimeMachine timeMachine) { + this.timeMachine = timeMachine; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public TimeMachineStartAfreshResponse build() { + return new TimeMachineStartAfreshResponse(this); + } + } + + /** Get the timeMachine from the response. */ + public TimeMachine getTimeMachine() { + return timeMachine; + } +} diff --git a/src/main/java/com/chargebee/v4/models/timeMachine/responses/TimeMachineTravelForwardResponse.java b/src/main/java/com/chargebee/v4/models/timeMachine/responses/TimeMachineTravelForwardResponse.java new file mode 100644 index 00000000..64ff03a6 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/timeMachine/responses/TimeMachineTravelForwardResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.timeMachine.responses; + +import com.chargebee.v4.models.timeMachine.TimeMachine; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for TimeMachineTravelForward operation. Contains the response data from + * the API. + */ +public final class TimeMachineTravelForwardResponse extends BaseResponse { + private final TimeMachine timeMachine; + + private TimeMachineTravelForwardResponse(Builder builder) { + super(builder.httpResponse); + + this.timeMachine = builder.timeMachine; + } + + /** Parse JSON response into TimeMachineTravelForwardResponse object. */ + public static TimeMachineTravelForwardResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into TimeMachineTravelForwardResponse object with HTTP response. */ + public static TimeMachineTravelForwardResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __timeMachineJson = JsonUtil.getObject(json, "time_machine"); + if (__timeMachineJson != null) { + builder.timeMachine(TimeMachine.fromJson(__timeMachineJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse TimeMachineTravelForwardResponse from JSON", e); + } + } + + /** Create a new builder for TimeMachineTravelForwardResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for TimeMachineTravelForwardResponse. */ + public static class Builder { + + private TimeMachine timeMachine; + + private Response httpResponse; + + private Builder() {} + + public Builder timeMachine(TimeMachine timeMachine) { + this.timeMachine = timeMachine; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public TimeMachineTravelForwardResponse build() { + return new TimeMachineTravelForwardResponse(this); + } + } + + /** Get the timeMachine from the response. */ + public TimeMachine getTimeMachine() { + return timeMachine; + } +} diff --git a/src/main/java/com/chargebee/v4/models/timeMachine/responses/TravelForwardForTimeMachineResponse.java b/src/main/java/com/chargebee/v4/models/timeMachine/responses/TravelForwardForTimeMachineResponse.java deleted file mode 100644 index a06e83e1..00000000 --- a/src/main/java/com/chargebee/v4/models/timeMachine/responses/TravelForwardForTimeMachineResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.timeMachine.responses; - -import com.chargebee.v4.models.timeMachine.TimeMachine; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for TravelForwardForTimeMachine operation. Contains the response data - * from the API. - */ -public final class TravelForwardForTimeMachineResponse extends BaseResponse { - private final TimeMachine timeMachine; - - private TravelForwardForTimeMachineResponse(Builder builder) { - super(builder.httpResponse); - - this.timeMachine = builder.timeMachine; - } - - /** Parse JSON response into TravelForwardForTimeMachineResponse object. */ - public static TravelForwardForTimeMachineResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into TravelForwardForTimeMachineResponse object with HTTP response. */ - public static TravelForwardForTimeMachineResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __timeMachineJson = JsonUtil.getObject(json, "time_machine"); - if (__timeMachineJson != null) { - builder.timeMachine(TimeMachine.fromJson(__timeMachineJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse TravelForwardForTimeMachineResponse from JSON", e); - } - } - - /** Create a new builder for TravelForwardForTimeMachineResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for TravelForwardForTimeMachineResponse. */ - public static class Builder { - - private TimeMachine timeMachine; - - private Response httpResponse; - - private Builder() {} - - public Builder timeMachine(TimeMachine timeMachine) { - this.timeMachine = timeMachine; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public TravelForwardForTimeMachineResponse build() { - return new TravelForwardForTimeMachineResponse(this); - } - } - - /** Get the timeMachine from the response. */ - public TimeMachine getTimeMachine() { - return timeMachine; - } -} diff --git a/src/main/java/com/chargebee/v4/models/tpSiteUser/responses/GuestsForTpSiteUserResponse.java b/src/main/java/com/chargebee/v4/models/tpSiteUser/responses/GuestsForTpSiteUserResponse.java index e72f0aa5..cc63602f 100644 --- a/src/main/java/com/chargebee/v4/models/tpSiteUser/responses/GuestsForTpSiteUserResponse.java +++ b/src/main/java/com/chargebee/v4/models/tpSiteUser/responses/GuestsForTpSiteUserResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.tpSiteUser.TpSiteUser; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.TpSiteUserService; @@ -105,9 +106,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public GuestsForTpSiteUserResponse nextPage() throws Exception { + public GuestsForTpSiteUserResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/tpSiteUser/responses/UsersForTpSiteUserResponse.java b/src/main/java/com/chargebee/v4/models/tpSiteUser/responses/UsersForTpSiteUserResponse.java index 9a6df80c..74e09df6 100644 --- a/src/main/java/com/chargebee/v4/models/tpSiteUser/responses/UsersForTpSiteUserResponse.java +++ b/src/main/java/com/chargebee/v4/models/tpSiteUser/responses/UsersForTpSiteUserResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.tpSiteUser.TpSiteUser; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.TpSiteUserService; @@ -105,9 +106,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public UsersForTpSiteUserResponse nextPage() throws Exception { + public UsersForTpSiteUserResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/DeleteOfflineTransactionForTransactionParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/DeleteOfflineTransactionForTransactionParams.java deleted file mode 100644 index a7536701..00000000 --- a/src/main/java/com/chargebee/v4/models/transaction/params/DeleteOfflineTransactionForTransactionParams.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.transaction.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteOfflineTransactionForTransactionParams { - - private final String comment; - - private DeleteOfflineTransactionForTransactionParams( - DeleteOfflineTransactionForTransactionBuilder builder) { - - this.comment = builder.comment; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for DeleteOfflineTransactionForTransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteOfflineTransactionForTransactionBuilder builder() { - return new DeleteOfflineTransactionForTransactionBuilder(); - } - - public static final class DeleteOfflineTransactionForTransactionBuilder { - - private String comment; - - private DeleteOfflineTransactionForTransactionBuilder() {} - - public DeleteOfflineTransactionForTransactionBuilder comment(String value) { - this.comment = value; - return this; - } - - public DeleteOfflineTransactionForTransactionParams build() { - return new DeleteOfflineTransactionForTransactionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/DeleteOfflineTransactionParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/DeleteOfflineTransactionParams.java new file mode 100644 index 00000000..a8418299 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/transaction/params/DeleteOfflineTransactionParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.transaction.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class DeleteOfflineTransactionParams { + + private final String comment; + + private DeleteOfflineTransactionParams(DeleteOfflineTransactionBuilder builder) { + + this.comment = builder.comment; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for DeleteOfflineTransactionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static DeleteOfflineTransactionBuilder builder() { + return new DeleteOfflineTransactionBuilder(); + } + + public static final class DeleteOfflineTransactionBuilder { + + private String comment; + + private DeleteOfflineTransactionBuilder() {} + + public DeleteOfflineTransactionBuilder comment(String value) { + this.comment = value; + return this; + } + + public DeleteOfflineTransactionParams build() { + return new DeleteOfflineTransactionParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/ReconcileForTransactionParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/ReconcileForTransactionParams.java deleted file mode 100644 index fa9efb45..00000000 --- a/src/main/java/com/chargebee/v4/models/transaction/params/ReconcileForTransactionParams.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.transaction.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ReconcileForTransactionParams { - - private final String idAtGateway; - - private final String customerId; - - private final Status status; - - private ReconcileForTransactionParams(ReconcileForTransactionBuilder builder) { - - this.idAtGateway = builder.idAtGateway; - - this.customerId = builder.customerId; - - this.status = builder.status; - } - - public String getIdAtGateway() { - return idAtGateway; - } - - public String getCustomerId() { - return customerId; - } - - public Status getStatus() { - return status; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.idAtGateway != null) { - - formData.put("id_at_gateway", this.idAtGateway); - } - - if (this.customerId != null) { - - formData.put("customer_id", this.customerId); - } - - if (this.status != null) { - - formData.put("status", this.status); - } - - return formData; - } - - /** Create a new builder for ReconcileForTransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ReconcileForTransactionBuilder builder() { - return new ReconcileForTransactionBuilder(); - } - - public static final class ReconcileForTransactionBuilder { - - private String idAtGateway; - - private String customerId; - - private Status status; - - private ReconcileForTransactionBuilder() {} - - public ReconcileForTransactionBuilder idAtGateway(String value) { - this.idAtGateway = value; - return this; - } - - public ReconcileForTransactionBuilder customerId(String value) { - this.customerId = value; - return this; - } - - public ReconcileForTransactionBuilder status(Status value) { - this.status = value; - return this; - } - - public ReconcileForTransactionParams build() { - return new ReconcileForTransactionParams(this); - } - } - - public enum Status { - SUCCESS("success"), - - FAILURE("failure"), - - /** An enum member indicating that Status was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Status(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Status fromString(String value) { - if (value == null) return _UNKNOWN; - for (Status enumValue : Status.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/RecordRefundForTransactionParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/RecordRefundForTransactionParams.java deleted file mode 100644 index d10cc442..00000000 --- a/src/main/java/com/chargebee/v4/models/transaction/params/RecordRefundForTransactionParams.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.transaction.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class RecordRefundForTransactionParams { - - private final Long amount; - - private final PaymentMethod paymentMethod; - - private final Timestamp date; - - private final String referenceNumber; - - private final String customPaymentMethodId; - - private final String comment; - - private RecordRefundForTransactionParams(RecordRefundForTransactionBuilder builder) { - - this.amount = builder.amount; - - this.paymentMethod = builder.paymentMethod; - - this.date = builder.date; - - this.referenceNumber = builder.referenceNumber; - - this.customPaymentMethodId = builder.customPaymentMethodId; - - this.comment = builder.comment; - } - - public Long getAmount() { - return amount; - } - - public PaymentMethod getPaymentMethod() { - return paymentMethod; - } - - public Timestamp getDate() { - return date; - } - - public String getReferenceNumber() { - return referenceNumber; - } - - public String getCustomPaymentMethodId() { - return customPaymentMethodId; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.paymentMethod != null) { - - formData.put("payment_method", this.paymentMethod); - } - - if (this.date != null) { - - formData.put("date", this.date); - } - - if (this.referenceNumber != null) { - - formData.put("reference_number", this.referenceNumber); - } - - if (this.customPaymentMethodId != null) { - - formData.put("custom_payment_method_id", this.customPaymentMethodId); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for RecordRefundForTransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RecordRefundForTransactionBuilder builder() { - return new RecordRefundForTransactionBuilder(); - } - - public static final class RecordRefundForTransactionBuilder { - - private Long amount; - - private PaymentMethod paymentMethod; - - private Timestamp date; - - private String referenceNumber; - - private String customPaymentMethodId; - - private String comment; - - private RecordRefundForTransactionBuilder() {} - - public RecordRefundForTransactionBuilder amount(Long value) { - this.amount = value; - return this; - } - - public RecordRefundForTransactionBuilder paymentMethod(PaymentMethod value) { - this.paymentMethod = value; - return this; - } - - public RecordRefundForTransactionBuilder date(Timestamp value) { - this.date = value; - return this; - } - - public RecordRefundForTransactionBuilder referenceNumber(String value) { - this.referenceNumber = value; - return this; - } - - public RecordRefundForTransactionBuilder customPaymentMethodId(String value) { - this.customPaymentMethodId = value; - return this; - } - - public RecordRefundForTransactionBuilder comment(String value) { - this.comment = value; - return this; - } - - public RecordRefundForTransactionParams build() { - return new RecordRefundForTransactionParams(this); - } - } - - public enum PaymentMethod { - CASH("cash"), - - CHECK("check"), - - CHARGEBACK("chargeback"), - - BANK_TRANSFER("bank_transfer"), - - OTHER("other"), - - APP_STORE("app_store"), - - PLAY_STORE("play_store"), - - CUSTOM("custom"), - - /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - PaymentMethod(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static PaymentMethod fromString(String value) { - if (value == null) return _UNKNOWN; - for (PaymentMethod enumValue : PaymentMethod.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/RefundForTransactionParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/RefundForTransactionParams.java deleted file mode 100644 index f37ed675..00000000 --- a/src/main/java/com/chargebee/v4/models/transaction/params/RefundForTransactionParams.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.transaction.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class RefundForTransactionParams { - - private final Long amount; - - private final String comment; - - private RefundForTransactionParams(RefundForTransactionBuilder builder) { - - this.amount = builder.amount; - - this.comment = builder.comment; - } - - public Long getAmount() { - return amount; - } - - public String getComment() { - return comment; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.amount != null) { - - formData.put("amount", this.amount); - } - - if (this.comment != null) { - - formData.put("comment", this.comment); - } - - return formData; - } - - /** Create a new builder for RefundForTransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static RefundForTransactionBuilder builder() { - return new RefundForTransactionBuilder(); - } - - public static final class RefundForTransactionBuilder { - - private Long amount; - - private String comment; - - private RefundForTransactionBuilder() {} - - public RefundForTransactionBuilder amount(Long value) { - this.amount = value; - return this; - } - - public RefundForTransactionBuilder comment(String value) { - this.comment = value; - return this; - } - - public RefundForTransactionParams build() { - return new RefundForTransactionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/SyncForTransactionParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/SyncForTransactionParams.java deleted file mode 100644 index f5aa00fd..00000000 --- a/src/main/java/com/chargebee/v4/models/transaction/params/SyncForTransactionParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.transaction.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class SyncForTransactionParams { - - private SyncForTransactionParams(SyncForTransactionBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for SyncForTransactionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SyncForTransactionBuilder builder() { - return new SyncForTransactionBuilder(); - } - - public static final class SyncForTransactionBuilder { - - private SyncForTransactionBuilder() {} - - public SyncForTransactionParams build() { - return new SyncForTransactionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/SyncTransactionParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/SyncTransactionParams.java new file mode 100644 index 00000000..0a254ebb --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/transaction/params/SyncTransactionParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.transaction.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class SyncTransactionParams { + + private SyncTransactionParams(SyncTransactionBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for SyncTransactionParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static SyncTransactionBuilder builder() { + return new SyncTransactionBuilder(); + } + + public static final class SyncTransactionBuilder { + + private SyncTransactionBuilder() {} + + public SyncTransactionParams build() { + return new SyncTransactionParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/TransactionReconcileParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/TransactionReconcileParams.java new file mode 100644 index 00000000..4fcfe608 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/transaction/params/TransactionReconcileParams.java @@ -0,0 +1,128 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.transaction.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class TransactionReconcileParams { + + private final String idAtGateway; + + private final String customerId; + + private final Status status; + + private TransactionReconcileParams(TransactionReconcileBuilder builder) { + + this.idAtGateway = builder.idAtGateway; + + this.customerId = builder.customerId; + + this.status = builder.status; + } + + public String getIdAtGateway() { + return idAtGateway; + } + + public String getCustomerId() { + return customerId; + } + + public Status getStatus() { + return status; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.idAtGateway != null) { + + formData.put("id_at_gateway", this.idAtGateway); + } + + if (this.customerId != null) { + + formData.put("customer_id", this.customerId); + } + + if (this.status != null) { + + formData.put("status", this.status); + } + + return formData; + } + + /** Create a new builder for TransactionReconcileParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TransactionReconcileBuilder builder() { + return new TransactionReconcileBuilder(); + } + + public static final class TransactionReconcileBuilder { + + private String idAtGateway; + + private String customerId; + + private Status status; + + private TransactionReconcileBuilder() {} + + public TransactionReconcileBuilder idAtGateway(String value) { + this.idAtGateway = value; + return this; + } + + public TransactionReconcileBuilder customerId(String value) { + this.customerId = value; + return this; + } + + public TransactionReconcileBuilder status(Status value) { + this.status = value; + return this; + } + + public TransactionReconcileParams build() { + return new TransactionReconcileParams(this); + } + } + + public enum Status { + SUCCESS("success"), + + FAILURE("failure"), + + /** An enum member indicating that Status was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Status(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Status fromString(String value) { + if (value == null) return _UNKNOWN; + for (Status enumValue : Status.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/TransactionRecordRefundParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/TransactionRecordRefundParams.java new file mode 100644 index 00000000..73d6690f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/transaction/params/TransactionRecordRefundParams.java @@ -0,0 +1,201 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.transaction.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class TransactionRecordRefundParams { + + private final Long amount; + + private final PaymentMethod paymentMethod; + + private final Timestamp date; + + private final String referenceNumber; + + private final String customPaymentMethodId; + + private final String comment; + + private TransactionRecordRefundParams(TransactionRecordRefundBuilder builder) { + + this.amount = builder.amount; + + this.paymentMethod = builder.paymentMethod; + + this.date = builder.date; + + this.referenceNumber = builder.referenceNumber; + + this.customPaymentMethodId = builder.customPaymentMethodId; + + this.comment = builder.comment; + } + + public Long getAmount() { + return amount; + } + + public PaymentMethod getPaymentMethod() { + return paymentMethod; + } + + public Timestamp getDate() { + return date; + } + + public String getReferenceNumber() { + return referenceNumber; + } + + public String getCustomPaymentMethodId() { + return customPaymentMethodId; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.paymentMethod != null) { + + formData.put("payment_method", this.paymentMethod); + } + + if (this.date != null) { + + formData.put("date", this.date); + } + + if (this.referenceNumber != null) { + + formData.put("reference_number", this.referenceNumber); + } + + if (this.customPaymentMethodId != null) { + + formData.put("custom_payment_method_id", this.customPaymentMethodId); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for TransactionRecordRefundParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TransactionRecordRefundBuilder builder() { + return new TransactionRecordRefundBuilder(); + } + + public static final class TransactionRecordRefundBuilder { + + private Long amount; + + private PaymentMethod paymentMethod; + + private Timestamp date; + + private String referenceNumber; + + private String customPaymentMethodId; + + private String comment; + + private TransactionRecordRefundBuilder() {} + + public TransactionRecordRefundBuilder amount(Long value) { + this.amount = value; + return this; + } + + public TransactionRecordRefundBuilder paymentMethod(PaymentMethod value) { + this.paymentMethod = value; + return this; + } + + public TransactionRecordRefundBuilder date(Timestamp value) { + this.date = value; + return this; + } + + public TransactionRecordRefundBuilder referenceNumber(String value) { + this.referenceNumber = value; + return this; + } + + public TransactionRecordRefundBuilder customPaymentMethodId(String value) { + this.customPaymentMethodId = value; + return this; + } + + public TransactionRecordRefundBuilder comment(String value) { + this.comment = value; + return this; + } + + public TransactionRecordRefundParams build() { + return new TransactionRecordRefundParams(this); + } + } + + public enum PaymentMethod { + CASH("cash"), + + CHECK("check"), + + CHARGEBACK("chargeback"), + + BANK_TRANSFER("bank_transfer"), + + OTHER("other"), + + APP_STORE("app_store"), + + PLAY_STORE("play_store"), + + CUSTOM("custom"), + + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + PaymentMethod(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static PaymentMethod fromString(String value) { + if (value == null) return _UNKNOWN; + for (PaymentMethod enumValue : PaymentMethod.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/TransactionRefundParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/TransactionRefundParams.java new file mode 100644 index 00000000..d35f13a7 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/transaction/params/TransactionRefundParams.java @@ -0,0 +1,80 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.transaction.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class TransactionRefundParams { + + private final Long amount; + + private final String comment; + + private TransactionRefundParams(TransactionRefundBuilder builder) { + + this.amount = builder.amount; + + this.comment = builder.comment; + } + + public Long getAmount() { + return amount; + } + + public String getComment() { + return comment; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.comment != null) { + + formData.put("comment", this.comment); + } + + return formData; + } + + /** Create a new builder for TransactionRefundParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static TransactionRefundBuilder builder() { + return new TransactionRefundBuilder(); + } + + public static final class TransactionRefundBuilder { + + private Long amount; + + private String comment; + + private TransactionRefundBuilder() {} + + public TransactionRefundBuilder amount(Long value) { + this.amount = value; + return this; + } + + public TransactionRefundBuilder comment(String value) { + this.comment = value; + return this; + } + + public TransactionRefundParams build() { + return new TransactionRefundParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/DeleteOfflineTransactionForTransactionResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/DeleteOfflineTransactionForTransactionResponse.java deleted file mode 100644 index 2f7a4e69..00000000 --- a/src/main/java/com/chargebee/v4/models/transaction/responses/DeleteOfflineTransactionForTransactionResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.chargebee.v4.models.transaction.responses; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteOfflineTransactionForTransaction operation. Contains the - * response data from the API. - */ -public final class DeleteOfflineTransactionForTransactionResponse extends BaseResponse { - private final Transaction transaction; - - private DeleteOfflineTransactionForTransactionResponse(Builder builder) { - super(builder.httpResponse); - - this.transaction = builder.transaction; - } - - /** Parse JSON response into DeleteOfflineTransactionForTransactionResponse object. */ - public static DeleteOfflineTransactionForTransactionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into DeleteOfflineTransactionForTransactionResponse object with HTTP - * response. - */ - public static DeleteOfflineTransactionForTransactionResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse DeleteOfflineTransactionForTransactionResponse from JSON", e); - } - } - - /** Create a new builder for DeleteOfflineTransactionForTransactionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteOfflineTransactionForTransactionResponse. */ - public static class Builder { - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteOfflineTransactionForTransactionResponse build() { - return new DeleteOfflineTransactionForTransactionResponse(this); - } - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/DeleteOfflineTransactionResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/DeleteOfflineTransactionResponse.java new file mode 100644 index 00000000..4681b5bd --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/transaction/responses/DeleteOfflineTransactionResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.transaction.responses; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for DeleteOfflineTransaction operation. Contains the response data from + * the API. + */ +public final class DeleteOfflineTransactionResponse extends BaseResponse { + private final Transaction transaction; + + private DeleteOfflineTransactionResponse(Builder builder) { + super(builder.httpResponse); + + this.transaction = builder.transaction; + } + + /** Parse JSON response into DeleteOfflineTransactionResponse object. */ + public static DeleteOfflineTransactionResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into DeleteOfflineTransactionResponse object with HTTP response. */ + public static DeleteOfflineTransactionResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse DeleteOfflineTransactionResponse from JSON", e); + } + } + + /** Create a new builder for DeleteOfflineTransactionResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for DeleteOfflineTransactionResponse. */ + public static class Builder { + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public DeleteOfflineTransactionResponse build() { + return new DeleteOfflineTransactionResponse(this); + } + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/ReconcileForTransactionResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/ReconcileForTransactionResponse.java deleted file mode 100644 index 9bbb9907..00000000 --- a/src/main/java/com/chargebee/v4/models/transaction/responses/ReconcileForTransactionResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.transaction.responses; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ReconcileForTransaction operation. Contains the response data from - * the API. - */ -public final class ReconcileForTransactionResponse extends BaseResponse { - private final Transaction transaction; - - private ReconcileForTransactionResponse(Builder builder) { - super(builder.httpResponse); - - this.transaction = builder.transaction; - } - - /** Parse JSON response into ReconcileForTransactionResponse object. */ - public static ReconcileForTransactionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ReconcileForTransactionResponse object with HTTP response. */ - public static ReconcileForTransactionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse ReconcileForTransactionResponse from JSON", e); - } - } - - /** Create a new builder for ReconcileForTransactionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ReconcileForTransactionResponse. */ - public static class Builder { - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ReconcileForTransactionResponse build() { - return new ReconcileForTransactionResponse(this); - } - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/RecordRefundForTransactionResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/RecordRefundForTransactionResponse.java deleted file mode 100644 index 081bf036..00000000 --- a/src/main/java/com/chargebee/v4/models/transaction/responses/RecordRefundForTransactionResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.transaction.responses; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RecordRefundForTransaction operation. Contains the response data - * from the API. - */ -public final class RecordRefundForTransactionResponse extends BaseResponse { - private final Transaction transaction; - - private RecordRefundForTransactionResponse(Builder builder) { - super(builder.httpResponse); - - this.transaction = builder.transaction; - } - - /** Parse JSON response into RecordRefundForTransactionResponse object. */ - public static RecordRefundForTransactionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RecordRefundForTransactionResponse object with HTTP response. */ - public static RecordRefundForTransactionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RecordRefundForTransactionResponse from JSON", e); - } - } - - /** Create a new builder for RecordRefundForTransactionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RecordRefundForTransactionResponse. */ - public static class Builder { - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RecordRefundForTransactionResponse build() { - return new RecordRefundForTransactionResponse(this); - } - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/RefundForTransactionResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/RefundForTransactionResponse.java deleted file mode 100644 index 7beff8db..00000000 --- a/src/main/java/com/chargebee/v4/models/transaction/responses/RefundForTransactionResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.transaction.responses; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for RefundForTransaction operation. Contains the response data from the - * API. - */ -public final class RefundForTransactionResponse extends BaseResponse { - private final Transaction transaction; - - private RefundForTransactionResponse(Builder builder) { - super(builder.httpResponse); - - this.transaction = builder.transaction; - } - - /** Parse JSON response into RefundForTransactionResponse object. */ - public static RefundForTransactionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into RefundForTransactionResponse object with HTTP response. */ - public static RefundForTransactionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse RefundForTransactionResponse from JSON", e); - } - } - - /** Create a new builder for RefundForTransactionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for RefundForTransactionResponse. */ - public static class Builder { - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public RefundForTransactionResponse build() { - return new RefundForTransactionResponse(this); - } - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/SyncForTransactionResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/SyncForTransactionResponse.java deleted file mode 100644 index d93b7c37..00000000 --- a/src/main/java/com/chargebee/v4/models/transaction/responses/SyncForTransactionResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.transaction.responses; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for SyncForTransaction operation. Contains the response data from the - * API. - */ -public final class SyncForTransactionResponse extends BaseResponse { - private final Transaction transaction; - - private SyncForTransactionResponse(Builder builder) { - super(builder.httpResponse); - - this.transaction = builder.transaction; - } - - /** Parse JSON response into SyncForTransactionResponse object. */ - public static SyncForTransactionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into SyncForTransactionResponse object with HTTP response. */ - public static SyncForTransactionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse SyncForTransactionResponse from JSON", e); - } - } - - /** Create a new builder for SyncForTransactionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for SyncForTransactionResponse. */ - public static class Builder { - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public SyncForTransactionResponse build() { - return new SyncForTransactionResponse(this); - } - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/SyncTransactionResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/SyncTransactionResponse.java new file mode 100644 index 00000000..c251bf61 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/transaction/responses/SyncTransactionResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.transaction.responses; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for SyncTransaction operation. Contains the response data from the API. + */ +public final class SyncTransactionResponse extends BaseResponse { + private final Transaction transaction; + + private SyncTransactionResponse(Builder builder) { + super(builder.httpResponse); + + this.transaction = builder.transaction; + } + + /** Parse JSON response into SyncTransactionResponse object. */ + public static SyncTransactionResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into SyncTransactionResponse object with HTTP response. */ + public static SyncTransactionResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SyncTransactionResponse from JSON", e); + } + } + + /** Create a new builder for SyncTransactionResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for SyncTransactionResponse. */ + public static class Builder { + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public SyncTransactionResponse build() { + return new SyncTransactionResponse(this); + } + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionListResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionListResponse.java index 8a8c6427..2918150c 100644 --- a/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionListResponse.java +++ b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.transaction.Transaction; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.TransactionService; @@ -98,9 +99,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public TransactionListResponse nextPage() throws Exception { + public TransactionListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionPaymentsForInvoiceResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionPaymentsForInvoiceResponse.java index e3bac524..655917f5 100644 --- a/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionPaymentsForInvoiceResponse.java +++ b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionPaymentsForInvoiceResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.transaction.Transaction; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.TransactionService; @@ -110,9 +111,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public TransactionPaymentsForInvoiceResponse nextPage() throws Exception { + public TransactionPaymentsForInvoiceResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionReconcileResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionReconcileResponse.java new file mode 100644 index 00000000..2a5dabf3 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionReconcileResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.transaction.responses; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for TransactionReconcile operation. Contains the response data from the + * API. + */ +public final class TransactionReconcileResponse extends BaseResponse { + private final Transaction transaction; + + private TransactionReconcileResponse(Builder builder) { + super(builder.httpResponse); + + this.transaction = builder.transaction; + } + + /** Parse JSON response into TransactionReconcileResponse object. */ + public static TransactionReconcileResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into TransactionReconcileResponse object with HTTP response. */ + public static TransactionReconcileResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse TransactionReconcileResponse from JSON", e); + } + } + + /** Create a new builder for TransactionReconcileResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for TransactionReconcileResponse. */ + public static class Builder { + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public TransactionReconcileResponse build() { + return new TransactionReconcileResponse(this); + } + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionRecordRefundResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionRecordRefundResponse.java new file mode 100644 index 00000000..8e4faa07 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionRecordRefundResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.transaction.responses; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for TransactionRecordRefund operation. Contains the response data from + * the API. + */ +public final class TransactionRecordRefundResponse extends BaseResponse { + private final Transaction transaction; + + private TransactionRecordRefundResponse(Builder builder) { + super(builder.httpResponse); + + this.transaction = builder.transaction; + } + + /** Parse JSON response into TransactionRecordRefundResponse object. */ + public static TransactionRecordRefundResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into TransactionRecordRefundResponse object with HTTP response. */ + public static TransactionRecordRefundResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse TransactionRecordRefundResponse from JSON", e); + } + } + + /** Create a new builder for TransactionRecordRefundResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for TransactionRecordRefundResponse. */ + public static class Builder { + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public TransactionRecordRefundResponse build() { + return new TransactionRecordRefundResponse(this); + } + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionRefundResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionRefundResponse.java new file mode 100644 index 00000000..8e8b9792 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionRefundResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.transaction.responses; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for TransactionRefund operation. Contains the response data from the + * API. + */ +public final class TransactionRefundResponse extends BaseResponse { + private final Transaction transaction; + + private TransactionRefundResponse(Builder builder) { + super(builder.httpResponse); + + this.transaction = builder.transaction; + } + + /** Parse JSON response into TransactionRefundResponse object. */ + public static TransactionRefundResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into TransactionRefundResponse object with HTTP response. */ + public static TransactionRefundResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse TransactionRefundResponse from JSON", e); + } + } + + /** Create a new builder for TransactionRefundResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for TransactionRefundResponse. */ + public static class Builder { + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public TransactionRefundResponse build() { + return new TransactionRefundResponse(this); + } + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionsForCustomerResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionsForCustomerResponse.java index d07b1edc..5f2c8651 100644 --- a/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionsForCustomerResponse.java +++ b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionsForCustomerResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.transaction.Transaction; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.TransactionService; @@ -107,9 +108,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public TransactionsForCustomerResponse nextPage() throws Exception { + public TransactionsForCustomerResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionsForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionsForSubscriptionResponse.java index a683c620..6607d906 100644 --- a/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionsForSubscriptionResponse.java +++ b/src/main/java/com/chargebee/v4/models/transaction/responses/TransactionsForSubscriptionResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.transaction.Transaction; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.TransactionService; @@ -110,9 +111,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public TransactionsForSubscriptionResponse nextPage() throws Exception { + public TransactionsForSubscriptionResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/unbilledCharge/params/DeleteUnbilledChargeParams.java b/src/main/java/com/chargebee/v4/models/unbilledCharge/params/DeleteUnbilledChargeParams.java deleted file mode 100644 index 6805fa44..00000000 --- a/src/main/java/com/chargebee/v4/models/unbilledCharge/params/DeleteUnbilledChargeParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.unbilledCharge.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteUnbilledChargeParams { - - private DeleteUnbilledChargeParams(DeleteUnbilledChargeBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteUnbilledChargeParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteUnbilledChargeBuilder builder() { - return new DeleteUnbilledChargeBuilder(); - } - - public static final class DeleteUnbilledChargeBuilder { - - private DeleteUnbilledChargeBuilder() {} - - public DeleteUnbilledChargeParams build() { - return new DeleteUnbilledChargeParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/unbilledCharge/params/UnbilledChargeDeleteParams.java b/src/main/java/com/chargebee/v4/models/unbilledCharge/params/UnbilledChargeDeleteParams.java new file mode 100644 index 00000000..b2d4baf5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/unbilledCharge/params/UnbilledChargeDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.unbilledCharge.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class UnbilledChargeDeleteParams { + + private UnbilledChargeDeleteParams(UnbilledChargeDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for UnbilledChargeDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UnbilledChargeDeleteBuilder builder() { + return new UnbilledChargeDeleteBuilder(); + } + + public static final class UnbilledChargeDeleteBuilder { + + private UnbilledChargeDeleteBuilder() {} + + public UnbilledChargeDeleteParams build() { + return new UnbilledChargeDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/unbilledCharge/responses/DeleteUnbilledChargeResponse.java b/src/main/java/com/chargebee/v4/models/unbilledCharge/responses/DeleteUnbilledChargeResponse.java deleted file mode 100644 index 15c40442..00000000 --- a/src/main/java/com/chargebee/v4/models/unbilledCharge/responses/DeleteUnbilledChargeResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.unbilledCharge.responses; - -import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteUnbilledCharge operation. Contains the response data from the - * API. - */ -public final class DeleteUnbilledChargeResponse extends BaseResponse { - private final UnbilledCharge unbilledCharge; - - private DeleteUnbilledChargeResponse(Builder builder) { - super(builder.httpResponse); - - this.unbilledCharge = builder.unbilledCharge; - } - - /** Parse JSON response into DeleteUnbilledChargeResponse object. */ - public static DeleteUnbilledChargeResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteUnbilledChargeResponse object with HTTP response. */ - public static DeleteUnbilledChargeResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __unbilledChargeJson = JsonUtil.getObject(json, "unbilled_charge"); - if (__unbilledChargeJson != null) { - builder.unbilledCharge(UnbilledCharge.fromJson(__unbilledChargeJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteUnbilledChargeResponse from JSON", e); - } - } - - /** Create a new builder for DeleteUnbilledChargeResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteUnbilledChargeResponse. */ - public static class Builder { - - private UnbilledCharge unbilledCharge; - - private Response httpResponse; - - private Builder() {} - - public Builder unbilledCharge(UnbilledCharge unbilledCharge) { - this.unbilledCharge = unbilledCharge; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteUnbilledChargeResponse build() { - return new DeleteUnbilledChargeResponse(this); - } - } - - /** Get the unbilledCharge from the response. */ - public UnbilledCharge getUnbilledCharge() { - return unbilledCharge; - } -} diff --git a/src/main/java/com/chargebee/v4/models/unbilledCharge/responses/UnbilledChargeDeleteResponse.java b/src/main/java/com/chargebee/v4/models/unbilledCharge/responses/UnbilledChargeDeleteResponse.java new file mode 100644 index 00000000..225b3e9f --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/unbilledCharge/responses/UnbilledChargeDeleteResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.unbilledCharge.responses; + +import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for UnbilledChargeDelete operation. Contains the response data from the + * API. + */ +public final class UnbilledChargeDeleteResponse extends BaseResponse { + private final UnbilledCharge unbilledCharge; + + private UnbilledChargeDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.unbilledCharge = builder.unbilledCharge; + } + + /** Parse JSON response into UnbilledChargeDeleteResponse object. */ + public static UnbilledChargeDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into UnbilledChargeDeleteResponse object with HTTP response. */ + public static UnbilledChargeDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __unbilledChargeJson = JsonUtil.getObject(json, "unbilled_charge"); + if (__unbilledChargeJson != null) { + builder.unbilledCharge(UnbilledCharge.fromJson(__unbilledChargeJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse UnbilledChargeDeleteResponse from JSON", e); + } + } + + /** Create a new builder for UnbilledChargeDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for UnbilledChargeDeleteResponse. */ + public static class Builder { + + private UnbilledCharge unbilledCharge; + + private Response httpResponse; + + private Builder() {} + + public Builder unbilledCharge(UnbilledCharge unbilledCharge) { + this.unbilledCharge = unbilledCharge; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public UnbilledChargeDeleteResponse build() { + return new UnbilledChargeDeleteResponse(this); + } + } + + /** Get the unbilledCharge from the response. */ + public UnbilledCharge getUnbilledCharge() { + return unbilledCharge; + } +} diff --git a/src/main/java/com/chargebee/v4/models/unbilledCharge/responses/UnbilledChargeListResponse.java b/src/main/java/com/chargebee/v4/models/unbilledCharge/responses/UnbilledChargeListResponse.java index 231e0a64..216dea96 100644 --- a/src/main/java/com/chargebee/v4/models/unbilledCharge/responses/UnbilledChargeListResponse.java +++ b/src/main/java/com/chargebee/v4/models/unbilledCharge/responses/UnbilledChargeListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.unbilledCharge.UnbilledCharge; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.UnbilledChargeService; @@ -99,9 +100,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public UnbilledChargeListResponse nextPage() throws Exception { + public UnbilledChargeListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/params/UnbilledChargesSettingExecuteParams.java b/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/params/UnbilledChargesSettingExecuteParams.java deleted file mode 100644 index 302a34d0..00000000 --- a/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/params/UnbilledChargesSettingExecuteParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.unbilledChargesSetting.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UnbilledChargesSettingExecuteParams { - - private final Map queryParams; - - private UnbilledChargesSettingExecuteParams(UnbilledChargesSettingExecuteBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public UnbilledChargesSettingExecuteBuilder toBuilder() { - UnbilledChargesSettingExecuteBuilder builder = new UnbilledChargesSettingExecuteBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for UnbilledChargesSettingExecuteParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UnbilledChargesSettingExecuteBuilder builder() { - return new UnbilledChargesSettingExecuteBuilder(); - } - - public static final class UnbilledChargesSettingExecuteBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private UnbilledChargesSettingExecuteBuilder() {} - - public UnbilledChargesSettingExecuteParams build() { - return new UnbilledChargesSettingExecuteParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/params/UnbilledChargesSettingRetrieveParams.java b/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/params/UnbilledChargesSettingRetrieveParams.java new file mode 100644 index 00000000..6a584118 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/params/UnbilledChargesSettingRetrieveParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.unbilledChargesSetting.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class UnbilledChargesSettingRetrieveParams { + + private final Map queryParams; + + private UnbilledChargesSettingRetrieveParams(UnbilledChargesSettingRetrieveBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public UnbilledChargesSettingRetrieveBuilder toBuilder() { + UnbilledChargesSettingRetrieveBuilder builder = new UnbilledChargesSettingRetrieveBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for UnbilledChargesSettingRetrieveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UnbilledChargesSettingRetrieveBuilder builder() { + return new UnbilledChargesSettingRetrieveBuilder(); + } + + public static final class UnbilledChargesSettingRetrieveBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private UnbilledChargesSettingRetrieveBuilder() {} + + public UnbilledChargesSettingRetrieveParams build() { + return new UnbilledChargesSettingRetrieveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/responses/UnbilledChargesSettingExecuteResponse.java b/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/responses/UnbilledChargesSettingExecuteResponse.java deleted file mode 100644 index 29cacb0c..00000000 --- a/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/responses/UnbilledChargesSettingExecuteResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.chargebee.v4.models.unbilledChargesSetting.responses; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UnbilledChargesSettingExecute operation. Contains the response data - * from a single resource get operation. - */ -public final class UnbilledChargesSettingExecuteResponse extends BaseResponse { - private final Object unbilledChargesSetting; - - private UnbilledChargesSettingExecuteResponse(Builder builder) { - super(builder.httpResponse); - - this.unbilledChargesSetting = builder.unbilledChargesSetting; - } - - /** Parse JSON response into UnbilledChargesSettingExecuteResponse object. */ - public static UnbilledChargesSettingExecuteResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UnbilledChargesSettingExecuteResponse object with HTTP response. */ - public static UnbilledChargesSettingExecuteResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.unbilledChargesSetting(JsonUtil.getObject(json, "unbilled_charges_setting")); - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse UnbilledChargesSettingExecuteResponse from JSON", e); - } - } - - /** Create a new builder for UnbilledChargesSettingExecuteResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UnbilledChargesSettingExecuteResponse. */ - public static class Builder { - - private Object unbilledChargesSetting; - - private Response httpResponse; - - private Builder() {} - - public Builder unbilledChargesSetting(Object unbilledChargesSetting) { - this.unbilledChargesSetting = unbilledChargesSetting; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UnbilledChargesSettingExecuteResponse build() { - return new UnbilledChargesSettingExecuteResponse(this); - } - } - - /** Get the unbilledChargesSetting from the response. */ - public Object getUnbilledChargesSetting() { - return unbilledChargesSetting; - } -} diff --git a/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/responses/UnbilledChargesSettingRetrieveResponse.java b/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/responses/UnbilledChargesSettingRetrieveResponse.java new file mode 100644 index 00000000..27652056 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/unbilledChargesSetting/responses/UnbilledChargesSettingRetrieveResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.unbilledChargesSetting.responses; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for UnbilledChargesSettingRetrieve operation. Contains the response + * data from a single resource get operation. + */ +public final class UnbilledChargesSettingRetrieveResponse extends BaseResponse { + private final Object unbilledChargesSetting; + + private UnbilledChargesSettingRetrieveResponse(Builder builder) { + super(builder.httpResponse); + + this.unbilledChargesSetting = builder.unbilledChargesSetting; + } + + /** Parse JSON response into UnbilledChargesSettingRetrieveResponse object. */ + public static UnbilledChargesSettingRetrieveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into UnbilledChargesSettingRetrieveResponse object with HTTP response. */ + public static UnbilledChargesSettingRetrieveResponse fromJson( + String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.unbilledChargesSetting(JsonUtil.getObject(json, "unbilled_charges_setting")); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse UnbilledChargesSettingRetrieveResponse from JSON", e); + } + } + + /** Create a new builder for UnbilledChargesSettingRetrieveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for UnbilledChargesSettingRetrieveResponse. */ + public static class Builder { + + private Object unbilledChargesSetting; + + private Response httpResponse; + + private Builder() {} + + public Builder unbilledChargesSetting(Object unbilledChargesSetting) { + this.unbilledChargesSetting = unbilledChargesSetting; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public UnbilledChargesSettingRetrieveResponse build() { + return new UnbilledChargesSettingRetrieveResponse(this); + } + } + + /** Get the unbilledChargesSetting from the response. */ + public Object getUnbilledChargesSetting() { + return unbilledChargesSetting; + } +} diff --git a/src/main/java/com/chargebee/v4/models/usage/params/AddUsageForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/usage/params/AddUsageForSubscriptionParams.java deleted file mode 100644 index 3d39ff79..00000000 --- a/src/main/java/com/chargebee/v4/models/usage/params/AddUsageForSubscriptionParams.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.usage.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.sql.Timestamp; - -public final class AddUsageForSubscriptionParams { - - private final String id; - - private final String itemPriceId; - - private final String quantity; - - private final Timestamp usageDate; - - private final DedupeOption dedupeOption; - - private final String note; - - private AddUsageForSubscriptionParams(AddUsageForSubscriptionBuilder builder) { - - this.id = builder.id; - - this.itemPriceId = builder.itemPriceId; - - this.quantity = builder.quantity; - - this.usageDate = builder.usageDate; - - this.dedupeOption = builder.dedupeOption; - - this.note = builder.note; - } - - public String getId() { - return id; - } - - public String getItemPriceId() { - return itemPriceId; - } - - public String getQuantity() { - return quantity; - } - - public Timestamp getUsageDate() { - return usageDate; - } - - public DedupeOption getDedupeOption() { - return dedupeOption; - } - - public String getNote() { - return note; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.itemPriceId != null) { - - formData.put("item_price_id", this.itemPriceId); - } - - if (this.quantity != null) { - - formData.put("quantity", this.quantity); - } - - if (this.usageDate != null) { - - formData.put("usage_date", this.usageDate); - } - - if (this.dedupeOption != null) { - - formData.put("dedupe_option", this.dedupeOption); - } - - if (this.note != null) { - - formData.put("note", this.note); - } - - return formData; - } - - /** Create a new builder for AddUsageForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddUsageForSubscriptionBuilder builder() { - return new AddUsageForSubscriptionBuilder(); - } - - public static final class AddUsageForSubscriptionBuilder { - - private String id; - - private String itemPriceId; - - private String quantity; - - private Timestamp usageDate; - - private DedupeOption dedupeOption; - - private String note; - - private AddUsageForSubscriptionBuilder() {} - - public AddUsageForSubscriptionBuilder id(String value) { - this.id = value; - return this; - } - - public AddUsageForSubscriptionBuilder itemPriceId(String value) { - this.itemPriceId = value; - return this; - } - - public AddUsageForSubscriptionBuilder quantity(String value) { - this.quantity = value; - return this; - } - - public AddUsageForSubscriptionBuilder usageDate(Timestamp value) { - this.usageDate = value; - return this; - } - - @Deprecated - public AddUsageForSubscriptionBuilder dedupeOption(DedupeOption value) { - this.dedupeOption = value; - return this; - } - - public AddUsageForSubscriptionBuilder note(String value) { - this.note = value; - return this; - } - - public AddUsageForSubscriptionParams build() { - return new AddUsageForSubscriptionParams(this); - } - } - - public enum DedupeOption { - SKIP("skip"), - - UPDATE_EXISTING("update_existing"), - - /** An enum member indicating that DedupeOption was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - DedupeOption(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DedupeOption fromString(String value) { - if (value == null) return _UNKNOWN; - for (DedupeOption enumValue : DedupeOption.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/usage/params/DeleteUsageForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/usage/params/DeleteUsageForSubscriptionParams.java deleted file mode 100644 index dbea4040..00000000 --- a/src/main/java/com/chargebee/v4/models/usage/params/DeleteUsageForSubscriptionParams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.usage.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteUsageForSubscriptionParams { - - private final String id; - - private DeleteUsageForSubscriptionParams(DeleteUsageForSubscriptionBuilder builder) { - - this.id = builder.id; - } - - public String getId() { - return id; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - return formData; - } - - /** Create a new builder for DeleteUsageForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteUsageForSubscriptionBuilder builder() { - return new DeleteUsageForSubscriptionBuilder(); - } - - public static final class DeleteUsageForSubscriptionBuilder { - - private String id; - - private DeleteUsageForSubscriptionBuilder() {} - - public DeleteUsageForSubscriptionBuilder id(String value) { - this.id = value; - return this; - } - - public DeleteUsageForSubscriptionParams build() { - return new DeleteUsageForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/usage/params/UsageCreateParams.java b/src/main/java/com/chargebee/v4/models/usage/params/UsageCreateParams.java new file mode 100644 index 00000000..99ca7dc5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/usage/params/UsageCreateParams.java @@ -0,0 +1,190 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.usage.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class UsageCreateParams { + + private final String id; + + private final String itemPriceId; + + private final String quantity; + + private final Timestamp usageDate; + + private final DedupeOption dedupeOption; + + private final String note; + + private UsageCreateParams(UsageCreateBuilder builder) { + + this.id = builder.id; + + this.itemPriceId = builder.itemPriceId; + + this.quantity = builder.quantity; + + this.usageDate = builder.usageDate; + + this.dedupeOption = builder.dedupeOption; + + this.note = builder.note; + } + + public String getId() { + return id; + } + + public String getItemPriceId() { + return itemPriceId; + } + + public String getQuantity() { + return quantity; + } + + public Timestamp getUsageDate() { + return usageDate; + } + + public DedupeOption getDedupeOption() { + return dedupeOption; + } + + public String getNote() { + return note; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.itemPriceId != null) { + + formData.put("item_price_id", this.itemPriceId); + } + + if (this.quantity != null) { + + formData.put("quantity", this.quantity); + } + + if (this.usageDate != null) { + + formData.put("usage_date", this.usageDate); + } + + if (this.dedupeOption != null) { + + formData.put("dedupe_option", this.dedupeOption); + } + + if (this.note != null) { + + formData.put("note", this.note); + } + + return formData; + } + + /** Create a new builder for UsageCreateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UsageCreateBuilder builder() { + return new UsageCreateBuilder(); + } + + public static final class UsageCreateBuilder { + + private String id; + + private String itemPriceId; + + private String quantity; + + private Timestamp usageDate; + + private DedupeOption dedupeOption; + + private String note; + + private UsageCreateBuilder() {} + + public UsageCreateBuilder id(String value) { + this.id = value; + return this; + } + + public UsageCreateBuilder itemPriceId(String value) { + this.itemPriceId = value; + return this; + } + + public UsageCreateBuilder quantity(String value) { + this.quantity = value; + return this; + } + + public UsageCreateBuilder usageDate(Timestamp value) { + this.usageDate = value; + return this; + } + + @Deprecated + public UsageCreateBuilder dedupeOption(DedupeOption value) { + this.dedupeOption = value; + return this; + } + + public UsageCreateBuilder note(String value) { + this.note = value; + return this; + } + + public UsageCreateParams build() { + return new UsageCreateParams(this); + } + } + + public enum DedupeOption { + SKIP("skip"), + + UPDATE_EXISTING("update_existing"), + + /** An enum member indicating that DedupeOption was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + DedupeOption(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DedupeOption fromString(String value) { + if (value == null) return _UNKNOWN; + for (DedupeOption enumValue : DedupeOption.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/usage/params/UsageDeleteParams.java b/src/main/java/com/chargebee/v4/models/usage/params/UsageDeleteParams.java new file mode 100644 index 00000000..97f847a5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/usage/params/UsageDeleteParams.java @@ -0,0 +1,60 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.usage.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class UsageDeleteParams { + + private final String id; + + private UsageDeleteParams(UsageDeleteBuilder builder) { + + this.id = builder.id; + } + + public String getId() { + return id; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + return formData; + } + + /** Create a new builder for UsageDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UsageDeleteBuilder builder() { + return new UsageDeleteBuilder(); + } + + public static final class UsageDeleteBuilder { + + private String id; + + private UsageDeleteBuilder() {} + + public UsageDeleteBuilder id(String value) { + this.id = value; + return this; + } + + public UsageDeleteParams build() { + return new UsageDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/usage/params/UsageRetrieveParams.java b/src/main/java/com/chargebee/v4/models/usage/params/UsageRetrieveParams.java new file mode 100644 index 00000000..44f04222 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/usage/params/UsageRetrieveParams.java @@ -0,0 +1,55 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.usage.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class UsageRetrieveParams { + + private final Map queryParams; + + private UsageRetrieveParams(UsageRetrieveBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public UsageRetrieveBuilder toBuilder() { + UsageRetrieveBuilder builder = new UsageRetrieveBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for UsageRetrieveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UsageRetrieveBuilder builder() { + return new UsageRetrieveBuilder(); + } + + public static final class UsageRetrieveBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private UsageRetrieveBuilder() {} + + public UsageRetrieveBuilder id(String value) { + queryParams.put("id", value); + return this; + } + + public UsageRetrieveParams build() { + return new UsageRetrieveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/usage/params/UsagesForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/usage/params/UsagesForSubscriptionParams.java deleted file mode 100644 index 56f32857..00000000 --- a/src/main/java/com/chargebee/v4/models/usage/params/UsagesForSubscriptionParams.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.usage.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class UsagesForSubscriptionParams { - - private final Map queryParams; - - private UsagesForSubscriptionParams(UsagesForSubscriptionBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public UsagesForSubscriptionBuilder toBuilder() { - UsagesForSubscriptionBuilder builder = new UsagesForSubscriptionBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for UsagesForSubscriptionParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UsagesForSubscriptionBuilder builder() { - return new UsagesForSubscriptionBuilder(); - } - - public static final class UsagesForSubscriptionBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private UsagesForSubscriptionBuilder() {} - - public UsagesForSubscriptionBuilder id(String value) { - queryParams.put("id", value); - return this; - } - - public UsagesForSubscriptionParams build() { - return new UsagesForSubscriptionParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/usage/responses/AddUsageForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/usage/responses/AddUsageForSubscriptionResponse.java deleted file mode 100644 index f3447309..00000000 --- a/src/main/java/com/chargebee/v4/models/usage/responses/AddUsageForSubscriptionResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.usage.responses; - -import com.chargebee.v4.models.usage.Usage; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddUsageForSubscription operation. Contains the response data from - * the API. - */ -public final class AddUsageForSubscriptionResponse extends BaseResponse { - private final Usage usage; - - private AddUsageForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.usage = builder.usage; - } - - /** Parse JSON response into AddUsageForSubscriptionResponse object. */ - public static AddUsageForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddUsageForSubscriptionResponse object with HTTP response. */ - public static AddUsageForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __usageJson = JsonUtil.getObject(json, "usage"); - if (__usageJson != null) { - builder.usage(Usage.fromJson(__usageJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddUsageForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for AddUsageForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddUsageForSubscriptionResponse. */ - public static class Builder { - - private Usage usage; - - private Response httpResponse; - - private Builder() {} - - public Builder usage(Usage usage) { - this.usage = usage; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddUsageForSubscriptionResponse build() { - return new AddUsageForSubscriptionResponse(this); - } - } - - /** Get the usage from the response. */ - public Usage getUsage() { - return usage; - } -} diff --git a/src/main/java/com/chargebee/v4/models/usage/responses/DeleteUsageForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/usage/responses/DeleteUsageForSubscriptionResponse.java deleted file mode 100644 index a6b8e95d..00000000 --- a/src/main/java/com/chargebee/v4/models/usage/responses/DeleteUsageForSubscriptionResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.usage.responses; - -import com.chargebee.v4.models.usage.Usage; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteUsageForSubscription operation. Contains the response data - * from the API. - */ -public final class DeleteUsageForSubscriptionResponse extends BaseResponse { - private final Usage usage; - - private DeleteUsageForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.usage = builder.usage; - } - - /** Parse JSON response into DeleteUsageForSubscriptionResponse object. */ - public static DeleteUsageForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteUsageForSubscriptionResponse object with HTTP response. */ - public static DeleteUsageForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __usageJson = JsonUtil.getObject(json, "usage"); - if (__usageJson != null) { - builder.usage(Usage.fromJson(__usageJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteUsageForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for DeleteUsageForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteUsageForSubscriptionResponse. */ - public static class Builder { - - private Usage usage; - - private Response httpResponse; - - private Builder() {} - - public Builder usage(Usage usage) { - this.usage = usage; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteUsageForSubscriptionResponse build() { - return new DeleteUsageForSubscriptionResponse(this); - } - } - - /** Get the usage from the response. */ - public Usage getUsage() { - return usage; - } -} diff --git a/src/main/java/com/chargebee/v4/models/usage/responses/UsageCreateResponse.java b/src/main/java/com/chargebee/v4/models/usage/responses/UsageCreateResponse.java new file mode 100644 index 00000000..fe481c8b --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/usage/responses/UsageCreateResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.usage.responses; + +import com.chargebee.v4.models.usage.Usage; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for UsageCreate operation. Contains the response data from the API. */ +public final class UsageCreateResponse extends BaseResponse { + private final Usage usage; + + private UsageCreateResponse(Builder builder) { + super(builder.httpResponse); + + this.usage = builder.usage; + } + + /** Parse JSON response into UsageCreateResponse object. */ + public static UsageCreateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into UsageCreateResponse object with HTTP response. */ + public static UsageCreateResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __usageJson = JsonUtil.getObject(json, "usage"); + if (__usageJson != null) { + builder.usage(Usage.fromJson(__usageJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse UsageCreateResponse from JSON", e); + } + } + + /** Create a new builder for UsageCreateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for UsageCreateResponse. */ + public static class Builder { + + private Usage usage; + + private Response httpResponse; + + private Builder() {} + + public Builder usage(Usage usage) { + this.usage = usage; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public UsageCreateResponse build() { + return new UsageCreateResponse(this); + } + } + + /** Get the usage from the response. */ + public Usage getUsage() { + return usage; + } +} diff --git a/src/main/java/com/chargebee/v4/models/usage/responses/UsageDeleteResponse.java b/src/main/java/com/chargebee/v4/models/usage/responses/UsageDeleteResponse.java new file mode 100644 index 00000000..28818eb5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/usage/responses/UsageDeleteResponse.java @@ -0,0 +1,74 @@ +package com.chargebee.v4.models.usage.responses; + +import com.chargebee.v4.models.usage.Usage; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** Immutable response object for UsageDelete operation. Contains the response data from the API. */ +public final class UsageDeleteResponse extends BaseResponse { + private final Usage usage; + + private UsageDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.usage = builder.usage; + } + + /** Parse JSON response into UsageDeleteResponse object. */ + public static UsageDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into UsageDeleteResponse object with HTTP response. */ + public static UsageDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __usageJson = JsonUtil.getObject(json, "usage"); + if (__usageJson != null) { + builder.usage(Usage.fromJson(__usageJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse UsageDeleteResponse from JSON", e); + } + } + + /** Create a new builder for UsageDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for UsageDeleteResponse. */ + public static class Builder { + + private Usage usage; + + private Response httpResponse; + + private Builder() {} + + public Builder usage(Usage usage) { + this.usage = usage; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public UsageDeleteResponse build() { + return new UsageDeleteResponse(this); + } + } + + /** Get the usage from the response. */ + public Usage getUsage() { + return usage; + } +} diff --git a/src/main/java/com/chargebee/v4/models/usage/responses/UsageListResponse.java b/src/main/java/com/chargebee/v4/models/usage/responses/UsageListResponse.java index da002032..b872fd12 100644 --- a/src/main/java/com/chargebee/v4/models/usage/responses/UsageListResponse.java +++ b/src/main/java/com/chargebee/v4/models/usage/responses/UsageListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.usage.Usage; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.UsageService; @@ -95,9 +96,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public UsageListResponse nextPage() throws Exception { + public UsageListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/usage/responses/UsageRetrieveResponse.java b/src/main/java/com/chargebee/v4/models/usage/responses/UsageRetrieveResponse.java new file mode 100644 index 00000000..65103296 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/usage/responses/UsageRetrieveResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.usage.responses; + +import com.chargebee.v4.models.usage.Usage; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for UsageRetrieve operation. Contains the response data from a single + * resource get operation. + */ +public final class UsageRetrieveResponse extends BaseResponse { + private final Usage usage; + + private UsageRetrieveResponse(Builder builder) { + super(builder.httpResponse); + + this.usage = builder.usage; + } + + /** Parse JSON response into UsageRetrieveResponse object. */ + public static UsageRetrieveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into UsageRetrieveResponse object with HTTP response. */ + public static UsageRetrieveResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __usageJson = JsonUtil.getObject(json, "usage"); + if (__usageJson != null) { + builder.usage(Usage.fromJson(__usageJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse UsageRetrieveResponse from JSON", e); + } + } + + /** Create a new builder for UsageRetrieveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for UsageRetrieveResponse. */ + public static class Builder { + + private Usage usage; + + private Response httpResponse; + + private Builder() {} + + public Builder usage(Usage usage) { + this.usage = usage; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public UsageRetrieveResponse build() { + return new UsageRetrieveResponse(this); + } + } + + /** Get the usage from the response. */ + public Usage getUsage() { + return usage; + } +} diff --git a/src/main/java/com/chargebee/v4/models/usage/responses/UsagesForSubscriptionResponse.java b/src/main/java/com/chargebee/v4/models/usage/responses/UsagesForSubscriptionResponse.java deleted file mode 100644 index 35264d91..00000000 --- a/src/main/java/com/chargebee/v4/models/usage/responses/UsagesForSubscriptionResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.usage.responses; - -import com.chargebee.v4.models.usage.Usage; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UsagesForSubscription operation. Contains the response data from a - * single resource get operation. - */ -public final class UsagesForSubscriptionResponse extends BaseResponse { - private final Usage usage; - - private UsagesForSubscriptionResponse(Builder builder) { - super(builder.httpResponse); - - this.usage = builder.usage; - } - - /** Parse JSON response into UsagesForSubscriptionResponse object. */ - public static UsagesForSubscriptionResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UsagesForSubscriptionResponse object with HTTP response. */ - public static UsagesForSubscriptionResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __usageJson = JsonUtil.getObject(json, "usage"); - if (__usageJson != null) { - builder.usage(Usage.fromJson(__usageJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UsagesForSubscriptionResponse from JSON", e); - } - } - - /** Create a new builder for UsagesForSubscriptionResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UsagesForSubscriptionResponse. */ - public static class Builder { - - private Usage usage; - - private Response httpResponse; - - private Builder() {} - - public Builder usage(Usage usage) { - this.usage = usage; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UsagesForSubscriptionResponse build() { - return new UsagesForSubscriptionResponse(this); - } - } - - /** Get the usage from the response. */ - public Usage getUsage() { - return usage; - } -} diff --git a/src/main/java/com/chargebee/v4/models/usageEvent/params/UsageEventBatchCreateParams.java b/src/main/java/com/chargebee/v4/models/usageEvent/params/UsageEventBatchCreateParams.java deleted file mode 100644 index ed7e8d84..00000000 --- a/src/main/java/com/chargebee/v4/models/usageEvent/params/UsageEventBatchCreateParams.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.usageEvent.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; -import java.sql.Timestamp; - -public final class UsageEventBatchCreateParams { - - private final List events; - - private UsageEventBatchCreateParams(UsageEventBatchCreateBuilder builder) { - - this.events = builder.events; - } - - public List getEvents() { - return events; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.events != null) { - - // List of objects - for (int i = 0; i < this.events.size(); i++) { - EventsParams item = this.events.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "events[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for UsageEventBatchCreateParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static UsageEventBatchCreateBuilder builder() { - return new UsageEventBatchCreateBuilder(); - } - - public static final class UsageEventBatchCreateBuilder { - - private List events; - - private UsageEventBatchCreateBuilder() {} - - public UsageEventBatchCreateBuilder events(List value) { - this.events = value; - return this; - } - - public UsageEventBatchCreateParams build() { - return new UsageEventBatchCreateParams(this); - } - } - - public static final class EventsParams { - - private final String deduplicationId; - - private final String subscriptionId; - - private final Timestamp usageTimestamp; - - private final java.util.Map properties; - - private EventsParams(EventsBuilder builder) { - - this.deduplicationId = builder.deduplicationId; - - this.subscriptionId = builder.subscriptionId; - - this.usageTimestamp = builder.usageTimestamp; - - this.properties = builder.properties; - } - - public String getDeduplicationId() { - return deduplicationId; - } - - public String getSubscriptionId() { - return subscriptionId; - } - - public Timestamp getUsageTimestamp() { - return usageTimestamp; - } - - public java.util.Map getProperties() { - return properties; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.deduplicationId != null) { - - formData.put("deduplication_id", this.deduplicationId); - } - - if (this.subscriptionId != null) { - - formData.put("subscription_id", this.subscriptionId); - } - - if (this.usageTimestamp != null) { - - formData.put("usage_timestamp", this.usageTimestamp); - } - - if (this.properties != null) { - - formData.put("properties", JsonUtil.toJson(this.properties)); - } - - return formData; - } - - /** Create a new builder for EventsParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static EventsBuilder builder() { - return new EventsBuilder(); - } - - public static final class EventsBuilder { - - private String deduplicationId; - - private String subscriptionId; - - private Timestamp usageTimestamp; - - private java.util.Map properties; - - private EventsBuilder() {} - - public EventsBuilder deduplicationId(String value) { - this.deduplicationId = value; - return this; - } - - public EventsBuilder subscriptionId(String value) { - this.subscriptionId = value; - return this; - } - - public EventsBuilder usageTimestamp(Timestamp value) { - this.usageTimestamp = value; - return this; - } - - public EventsBuilder properties(java.util.Map value) { - this.properties = value; - return this; - } - - public EventsParams build() { - return new EventsParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/usageEvent/params/UsageEventBatchIngestParams.java b/src/main/java/com/chargebee/v4/models/usageEvent/params/UsageEventBatchIngestParams.java new file mode 100644 index 00000000..033255d1 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/usageEvent/params/UsageEventBatchIngestParams.java @@ -0,0 +1,181 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.usageEvent.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; +import java.sql.Timestamp; + +public final class UsageEventBatchIngestParams { + + private final List events; + + private UsageEventBatchIngestParams(UsageEventBatchIngestBuilder builder) { + + this.events = builder.events; + } + + public List getEvents() { + return events; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.events != null) { + + // List of objects + for (int i = 0; i < this.events.size(); i++) { + EventsParams item = this.events.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "events[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for UsageEventBatchIngestParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UsageEventBatchIngestBuilder builder() { + return new UsageEventBatchIngestBuilder(); + } + + public static final class UsageEventBatchIngestBuilder { + + private List events; + + private UsageEventBatchIngestBuilder() {} + + public UsageEventBatchIngestBuilder events(List value) { + this.events = value; + return this; + } + + public UsageEventBatchIngestParams build() { + return new UsageEventBatchIngestParams(this); + } + } + + public static final class EventsParams { + + private final String deduplicationId; + + private final String subscriptionId; + + private final Timestamp usageTimestamp; + + private final java.util.Map properties; + + private EventsParams(EventsBuilder builder) { + + this.deduplicationId = builder.deduplicationId; + + this.subscriptionId = builder.subscriptionId; + + this.usageTimestamp = builder.usageTimestamp; + + this.properties = builder.properties; + } + + public String getDeduplicationId() { + return deduplicationId; + } + + public String getSubscriptionId() { + return subscriptionId; + } + + public Timestamp getUsageTimestamp() { + return usageTimestamp; + } + + public java.util.Map getProperties() { + return properties; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.deduplicationId != null) { + + formData.put("deduplication_id", this.deduplicationId); + } + + if (this.subscriptionId != null) { + + formData.put("subscription_id", this.subscriptionId); + } + + if (this.usageTimestamp != null) { + + formData.put("usage_timestamp", this.usageTimestamp); + } + + if (this.properties != null) { + + formData.put("properties", JsonUtil.toJson(this.properties)); + } + + return formData; + } + + /** Create a new builder for EventsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static EventsBuilder builder() { + return new EventsBuilder(); + } + + public static final class EventsBuilder { + + private String deduplicationId; + + private String subscriptionId; + + private Timestamp usageTimestamp; + + private java.util.Map properties; + + private EventsBuilder() {} + + public EventsBuilder deduplicationId(String value) { + this.deduplicationId = value; + return this; + } + + public EventsBuilder subscriptionId(String value) { + this.subscriptionId = value; + return this; + } + + public EventsBuilder usageTimestamp(Timestamp value) { + this.usageTimestamp = value; + return this; + } + + public EventsBuilder properties(java.util.Map value) { + this.properties = value; + return this; + } + + public EventsParams build() { + return new EventsParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/usageEvent/responses/UsageEventBatchCreateResponse.java b/src/main/java/com/chargebee/v4/models/usageEvent/responses/UsageEventBatchCreateResponse.java deleted file mode 100644 index 39a44148..00000000 --- a/src/main/java/com/chargebee/v4/models/usageEvent/responses/UsageEventBatchCreateResponse.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.chargebee.v4.models.usageEvent.responses; - -import java.util.List; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for UsageEventBatchCreate operation. Contains the response data from - * the API. - */ -public final class UsageEventBatchCreateResponse extends BaseResponse { - private final String batchId; - - private final List failedEvents; - - private UsageEventBatchCreateResponse(Builder builder) { - super(builder.httpResponse); - - this.batchId = builder.batchId; - - this.failedEvents = builder.failedEvents; - } - - /** Parse JSON response into UsageEventBatchCreateResponse object. */ - public static UsageEventBatchCreateResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into UsageEventBatchCreateResponse object with HTTP response. */ - public static UsageEventBatchCreateResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - builder.batchId(JsonUtil.getString(json, "batch_id")); - - String __failedEventsJson = JsonUtil.getArray(json, "failed_events);"); - if (__failedEventsJson != null) { - builder.failedEvents( - JsonUtil.parseObjectArray(__failedEventsJson).stream() - .map(JsonUtil::parseJsonObjectToMap) - .collect(java.util.stream.Collectors.toList())); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse UsageEventBatchCreateResponse from JSON", e); - } - } - - /** Create a new builder for UsageEventBatchCreateResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for UsageEventBatchCreateResponse. */ - public static class Builder { - - private String batchId; - - private List failedEvents; - - private Response httpResponse; - - private Builder() {} - - public Builder batchId(String batchId) { - this.batchId = batchId; - return this; - } - - public Builder failedEvents(List failedEvents) { - this.failedEvents = failedEvents; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public UsageEventBatchCreateResponse build() { - return new UsageEventBatchCreateResponse(this); - } - } - - /** Get the batchId from the response. */ - public String getBatchId() { - return batchId; - } - - /** Get the failedEvents from the response. */ - public List getFailedEvents() { - return failedEvents; - } -} diff --git a/src/main/java/com/chargebee/v4/models/usageEvent/responses/UsageEventBatchIngestResponse.java b/src/main/java/com/chargebee/v4/models/usageEvent/responses/UsageEventBatchIngestResponse.java new file mode 100644 index 00000000..fd073344 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/usageEvent/responses/UsageEventBatchIngestResponse.java @@ -0,0 +1,98 @@ +package com.chargebee.v4.models.usageEvent.responses; + +import java.util.List; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for UsageEventBatchIngest operation. Contains the response data from + * the API. + */ +public final class UsageEventBatchIngestResponse extends BaseResponse { + private final String batchId; + + private final List failedEvents; + + private UsageEventBatchIngestResponse(Builder builder) { + super(builder.httpResponse); + + this.batchId = builder.batchId; + + this.failedEvents = builder.failedEvents; + } + + /** Parse JSON response into UsageEventBatchIngestResponse object. */ + public static UsageEventBatchIngestResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into UsageEventBatchIngestResponse object with HTTP response. */ + public static UsageEventBatchIngestResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + builder.batchId(JsonUtil.getString(json, "batch_id")); + + String __failedEventsJson = JsonUtil.getArray(json, "failed_events);"); + if (__failedEventsJson != null) { + builder.failedEvents( + JsonUtil.parseObjectArray(__failedEventsJson).stream() + .map(JsonUtil::parseJsonObjectToMap) + .collect(java.util.stream.Collectors.toList())); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse UsageEventBatchIngestResponse from JSON", e); + } + } + + /** Create a new builder for UsageEventBatchIngestResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for UsageEventBatchIngestResponse. */ + public static class Builder { + + private String batchId; + + private List failedEvents; + + private Response httpResponse; + + private Builder() {} + + public Builder batchId(String batchId) { + this.batchId = batchId; + return this; + } + + public Builder failedEvents(List failedEvents) { + this.failedEvents = failedEvents; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public UsageEventBatchIngestResponse build() { + return new UsageEventBatchIngestResponse(this); + } + } + + /** Get the batchId from the response. */ + public String getBatchId() { + return batchId; + } + + /** Get the failedEvents from the response. */ + public List getFailedEvents() { + return failedEvents; + } +} diff --git a/src/main/java/com/chargebee/v4/models/usageFile/params/ProcessingStatusForUsageFileParams.java b/src/main/java/com/chargebee/v4/models/usageFile/params/ProcessingStatusForUsageFileParams.java deleted file mode 100644 index cf4e5d4f..00000000 --- a/src/main/java/com/chargebee/v4/models/usageFile/params/ProcessingStatusForUsageFileParams.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.usageFile.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class ProcessingStatusForUsageFileParams { - - private final Map queryParams; - - private ProcessingStatusForUsageFileParams(ProcessingStatusForUsageFileBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public ProcessingStatusForUsageFileBuilder toBuilder() { - ProcessingStatusForUsageFileBuilder builder = new ProcessingStatusForUsageFileBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for ProcessingStatusForUsageFileParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static ProcessingStatusForUsageFileBuilder builder() { - return new ProcessingStatusForUsageFileBuilder(); - } - - public static final class ProcessingStatusForUsageFileBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private ProcessingStatusForUsageFileBuilder() {} - - public ProcessingStatusForUsageFileParams build() { - return new ProcessingStatusForUsageFileParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/usageFile/params/UsageFileProcessingStatusParams.java b/src/main/java/com/chargebee/v4/models/usageFile/params/UsageFileProcessingStatusParams.java new file mode 100644 index 00000000..5bde6620 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/usageFile/params/UsageFileProcessingStatusParams.java @@ -0,0 +1,50 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.usageFile.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class UsageFileProcessingStatusParams { + + private final Map queryParams; + + private UsageFileProcessingStatusParams(UsageFileProcessingStatusBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public UsageFileProcessingStatusBuilder toBuilder() { + UsageFileProcessingStatusBuilder builder = new UsageFileProcessingStatusBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for UsageFileProcessingStatusParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static UsageFileProcessingStatusBuilder builder() { + return new UsageFileProcessingStatusBuilder(); + } + + public static final class UsageFileProcessingStatusBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private UsageFileProcessingStatusBuilder() {} + + public UsageFileProcessingStatusParams build() { + return new UsageFileProcessingStatusParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/usageFile/responses/ProcessingStatusForUsageFileResponse.java b/src/main/java/com/chargebee/v4/models/usageFile/responses/ProcessingStatusForUsageFileResponse.java deleted file mode 100644 index 299258b3..00000000 --- a/src/main/java/com/chargebee/v4/models/usageFile/responses/ProcessingStatusForUsageFileResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.usageFile.responses; - -import com.chargebee.v4.models.usageFile.UsageFile; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for ProcessingStatusForUsageFile operation. Contains the response data - * from a single resource get operation. - */ -public final class ProcessingStatusForUsageFileResponse extends BaseResponse { - private final UsageFile usageFile; - - private ProcessingStatusForUsageFileResponse(Builder builder) { - super(builder.httpResponse); - - this.usageFile = builder.usageFile; - } - - /** Parse JSON response into ProcessingStatusForUsageFileResponse object. */ - public static ProcessingStatusForUsageFileResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into ProcessingStatusForUsageFileResponse object with HTTP response. */ - public static ProcessingStatusForUsageFileResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __usageFileJson = JsonUtil.getObject(json, "usage_file"); - if (__usageFileJson != null) { - builder.usageFile(UsageFile.fromJson(__usageFileJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse ProcessingStatusForUsageFileResponse from JSON", e); - } - } - - /** Create a new builder for ProcessingStatusForUsageFileResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ProcessingStatusForUsageFileResponse. */ - public static class Builder { - - private UsageFile usageFile; - - private Response httpResponse; - - private Builder() {} - - public Builder usageFile(UsageFile usageFile) { - this.usageFile = usageFile; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public ProcessingStatusForUsageFileResponse build() { - return new ProcessingStatusForUsageFileResponse(this); - } - } - - /** Get the usageFile from the response. */ - public UsageFile getUsageFile() { - return usageFile; - } -} diff --git a/src/main/java/com/chargebee/v4/models/usageFile/responses/UsageFileProcessingStatusResponse.java b/src/main/java/com/chargebee/v4/models/usageFile/responses/UsageFileProcessingStatusResponse.java new file mode 100644 index 00000000..4e488e61 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/usageFile/responses/UsageFileProcessingStatusResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.usageFile.responses; + +import com.chargebee.v4.models.usageFile.UsageFile; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for UsageFileProcessingStatus operation. Contains the response data + * from a single resource get operation. + */ +public final class UsageFileProcessingStatusResponse extends BaseResponse { + private final UsageFile usageFile; + + private UsageFileProcessingStatusResponse(Builder builder) { + super(builder.httpResponse); + + this.usageFile = builder.usageFile; + } + + /** Parse JSON response into UsageFileProcessingStatusResponse object. */ + public static UsageFileProcessingStatusResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into UsageFileProcessingStatusResponse object with HTTP response. */ + public static UsageFileProcessingStatusResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __usageFileJson = JsonUtil.getObject(json, "usage_file"); + if (__usageFileJson != null) { + builder.usageFile(UsageFile.fromJson(__usageFileJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse UsageFileProcessingStatusResponse from JSON", e); + } + } + + /** Create a new builder for UsageFileProcessingStatusResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for UsageFileProcessingStatusResponse. */ + public static class Builder { + + private UsageFile usageFile; + + private Response httpResponse; + + private Builder() {} + + public Builder usageFile(UsageFile usageFile) { + this.usageFile = usageFile; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public UsageFileProcessingStatusResponse build() { + return new UsageFileProcessingStatusResponse(this); + } + } + + /** Get the usageFile from the response. */ + public UsageFile getUsageFile() { + return usageFile; + } +} diff --git a/src/main/java/com/chargebee/v4/models/variant/params/AddVariantForProductParams.java b/src/main/java/com/chargebee/v4/models/variant/params/AddVariantForProductParams.java deleted file mode 100644 index 8487ec55..00000000 --- a/src/main/java/com/chargebee/v4/models/variant/params/AddVariantForProductParams.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.variant.params; - -import com.chargebee.v4.internal.Recommended; -import com.chargebee.v4.internal.JsonUtil; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.List; - -public final class AddVariantForProductParams { - - private final String id; - - private final String name; - - private final String externalName; - - private final String description; - - private final String sku; - - private final java.util.Map metadata; - - private final Status status; - - private final List optionValues; - - private AddVariantForProductParams(AddVariantForProductBuilder builder) { - - this.id = builder.id; - - this.name = builder.name; - - this.externalName = builder.externalName; - - this.description = builder.description; - - this.sku = builder.sku; - - this.metadata = builder.metadata; - - this.status = builder.status; - - this.optionValues = builder.optionValues; - } - - public String getId() { - return id; - } - - public String getName() { - return name; - } - - public String getExternalName() { - return externalName; - } - - public String getDescription() { - return description; - } - - public String getSku() { - return sku; - } - - public java.util.Map getMetadata() { - return metadata; - } - - public Status getStatus() { - return status; - } - - public List getOptionValues() { - return optionValues; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.id != null) { - - formData.put("id", this.id); - } - - if (this.name != null) { - - formData.put("name", this.name); - } - - if (this.externalName != null) { - - formData.put("external_name", this.externalName); - } - - if (this.description != null) { - - formData.put("description", this.description); - } - - if (this.sku != null) { - - formData.put("sku", this.sku); - } - - if (this.metadata != null) { - - formData.put("metadata", JsonUtil.toJson(this.metadata)); - } - - if (this.status != null) { - - formData.put("status", this.status); - } - - if (this.optionValues != null) { - - // List of objects - for (int i = 0; i < this.optionValues.size(); i++) { - OptionValuesParams item = this.optionValues.get(i); - if (item != null) { - Map itemData = item.toFormData(); - for (Map.Entry entry : itemData.entrySet()) { - String indexedKey = "option_values[" + entry.getKey() + "][" + i + "]"; - formData.put(indexedKey, entry.getValue()); - } - } - } - } - - return formData; - } - - /** Create a new builder for AddVariantForProductParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static AddVariantForProductBuilder builder() { - return new AddVariantForProductBuilder(); - } - - public static final class AddVariantForProductBuilder { - - private String id; - - private String name; - - private String externalName; - - private String description; - - private String sku; - - private java.util.Map metadata; - - private Status status; - - private List optionValues; - - private AddVariantForProductBuilder() {} - - public AddVariantForProductBuilder id(String value) { - this.id = value; - return this; - } - - public AddVariantForProductBuilder name(String value) { - this.name = value; - return this; - } - - public AddVariantForProductBuilder externalName(String value) { - this.externalName = value; - return this; - } - - public AddVariantForProductBuilder description(String value) { - this.description = value; - return this; - } - - public AddVariantForProductBuilder sku(String value) { - this.sku = value; - return this; - } - - public AddVariantForProductBuilder metadata(java.util.Map value) { - this.metadata = value; - return this; - } - - public AddVariantForProductBuilder status(Status value) { - this.status = value; - return this; - } - - public AddVariantForProductBuilder optionValues(List value) { - this.optionValues = value; - return this; - } - - public AddVariantForProductParams build() { - return new AddVariantForProductParams(this); - } - } - - public enum Status { - ACTIVE("active"), - - INACTIVE("inactive"), - - /** An enum member indicating that Status was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - Status(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static Status fromString(String value) { - if (value == null) return _UNKNOWN; - for (Status enumValue : Status.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public static final class OptionValuesParams { - - private final String name; - - private final String value; - - private OptionValuesParams(OptionValuesBuilder builder) { - - this.name = builder.name; - - this.value = builder.value; - } - - public String getName() { - return name; - } - - public String getValue() { - return value; - } - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - if (this.name != null) { - - formData.put("name", this.name); - } - - if (this.value != null) { - - formData.put("value", this.value); - } - - return formData; - } - - /** Create a new builder for OptionValuesParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static OptionValuesBuilder builder() { - return new OptionValuesBuilder(); - } - - public static final class OptionValuesBuilder { - - private String name; - - private String value; - - private OptionValuesBuilder() {} - - public OptionValuesBuilder name(String value) { - this.name = value; - return this; - } - - public OptionValuesBuilder value(String value) { - this.value = value; - return this; - } - - public OptionValuesParams build() { - return new OptionValuesParams(this); - } - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/variant/params/CreateProductVariantParams.java b/src/main/java/com/chargebee/v4/models/variant/params/CreateProductVariantParams.java new file mode 100644 index 00000000..cb5e76b5 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/variant/params/CreateProductVariantParams.java @@ -0,0 +1,308 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.variant.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public final class CreateProductVariantParams { + + private final String id; + + private final String name; + + private final String externalName; + + private final String description; + + private final String sku; + + private final java.util.Map metadata; + + private final Status status; + + private final List optionValues; + + private CreateProductVariantParams(CreateProductVariantBuilder builder) { + + this.id = builder.id; + + this.name = builder.name; + + this.externalName = builder.externalName; + + this.description = builder.description; + + this.sku = builder.sku; + + this.metadata = builder.metadata; + + this.status = builder.status; + + this.optionValues = builder.optionValues; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getExternalName() { + return externalName; + } + + public String getDescription() { + return description; + } + + public String getSku() { + return sku; + } + + public java.util.Map getMetadata() { + return metadata; + } + + public Status getStatus() { + return status; + } + + public List getOptionValues() { + return optionValues; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.name != null) { + + formData.put("name", this.name); + } + + if (this.externalName != null) { + + formData.put("external_name", this.externalName); + } + + if (this.description != null) { + + formData.put("description", this.description); + } + + if (this.sku != null) { + + formData.put("sku", this.sku); + } + + if (this.metadata != null) { + + formData.put("metadata", JsonUtil.toJson(this.metadata)); + } + + if (this.status != null) { + + formData.put("status", this.status); + } + + if (this.optionValues != null) { + + // List of objects + for (int i = 0; i < this.optionValues.size(); i++) { + OptionValuesParams item = this.optionValues.get(i); + if (item != null) { + Map itemData = item.toFormData(); + for (Map.Entry entry : itemData.entrySet()) { + String indexedKey = "option_values[" + entry.getKey() + "][" + i + "]"; + formData.put(indexedKey, entry.getValue()); + } + } + } + } + + return formData; + } + + /** Create a new builder for CreateProductVariantParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreateProductVariantBuilder builder() { + return new CreateProductVariantBuilder(); + } + + public static final class CreateProductVariantBuilder { + + private String id; + + private String name; + + private String externalName; + + private String description; + + private String sku; + + private java.util.Map metadata; + + private Status status; + + private List optionValues; + + private CreateProductVariantBuilder() {} + + public CreateProductVariantBuilder id(String value) { + this.id = value; + return this; + } + + public CreateProductVariantBuilder name(String value) { + this.name = value; + return this; + } + + public CreateProductVariantBuilder externalName(String value) { + this.externalName = value; + return this; + } + + public CreateProductVariantBuilder description(String value) { + this.description = value; + return this; + } + + public CreateProductVariantBuilder sku(String value) { + this.sku = value; + return this; + } + + public CreateProductVariantBuilder metadata(java.util.Map value) { + this.metadata = value; + return this; + } + + public CreateProductVariantBuilder status(Status value) { + this.status = value; + return this; + } + + public CreateProductVariantBuilder optionValues(List value) { + this.optionValues = value; + return this; + } + + public CreateProductVariantParams build() { + return new CreateProductVariantParams(this); + } + } + + public enum Status { + ACTIVE("active"), + + INACTIVE("inactive"), + + /** An enum member indicating that Status was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Status(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Status fromString(String value) { + if (value == null) return _UNKNOWN; + for (Status enumValue : Status.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static final class OptionValuesParams { + + private final String name; + + private final String value; + + private OptionValuesParams(OptionValuesBuilder builder) { + + this.name = builder.name; + + this.value = builder.value; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.name != null) { + + formData.put("name", this.name); + } + + if (this.value != null) { + + formData.put("value", this.value); + } + + return formData; + } + + /** Create a new builder for OptionValuesParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static OptionValuesBuilder builder() { + return new OptionValuesBuilder(); + } + + public static final class OptionValuesBuilder { + + private String name; + + private String value; + + private OptionValuesBuilder() {} + + public OptionValuesBuilder name(String value) { + this.name = value; + return this; + } + + public OptionValuesBuilder value(String value) { + this.value = value; + return this; + } + + public OptionValuesParams build() { + return new OptionValuesParams(this); + } + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/variant/params/DeleteVariantParams.java b/src/main/java/com/chargebee/v4/models/variant/params/DeleteVariantParams.java deleted file mode 100644 index 769a3576..00000000 --- a/src/main/java/com/chargebee/v4/models/variant/params/DeleteVariantParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.variant.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteVariantParams { - - private DeleteVariantParams(DeleteVariantBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteVariantParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteVariantBuilder builder() { - return new DeleteVariantBuilder(); - } - - public static final class DeleteVariantBuilder { - - private DeleteVariantBuilder() {} - - public DeleteVariantParams build() { - return new DeleteVariantParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/variant/params/ListProductVariantsParams.java b/src/main/java/com/chargebee/v4/models/variant/params/ListProductVariantsParams.java new file mode 100644 index 00000000..da0a5f21 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/variant/params/ListProductVariantsParams.java @@ -0,0 +1,469 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.variant.params; + +import com.chargebee.v4.internal.Recommended; + +import java.sql.Timestamp; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class ListProductVariantsParams { + + private final Map queryParams; + + private ListProductVariantsParams(ListProductVariantsBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public ListProductVariantsBuilder toBuilder() { + ListProductVariantsBuilder builder = new ListProductVariantsBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for ListProductVariantsParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static ListProductVariantsBuilder builder() { + return new ListProductVariantsBuilder(); + } + + public static final class ListProductVariantsBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private ListProductVariantsBuilder() {} + + public ListProductVariantsBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public ListProductVariantsBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + public ListProductVariantsBuilder includeDeleted(Boolean value) { + queryParams.put("include_deleted", value); + return this; + } + + public IdFilter id() { + return new IdFilter("id", this); + } + + public NameFilter name() { + return new NameFilter("name", this); + } + + public SkuFilter sku() { + return new SkuFilter("sku", this); + } + + public StatusFilter status() { + return new StatusFilter("status", this); + } + + public UpdatedAtFilter updatedAt() { + return new UpdatedAtFilter("updated_at", this); + } + + public CreatedAtFilter createdAt() { + return new CreatedAtFilter("created_at", this); + } + + public SortBySortBuilder sortBy() { + return new SortBySortBuilder("sort_by", this); + } + + public ListProductVariantsParams build() { + return new ListProductVariantsParams(this); + } + + public static final class IdFilter { + private final String fieldName; + private final ListProductVariantsBuilder builder; + + IdFilter(String fieldName, ListProductVariantsBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public ListProductVariantsBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + + public ListProductVariantsBuilder isNot(String value) { + builder.queryParams.put(fieldName + "[is_not]", value); + return builder; + } + + public ListProductVariantsBuilder startsWith(String value) { + builder.queryParams.put(fieldName + "[starts_with]", value); + return builder; + } + + public ListProductVariantsBuilder in(String... values) { + builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); + return builder; + } + + public ListProductVariantsBuilder notIn(String... values) { + builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); + return builder; + } + } + + public static final class NameFilter { + private final String fieldName; + private final ListProductVariantsBuilder builder; + + NameFilter(String fieldName, ListProductVariantsBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public ListProductVariantsBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + + public ListProductVariantsBuilder isNot(String value) { + builder.queryParams.put(fieldName + "[is_not]", value); + return builder; + } + + public ListProductVariantsBuilder startsWith(String value) { + builder.queryParams.put(fieldName + "[starts_with]", value); + return builder; + } + + public ListProductVariantsBuilder in(String... values) { + builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); + return builder; + } + + public ListProductVariantsBuilder notIn(String... values) { + builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); + return builder; + } + } + + public static final class SkuFilter { + private final String fieldName; + private final ListProductVariantsBuilder builder; + + SkuFilter(String fieldName, ListProductVariantsBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public ListProductVariantsBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + + public ListProductVariantsBuilder isNot(String value) { + builder.queryParams.put(fieldName + "[is_not]", value); + return builder; + } + + public ListProductVariantsBuilder startsWith(String value) { + builder.queryParams.put(fieldName + "[starts_with]", value); + return builder; + } + + public ListProductVariantsBuilder in(String... values) { + builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); + return builder; + } + + public ListProductVariantsBuilder notIn(String... values) { + builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); + return builder; + } + } + + public static final class StatusFilter { + private final String fieldName; + private final ListProductVariantsBuilder builder; + + StatusFilter(String fieldName, ListProductVariantsBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public ListProductVariantsBuilder is(String value) { + builder.queryParams.put(fieldName + "[is]", value); + return builder; + } + + public ListProductVariantsBuilder isNot(String value) { + builder.queryParams.put(fieldName + "[is_not]", value); + return builder; + } + + public ListProductVariantsBuilder in(String... values) { + builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); + return builder; + } + + public ListProductVariantsBuilder notIn(String... values) { + builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); + return builder; + } + } + + public static final class UpdatedAtFilter { + private final String fieldName; + private final ListProductVariantsBuilder builder; + + UpdatedAtFilter(String fieldName, ListProductVariantsBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public ListProductVariantsBuilder after(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[after]", timestamp.getTime() / 1000); + return builder; + } + + public ListProductVariantsBuilder before(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[before]", timestamp.getTime() / 1000); + return builder; + } + + public ListProductVariantsBuilder on(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[on]", timestamp.getTime() / 1000); + return builder; + } + + public ListProductVariantsBuilder between(Timestamp start, Timestamp end) { + builder.queryParams.put( + fieldName + "[between]", + "[" + (start.getTime() / 1000) + "," + (end.getTime() / 1000) + "]"); + return builder; + } + } + + public static final class CreatedAtFilter { + private final String fieldName; + private final ListProductVariantsBuilder builder; + + CreatedAtFilter(String fieldName, ListProductVariantsBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public ListProductVariantsBuilder after(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[after]", timestamp.getTime() / 1000); + return builder; + } + + public ListProductVariantsBuilder before(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[before]", timestamp.getTime() / 1000); + return builder; + } + + public ListProductVariantsBuilder on(Timestamp timestamp) { + builder.queryParams.put(fieldName + "[on]", timestamp.getTime() / 1000); + return builder; + } + + public ListProductVariantsBuilder between(Timestamp start, Timestamp end) { + builder.queryParams.put( + fieldName + "[between]", + "[" + (start.getTime() / 1000) + "," + (end.getTime() / 1000) + "]"); + return builder; + } + } + + public static final class SortBySortBuilder { + private final String fieldName; + private final ListProductVariantsBuilder builder; + + SortBySortBuilder(String fieldName, ListProductVariantsBuilder builder) { + this.fieldName = fieldName; + this.builder = builder; + } + + public SortDirection name() { + return new SortDirection(fieldName, "name", builder); + } + + public SortDirection id() { + return new SortDirection(fieldName, "id", builder); + } + + public SortDirection status() { + return new SortDirection(fieldName, "status", builder); + } + + public SortDirection created_at() { + return new SortDirection(fieldName, "created_at", builder); + } + + public SortDirection updated_at() { + return new SortDirection(fieldName, "updated_at", builder); + } + } + + public static final class SortDirection { + private final String fieldName; + private final String selectedField; + private final ListProductVariantsBuilder builder; + + SortDirection(String fieldName, String selectedField, ListProductVariantsBuilder builder) { + this.fieldName = fieldName; + this.selectedField = selectedField; + this.builder = builder; + } + + public ListProductVariantsBuilder asc() { + builder.queryParams.put(fieldName + "[asc]", selectedField); + return builder; + } + + public ListProductVariantsBuilder desc() { + builder.queryParams.put(fieldName + "[desc]", selectedField); + return builder; + } + } + } + + public enum StatusIs { + ACTIVE("active"), + + INACTIVE("inactive"), + + /** An enum member indicating that StatusIs was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + StatusIs(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static StatusIs fromString(String value) { + if (value == null) return _UNKNOWN; + for (StatusIs enumValue : StatusIs.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum StatusIsNot { + ACTIVE("active"), + + INACTIVE("inactive"), + + /** An enum member indicating that StatusIsNot was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + StatusIsNot(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static StatusIsNot fromString(String value) { + if (value == null) return _UNKNOWN; + for (StatusIsNot enumValue : StatusIsNot.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum SortByAsc { + NAME("name"), + + ID("id"), + + STATUS("status"), + + CREATED_AT("created_at"), + + UPDATED_AT("updated_at"), + + /** An enum member indicating that SortByAsc was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + SortByAsc(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SortByAsc fromString(String value) { + if (value == null) return _UNKNOWN; + for (SortByAsc enumValue : SortByAsc.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum SortByDesc { + NAME("name"), + + ID("id"), + + STATUS("status"), + + CREATED_AT("created_at"), + + UPDATED_AT("updated_at"), + + /** An enum member indicating that SortByDesc was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + SortByDesc(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static SortByDesc fromString(String value) { + if (value == null) return _UNKNOWN; + for (SortByDesc enumValue : SortByDesc.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/variant/params/VariantDeleteParams.java b/src/main/java/com/chargebee/v4/models/variant/params/VariantDeleteParams.java new file mode 100644 index 00000000..eb351fb4 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/variant/params/VariantDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.variant.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class VariantDeleteParams { + + private VariantDeleteParams(VariantDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for VariantDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static VariantDeleteBuilder builder() { + return new VariantDeleteBuilder(); + } + + public static final class VariantDeleteBuilder { + + private VariantDeleteBuilder() {} + + public VariantDeleteParams build() { + return new VariantDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/variant/params/VariantsForProductParams.java b/src/main/java/com/chargebee/v4/models/variant/params/VariantsForProductParams.java deleted file mode 100644 index 7c84e181..00000000 --- a/src/main/java/com/chargebee/v4/models/variant/params/VariantsForProductParams.java +++ /dev/null @@ -1,469 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ - -package com.chargebee.v4.models.variant.params; - -import com.chargebee.v4.internal.Recommended; - -import java.sql.Timestamp; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -public final class VariantsForProductParams { - - private final Map queryParams; - - private VariantsForProductParams(VariantsForProductBuilder builder) { - this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); - } - - /** Get the query parameters for this request. */ - public Map toQueryParams() { - return queryParams; - } - - public VariantsForProductBuilder toBuilder() { - VariantsForProductBuilder builder = new VariantsForProductBuilder(); - builder.queryParams.putAll(queryParams); - return builder; - } - - /** Create a new builder for VariantsForProductParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static VariantsForProductBuilder builder() { - return new VariantsForProductBuilder(); - } - - public static final class VariantsForProductBuilder { - private final Map queryParams = new LinkedHashMap<>(); - - private VariantsForProductBuilder() {} - - public VariantsForProductBuilder limit(Integer value) { - queryParams.put("limit", value); - return this; - } - - public VariantsForProductBuilder offset(String value) { - queryParams.put("offset", value); - return this; - } - - public VariantsForProductBuilder includeDeleted(Boolean value) { - queryParams.put("include_deleted", value); - return this; - } - - public IdFilter id() { - return new IdFilter("id", this); - } - - public NameFilter name() { - return new NameFilter("name", this); - } - - public SkuFilter sku() { - return new SkuFilter("sku", this); - } - - public StatusFilter status() { - return new StatusFilter("status", this); - } - - public UpdatedAtFilter updatedAt() { - return new UpdatedAtFilter("updated_at", this); - } - - public CreatedAtFilter createdAt() { - return new CreatedAtFilter("created_at", this); - } - - public SortBySortBuilder sortBy() { - return new SortBySortBuilder("sort_by", this); - } - - public VariantsForProductParams build() { - return new VariantsForProductParams(this); - } - - public static final class IdFilter { - private final String fieldName; - private final VariantsForProductBuilder builder; - - IdFilter(String fieldName, VariantsForProductBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public VariantsForProductBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - - public VariantsForProductBuilder isNot(String value) { - builder.queryParams.put(fieldName + "[is_not]", value); - return builder; - } - - public VariantsForProductBuilder startsWith(String value) { - builder.queryParams.put(fieldName + "[starts_with]", value); - return builder; - } - - public VariantsForProductBuilder in(String... values) { - builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); - return builder; - } - - public VariantsForProductBuilder notIn(String... values) { - builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); - return builder; - } - } - - public static final class NameFilter { - private final String fieldName; - private final VariantsForProductBuilder builder; - - NameFilter(String fieldName, VariantsForProductBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public VariantsForProductBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - - public VariantsForProductBuilder isNot(String value) { - builder.queryParams.put(fieldName + "[is_not]", value); - return builder; - } - - public VariantsForProductBuilder startsWith(String value) { - builder.queryParams.put(fieldName + "[starts_with]", value); - return builder; - } - - public VariantsForProductBuilder in(String... values) { - builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); - return builder; - } - - public VariantsForProductBuilder notIn(String... values) { - builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); - return builder; - } - } - - public static final class SkuFilter { - private final String fieldName; - private final VariantsForProductBuilder builder; - - SkuFilter(String fieldName, VariantsForProductBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public VariantsForProductBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - - public VariantsForProductBuilder isNot(String value) { - builder.queryParams.put(fieldName + "[is_not]", value); - return builder; - } - - public VariantsForProductBuilder startsWith(String value) { - builder.queryParams.put(fieldName + "[starts_with]", value); - return builder; - } - - public VariantsForProductBuilder in(String... values) { - builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); - return builder; - } - - public VariantsForProductBuilder notIn(String... values) { - builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); - return builder; - } - } - - public static final class StatusFilter { - private final String fieldName; - private final VariantsForProductBuilder builder; - - StatusFilter(String fieldName, VariantsForProductBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public VariantsForProductBuilder is(String value) { - builder.queryParams.put(fieldName + "[is]", value); - return builder; - } - - public VariantsForProductBuilder isNot(String value) { - builder.queryParams.put(fieldName + "[is_not]", value); - return builder; - } - - public VariantsForProductBuilder in(String... values) { - builder.queryParams.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); - return builder; - } - - public VariantsForProductBuilder notIn(String... values) { - builder.queryParams.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); - return builder; - } - } - - public static final class UpdatedAtFilter { - private final String fieldName; - private final VariantsForProductBuilder builder; - - UpdatedAtFilter(String fieldName, VariantsForProductBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public VariantsForProductBuilder after(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[after]", timestamp.getTime() / 1000); - return builder; - } - - public VariantsForProductBuilder before(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[before]", timestamp.getTime() / 1000); - return builder; - } - - public VariantsForProductBuilder on(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[on]", timestamp.getTime() / 1000); - return builder; - } - - public VariantsForProductBuilder between(Timestamp start, Timestamp end) { - builder.queryParams.put( - fieldName + "[between]", - "[" + (start.getTime() / 1000) + "," + (end.getTime() / 1000) + "]"); - return builder; - } - } - - public static final class CreatedAtFilter { - private final String fieldName; - private final VariantsForProductBuilder builder; - - CreatedAtFilter(String fieldName, VariantsForProductBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public VariantsForProductBuilder after(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[after]", timestamp.getTime() / 1000); - return builder; - } - - public VariantsForProductBuilder before(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[before]", timestamp.getTime() / 1000); - return builder; - } - - public VariantsForProductBuilder on(Timestamp timestamp) { - builder.queryParams.put(fieldName + "[on]", timestamp.getTime() / 1000); - return builder; - } - - public VariantsForProductBuilder between(Timestamp start, Timestamp end) { - builder.queryParams.put( - fieldName + "[between]", - "[" + (start.getTime() / 1000) + "," + (end.getTime() / 1000) + "]"); - return builder; - } - } - - public static final class SortBySortBuilder { - private final String fieldName; - private final VariantsForProductBuilder builder; - - SortBySortBuilder(String fieldName, VariantsForProductBuilder builder) { - this.fieldName = fieldName; - this.builder = builder; - } - - public SortDirection name() { - return new SortDirection(fieldName, "name", builder); - } - - public SortDirection id() { - return new SortDirection(fieldName, "id", builder); - } - - public SortDirection status() { - return new SortDirection(fieldName, "status", builder); - } - - public SortDirection created_at() { - return new SortDirection(fieldName, "created_at", builder); - } - - public SortDirection updated_at() { - return new SortDirection(fieldName, "updated_at", builder); - } - } - - public static final class SortDirection { - private final String fieldName; - private final String selectedField; - private final VariantsForProductBuilder builder; - - SortDirection(String fieldName, String selectedField, VariantsForProductBuilder builder) { - this.fieldName = fieldName; - this.selectedField = selectedField; - this.builder = builder; - } - - public VariantsForProductBuilder asc() { - builder.queryParams.put(fieldName + "[asc]", selectedField); - return builder; - } - - public VariantsForProductBuilder desc() { - builder.queryParams.put(fieldName + "[desc]", selectedField); - return builder; - } - } - } - - public enum StatusIs { - ACTIVE("active"), - - INACTIVE("inactive"), - - /** An enum member indicating that StatusIs was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - StatusIs(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static StatusIs fromString(String value) { - if (value == null) return _UNKNOWN; - for (StatusIs enumValue : StatusIs.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum StatusIsNot { - ACTIVE("active"), - - INACTIVE("inactive"), - - /** An enum member indicating that StatusIsNot was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - StatusIsNot(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static StatusIsNot fromString(String value) { - if (value == null) return _UNKNOWN; - for (StatusIsNot enumValue : StatusIsNot.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum SortByAsc { - NAME("name"), - - ID("id"), - - STATUS("status"), - - CREATED_AT("created_at"), - - UPDATED_AT("updated_at"), - - /** An enum member indicating that SortByAsc was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - SortByAsc(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static SortByAsc fromString(String value) { - if (value == null) return _UNKNOWN; - for (SortByAsc enumValue : SortByAsc.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - - public enum SortByDesc { - NAME("name"), - - ID("id"), - - STATUS("status"), - - CREATED_AT("created_at"), - - UPDATED_AT("updated_at"), - - /** An enum member indicating that SortByDesc was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - SortByDesc(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static SortByDesc fromString(String value) { - if (value == null) return _UNKNOWN; - for (SortByDesc enumValue : SortByDesc.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/variant/responses/AddVariantForProductResponse.java b/src/main/java/com/chargebee/v4/models/variant/responses/AddVariantForProductResponse.java deleted file mode 100644 index b7c639db..00000000 --- a/src/main/java/com/chargebee/v4/models/variant/responses/AddVariantForProductResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.variant.responses; - -import com.chargebee.v4.models.variant.Variant; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for AddVariantForProduct operation. Contains the response data from the - * API. - */ -public final class AddVariantForProductResponse extends BaseResponse { - private final Variant variant; - - private AddVariantForProductResponse(Builder builder) { - super(builder.httpResponse); - - this.variant = builder.variant; - } - - /** Parse JSON response into AddVariantForProductResponse object. */ - public static AddVariantForProductResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into AddVariantForProductResponse object with HTTP response. */ - public static AddVariantForProductResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __variantJson = JsonUtil.getObject(json, "variant"); - if (__variantJson != null) { - builder.variant(Variant.fromJson(__variantJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse AddVariantForProductResponse from JSON", e); - } - } - - /** Create a new builder for AddVariantForProductResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for AddVariantForProductResponse. */ - public static class Builder { - - private Variant variant; - - private Response httpResponse; - - private Builder() {} - - public Builder variant(Variant variant) { - this.variant = variant; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public AddVariantForProductResponse build() { - return new AddVariantForProductResponse(this); - } - } - - /** Get the variant from the response. */ - public Variant getVariant() { - return variant; - } -} diff --git a/src/main/java/com/chargebee/v4/models/variant/responses/CreateProductVariantResponse.java b/src/main/java/com/chargebee/v4/models/variant/responses/CreateProductVariantResponse.java new file mode 100644 index 00000000..fc97a581 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/variant/responses/CreateProductVariantResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.variant.responses; + +import com.chargebee.v4.models.variant.Variant; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreateProductVariant operation. Contains the response data from the + * API. + */ +public final class CreateProductVariantResponse extends BaseResponse { + private final Variant variant; + + private CreateProductVariantResponse(Builder builder) { + super(builder.httpResponse); + + this.variant = builder.variant; + } + + /** Parse JSON response into CreateProductVariantResponse object. */ + public static CreateProductVariantResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreateProductVariantResponse object with HTTP response. */ + public static CreateProductVariantResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __variantJson = JsonUtil.getObject(json, "variant"); + if (__variantJson != null) { + builder.variant(Variant.fromJson(__variantJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreateProductVariantResponse from JSON", e); + } + } + + /** Create a new builder for CreateProductVariantResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreateProductVariantResponse. */ + public static class Builder { + + private Variant variant; + + private Response httpResponse; + + private Builder() {} + + public Builder variant(Variant variant) { + this.variant = variant; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreateProductVariantResponse build() { + return new CreateProductVariantResponse(this); + } + } + + /** Get the variant from the response. */ + public Variant getVariant() { + return variant; + } +} diff --git a/src/main/java/com/chargebee/v4/models/variant/responses/DeleteVariantResponse.java b/src/main/java/com/chargebee/v4/models/variant/responses/DeleteVariantResponse.java deleted file mode 100644 index 6240ba94..00000000 --- a/src/main/java/com/chargebee/v4/models/variant/responses/DeleteVariantResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.chargebee.v4.models.variant.responses; - -import com.chargebee.v4.models.variant.Variant; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteVariant operation. Contains the response data from the API. - */ -public final class DeleteVariantResponse extends BaseResponse { - private final Variant variant; - - private DeleteVariantResponse(Builder builder) { - super(builder.httpResponse); - - this.variant = builder.variant; - } - - /** Parse JSON response into DeleteVariantResponse object. */ - public static DeleteVariantResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteVariantResponse object with HTTP response. */ - public static DeleteVariantResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __variantJson = JsonUtil.getObject(json, "variant"); - if (__variantJson != null) { - builder.variant(Variant.fromJson(__variantJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteVariantResponse from JSON", e); - } - } - - /** Create a new builder for DeleteVariantResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteVariantResponse. */ - public static class Builder { - - private Variant variant; - - private Response httpResponse; - - private Builder() {} - - public Builder variant(Variant variant) { - this.variant = variant; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteVariantResponse build() { - return new DeleteVariantResponse(this); - } - } - - /** Get the variant from the response. */ - public Variant getVariant() { - return variant; - } -} diff --git a/src/main/java/com/chargebee/v4/models/variant/responses/ListProductVariantsResponse.java b/src/main/java/com/chargebee/v4/models/variant/responses/ListProductVariantsResponse.java new file mode 100644 index 00000000..10db0f20 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/variant/responses/ListProductVariantsResponse.java @@ -0,0 +1,172 @@ +package com.chargebee.v4.models.variant.responses; + +import java.util.List; + +import com.chargebee.v4.models.variant.Variant; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.VariantService; +import com.chargebee.v4.models.variant.params.ListProductVariantsParams; + +/** Immutable response object for ListProductVariants operation. Contains paginated list data. */ +public final class ListProductVariantsResponse { + + private final List list; + + private final String nextOffset; + + private final String productId; + + private final VariantService service; + private final ListProductVariantsParams originalParams; + private final Response httpResponse; + + private ListProductVariantsResponse( + List list, + String nextOffset, + String productId, + VariantService service, + ListProductVariantsParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.productId = productId; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into ListProductVariantsResponse object (no service context). Use this when + * you only need to read a single page (no nextPage()). + */ + public static ListProductVariantsResponse fromJson(String json) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(VariantListProductVariantsItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new ListProductVariantsResponse(list, nextOffset, null, null, null, null); + } catch (Exception e) { + throw new RuntimeException("Failed to parse ListProductVariantsResponse from JSON", e); + } + } + + /** + * Parse JSON response into ListProductVariantsResponse object with service context for pagination + * (enables nextPage()). + */ + public static ListProductVariantsResponse fromJson( + String json, + VariantService service, + ListProductVariantsParams originalParams, + String productId, + Response httpResponse) { + try { + + List list = + JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() + .map(VariantListProductVariantsItem::fromJson) + .collect(java.util.stream.Collectors.toList()); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + + return new ListProductVariantsResponse( + list, nextOffset, productId, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException("Failed to parse ListProductVariantsResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public ListProductVariantsResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + ListProductVariantsParams nextParams = + (originalParams != null ? originalParams.toBuilder() : ListProductVariantsParams.builder()) + .offset(nextOffset) + .build(); + + return service.listProductVariants(productId, nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + public static class VariantListProductVariantsItem { + + private Variant variant; + + public Variant getVariant() { + return variant; + } + + public static VariantListProductVariantsItem fromJson(String json) { + VariantListProductVariantsItem item = new VariantListProductVariantsItem(); + + String __variantJson = JsonUtil.getObject(json, "variant"); + if (__variantJson != null) { + item.variant = Variant.fromJson(__variantJson); + } + + return item; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/variant/responses/VariantDeleteResponse.java b/src/main/java/com/chargebee/v4/models/variant/responses/VariantDeleteResponse.java new file mode 100644 index 00000000..d18daabc --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/variant/responses/VariantDeleteResponse.java @@ -0,0 +1,76 @@ +package com.chargebee.v4.models.variant.responses; + +import com.chargebee.v4.models.variant.Variant; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for VariantDelete operation. Contains the response data from the API. + */ +public final class VariantDeleteResponse extends BaseResponse { + private final Variant variant; + + private VariantDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.variant = builder.variant; + } + + /** Parse JSON response into VariantDeleteResponse object. */ + public static VariantDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into VariantDeleteResponse object with HTTP response. */ + public static VariantDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __variantJson = JsonUtil.getObject(json, "variant"); + if (__variantJson != null) { + builder.variant(Variant.fromJson(__variantJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse VariantDeleteResponse from JSON", e); + } + } + + /** Create a new builder for VariantDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for VariantDeleteResponse. */ + public static class Builder { + + private Variant variant; + + private Response httpResponse; + + private Builder() {} + + public Builder variant(Variant variant) { + this.variant = variant; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public VariantDeleteResponse build() { + return new VariantDeleteResponse(this); + } + } + + /** Get the variant from the response. */ + public Variant getVariant() { + return variant; + } +} diff --git a/src/main/java/com/chargebee/v4/models/variant/responses/VariantsForProductResponse.java b/src/main/java/com/chargebee/v4/models/variant/responses/VariantsForProductResponse.java deleted file mode 100644 index 7b2614aa..00000000 --- a/src/main/java/com/chargebee/v4/models/variant/responses/VariantsForProductResponse.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.chargebee.v4.models.variant.responses; - -import java.util.List; - -import com.chargebee.v4.models.variant.Variant; - -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; -import com.chargebee.v4.services.VariantService; -import com.chargebee.v4.models.variant.params.VariantsForProductParams; - -/** Immutable response object for VariantsForProduct operation. Contains paginated list data. */ -public final class VariantsForProductResponse { - - private final List list; - - private final String nextOffset; - - private final String productId; - - private final VariantService service; - private final VariantsForProductParams originalParams; - private final Response httpResponse; - - private VariantsForProductResponse( - List list, - String nextOffset, - String productId, - VariantService service, - VariantsForProductParams originalParams, - Response httpResponse) { - - this.list = list; - - this.nextOffset = nextOffset; - - this.productId = productId; - - this.service = service; - this.originalParams = originalParams; - this.httpResponse = httpResponse; - } - - /** - * Parse JSON response into VariantsForProductResponse object (no service context). Use this when - * you only need to read a single page (no nextPage()). - */ - public static VariantsForProductResponse fromJson(String json) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(VariantVariantsForProductItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new VariantsForProductResponse(list, nextOffset, null, null, null, null); - } catch (Exception e) { - throw new RuntimeException("Failed to parse VariantsForProductResponse from JSON", e); - } - } - - /** - * Parse JSON response into VariantsForProductResponse object with service context for pagination - * (enables nextPage()). - */ - public static VariantsForProductResponse fromJson( - String json, - VariantService service, - VariantsForProductParams originalParams, - String productId, - Response httpResponse) { - try { - - List list = - JsonUtil.parseObjectArray(JsonUtil.getArray(json, "list")).stream() - .map(VariantVariantsForProductItem::fromJson) - .collect(java.util.stream.Collectors.toList()); - - String nextOffset = JsonUtil.getString(json, "next_offset"); - - return new VariantsForProductResponse( - list, nextOffset, productId, service, originalParams, httpResponse); - } catch (Exception e) { - throw new RuntimeException("Failed to parse VariantsForProductResponse from JSON", e); - } - } - - /** Get the list from the response. */ - public List getList() { - return list; - } - - /** Get the nextOffset from the response. */ - public String getNextOffset() { - return nextOffset; - } - - /** Check if there are more pages available. */ - public boolean hasNextPage() { - return nextOffset != null && !nextOffset.isEmpty(); - } - - /** - * Get the next page of results. - * - * @throws Exception if unable to fetch next page - */ - public VariantsForProductResponse nextPage() throws Exception { - if (!hasNextPage()) { - throw new IllegalStateException("No more pages available"); - } - if (service == null) { - throw new UnsupportedOperationException( - "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); - } - - VariantsForProductParams nextParams = - (originalParams != null ? originalParams.toBuilder() : VariantsForProductParams.builder()) - .offset(nextOffset) - .build(); - - return service.variantsForProduct(productId, nextParams); - } - - /** Get the raw response payload as JSON string. */ - public String responsePayload() { - return httpResponse != null ? httpResponse.getBodyAsString() : null; - } - - /** Get the HTTP status code. */ - public int httpStatus() { - return httpResponse != null ? httpResponse.getStatusCode() : 0; - } - - /** Get response headers. */ - public java.util.Map> headers() { - return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); - } - - /** Get a specific header value. */ - public java.util.List header(String name) { - if (httpResponse == null) return null; - return httpResponse.getHeaders().entrySet().stream() - .filter(e -> e.getKey().equalsIgnoreCase(name)) - .map(java.util.Map.Entry::getValue) - .findFirst() - .orElse(null); - } - - public static class VariantVariantsForProductItem { - - private Variant variant; - - public Variant getVariant() { - return variant; - } - - public static VariantVariantsForProductItem fromJson(String json) { - VariantVariantsForProductItem item = new VariantVariantsForProductItem(); - - String __variantJson = JsonUtil.getObject(json, "variant"); - if (__variantJson != null) { - item.variant = Variant.fromJson(__variantJson); - } - - return item; - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/DeleteLocalForVirtualBankAccountParams.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/DeleteLocalForVirtualBankAccountParams.java deleted file mode 100644 index d02c4c8e..00000000 --- a/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/DeleteLocalForVirtualBankAccountParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.virtualBankAccount.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteLocalForVirtualBankAccountParams { - - private DeleteLocalForVirtualBankAccountParams(DeleteLocalForVirtualBankAccountBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteLocalForVirtualBankAccountParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteLocalForVirtualBankAccountBuilder builder() { - return new DeleteLocalForVirtualBankAccountBuilder(); - } - - public static final class DeleteLocalForVirtualBankAccountBuilder { - - private DeleteLocalForVirtualBankAccountBuilder() {} - - public DeleteLocalForVirtualBankAccountParams build() { - return new DeleteLocalForVirtualBankAccountParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/DeleteVirtualBankAccountParams.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/DeleteVirtualBankAccountParams.java deleted file mode 100644 index 183ef3c8..00000000 --- a/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/DeleteVirtualBankAccountParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.virtualBankAccount.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteVirtualBankAccountParams { - - private DeleteVirtualBankAccountParams(DeleteVirtualBankAccountBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteVirtualBankAccountParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteVirtualBankAccountBuilder builder() { - return new DeleteVirtualBankAccountBuilder(); - } - - public static final class DeleteVirtualBankAccountBuilder { - - private DeleteVirtualBankAccountBuilder() {} - - public DeleteVirtualBankAccountParams build() { - return new DeleteVirtualBankAccountParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/SyncFundForVirtualBankAccountParams.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/SyncFundForVirtualBankAccountParams.java deleted file mode 100644 index 8983bb5b..00000000 --- a/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/SyncFundForVirtualBankAccountParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.virtualBankAccount.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class SyncFundForVirtualBankAccountParams { - - private SyncFundForVirtualBankAccountParams(SyncFundForVirtualBankAccountBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for SyncFundForVirtualBankAccountParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static SyncFundForVirtualBankAccountBuilder builder() { - return new SyncFundForVirtualBankAccountBuilder(); - } - - public static final class SyncFundForVirtualBankAccountBuilder { - - private SyncFundForVirtualBankAccountBuilder() {} - - public SyncFundForVirtualBankAccountParams build() { - return new SyncFundForVirtualBankAccountParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/VirtualBankAccountDeleteLocalParams.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/VirtualBankAccountDeleteLocalParams.java new file mode 100644 index 00000000..b91169a1 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/VirtualBankAccountDeleteLocalParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.virtualBankAccount.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class VirtualBankAccountDeleteLocalParams { + + private VirtualBankAccountDeleteLocalParams(VirtualBankAccountDeleteLocalBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for VirtualBankAccountDeleteLocalParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static VirtualBankAccountDeleteLocalBuilder builder() { + return new VirtualBankAccountDeleteLocalBuilder(); + } + + public static final class VirtualBankAccountDeleteLocalBuilder { + + private VirtualBankAccountDeleteLocalBuilder() {} + + public VirtualBankAccountDeleteLocalParams build() { + return new VirtualBankAccountDeleteLocalParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/VirtualBankAccountDeleteParams.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/VirtualBankAccountDeleteParams.java new file mode 100644 index 00000000..ba6a42da --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/VirtualBankAccountDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.virtualBankAccount.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class VirtualBankAccountDeleteParams { + + private VirtualBankAccountDeleteParams(VirtualBankAccountDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for VirtualBankAccountDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static VirtualBankAccountDeleteBuilder builder() { + return new VirtualBankAccountDeleteBuilder(); + } + + public static final class VirtualBankAccountDeleteBuilder { + + private VirtualBankAccountDeleteBuilder() {} + + public VirtualBankAccountDeleteParams build() { + return new VirtualBankAccountDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/VirtualBankAccountSyncFundParams.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/VirtualBankAccountSyncFundParams.java new file mode 100644 index 00000000..a36c17c4 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/virtualBankAccount/params/VirtualBankAccountSyncFundParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.virtualBankAccount.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class VirtualBankAccountSyncFundParams { + + private VirtualBankAccountSyncFundParams(VirtualBankAccountSyncFundBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for VirtualBankAccountSyncFundParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static VirtualBankAccountSyncFundBuilder builder() { + return new VirtualBankAccountSyncFundBuilder(); + } + + public static final class VirtualBankAccountSyncFundBuilder { + + private VirtualBankAccountSyncFundBuilder() {} + + public VirtualBankAccountSyncFundParams build() { + return new VirtualBankAccountSyncFundParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/DeleteLocalForVirtualBankAccountResponse.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/DeleteLocalForVirtualBankAccountResponse.java deleted file mode 100644 index a4aac27f..00000000 --- a/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/DeleteLocalForVirtualBankAccountResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.chargebee.v4.models.virtualBankAccount.responses; - -import com.chargebee.v4.models.virtualBankAccount.VirtualBankAccount; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteLocalForVirtualBankAccount operation. Contains the response - * data from the API. - */ -public final class DeleteLocalForVirtualBankAccountResponse extends BaseResponse { - private final VirtualBankAccount virtualBankAccount; - - private DeleteLocalForVirtualBankAccountResponse(Builder builder) { - super(builder.httpResponse); - - this.virtualBankAccount = builder.virtualBankAccount; - } - - /** Parse JSON response into DeleteLocalForVirtualBankAccountResponse object. */ - public static DeleteLocalForVirtualBankAccountResponse fromJson(String json) { - return fromJson(json, null); - } - - /** - * Parse JSON response into DeleteLocalForVirtualBankAccountResponse object with HTTP response. - */ - public static DeleteLocalForVirtualBankAccountResponse fromJson( - String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __virtualBankAccountJson = JsonUtil.getObject(json, "virtual_bank_account"); - if (__virtualBankAccountJson != null) { - builder.virtualBankAccount(VirtualBankAccount.fromJson(__virtualBankAccountJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse DeleteLocalForVirtualBankAccountResponse from JSON", e); - } - } - - /** Create a new builder for DeleteLocalForVirtualBankAccountResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteLocalForVirtualBankAccountResponse. */ - public static class Builder { - - private VirtualBankAccount virtualBankAccount; - - private Response httpResponse; - - private Builder() {} - - public Builder virtualBankAccount(VirtualBankAccount virtualBankAccount) { - this.virtualBankAccount = virtualBankAccount; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteLocalForVirtualBankAccountResponse build() { - return new DeleteLocalForVirtualBankAccountResponse(this); - } - } - - /** Get the virtualBankAccount from the response. */ - public VirtualBankAccount getVirtualBankAccount() { - return virtualBankAccount; - } -} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/DeleteVirtualBankAccountResponse.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/DeleteVirtualBankAccountResponse.java deleted file mode 100644 index 102c5764..00000000 --- a/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/DeleteVirtualBankAccountResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.virtualBankAccount.responses; - -import com.chargebee.v4.models.virtualBankAccount.VirtualBankAccount; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteVirtualBankAccount operation. Contains the response data from - * the API. - */ -public final class DeleteVirtualBankAccountResponse extends BaseResponse { - private final VirtualBankAccount virtualBankAccount; - - private DeleteVirtualBankAccountResponse(Builder builder) { - super(builder.httpResponse); - - this.virtualBankAccount = builder.virtualBankAccount; - } - - /** Parse JSON response into DeleteVirtualBankAccountResponse object. */ - public static DeleteVirtualBankAccountResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteVirtualBankAccountResponse object with HTTP response. */ - public static DeleteVirtualBankAccountResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __virtualBankAccountJson = JsonUtil.getObject(json, "virtual_bank_account"); - if (__virtualBankAccountJson != null) { - builder.virtualBankAccount(VirtualBankAccount.fromJson(__virtualBankAccountJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteVirtualBankAccountResponse from JSON", e); - } - } - - /** Create a new builder for DeleteVirtualBankAccountResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteVirtualBankAccountResponse. */ - public static class Builder { - - private VirtualBankAccount virtualBankAccount; - - private Response httpResponse; - - private Builder() {} - - public Builder virtualBankAccount(VirtualBankAccount virtualBankAccount) { - this.virtualBankAccount = virtualBankAccount; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteVirtualBankAccountResponse build() { - return new DeleteVirtualBankAccountResponse(this); - } - } - - /** Get the virtualBankAccount from the response. */ - public VirtualBankAccount getVirtualBankAccount() { - return virtualBankAccount; - } -} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/SyncFundForVirtualBankAccountResponse.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/SyncFundForVirtualBankAccountResponse.java deleted file mode 100644 index 5d468ae3..00000000 --- a/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/SyncFundForVirtualBankAccountResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.chargebee.v4.models.virtualBankAccount.responses; - -import com.chargebee.v4.models.transaction.Transaction; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for SyncFundForVirtualBankAccount operation. Contains the response data - * from the API. - */ -public final class SyncFundForVirtualBankAccountResponse extends BaseResponse { - private final Transaction transaction; - - private SyncFundForVirtualBankAccountResponse(Builder builder) { - super(builder.httpResponse); - - this.transaction = builder.transaction; - } - - /** Parse JSON response into SyncFundForVirtualBankAccountResponse object. */ - public static SyncFundForVirtualBankAccountResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into SyncFundForVirtualBankAccountResponse object with HTTP response. */ - public static SyncFundForVirtualBankAccountResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __transactionJson = JsonUtil.getObject(json, "transaction"); - if (__transactionJson != null) { - builder.transaction(Transaction.fromJson(__transactionJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to parse SyncFundForVirtualBankAccountResponse from JSON", e); - } - } - - /** Create a new builder for SyncFundForVirtualBankAccountResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for SyncFundForVirtualBankAccountResponse. */ - public static class Builder { - - private Transaction transaction; - - private Response httpResponse; - - private Builder() {} - - public Builder transaction(Transaction transaction) { - this.transaction = transaction; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public SyncFundForVirtualBankAccountResponse build() { - return new SyncFundForVirtualBankAccountResponse(this); - } - } - - /** Get the transaction from the response. */ - public Transaction getTransaction() { - return transaction; - } -} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountDeleteLocalResponse.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountDeleteLocalResponse.java new file mode 100644 index 00000000..e5287124 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountDeleteLocalResponse.java @@ -0,0 +1,78 @@ +package com.chargebee.v4.models.virtualBankAccount.responses; + +import com.chargebee.v4.models.virtualBankAccount.VirtualBankAccount; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for VirtualBankAccountDeleteLocal operation. Contains the response data + * from the API. + */ +public final class VirtualBankAccountDeleteLocalResponse extends BaseResponse { + private final VirtualBankAccount virtualBankAccount; + + private VirtualBankAccountDeleteLocalResponse(Builder builder) { + super(builder.httpResponse); + + this.virtualBankAccount = builder.virtualBankAccount; + } + + /** Parse JSON response into VirtualBankAccountDeleteLocalResponse object. */ + public static VirtualBankAccountDeleteLocalResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into VirtualBankAccountDeleteLocalResponse object with HTTP response. */ + public static VirtualBankAccountDeleteLocalResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __virtualBankAccountJson = JsonUtil.getObject(json, "virtual_bank_account"); + if (__virtualBankAccountJson != null) { + builder.virtualBankAccount(VirtualBankAccount.fromJson(__virtualBankAccountJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException( + "Failed to parse VirtualBankAccountDeleteLocalResponse from JSON", e); + } + } + + /** Create a new builder for VirtualBankAccountDeleteLocalResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for VirtualBankAccountDeleteLocalResponse. */ + public static class Builder { + + private VirtualBankAccount virtualBankAccount; + + private Response httpResponse; + + private Builder() {} + + public Builder virtualBankAccount(VirtualBankAccount virtualBankAccount) { + this.virtualBankAccount = virtualBankAccount; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public VirtualBankAccountDeleteLocalResponse build() { + return new VirtualBankAccountDeleteLocalResponse(this); + } + } + + /** Get the virtualBankAccount from the response. */ + public VirtualBankAccount getVirtualBankAccount() { + return virtualBankAccount; + } +} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountDeleteResponse.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountDeleteResponse.java new file mode 100644 index 00000000..3b6a9c1d --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountDeleteResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.virtualBankAccount.responses; + +import com.chargebee.v4.models.virtualBankAccount.VirtualBankAccount; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for VirtualBankAccountDelete operation. Contains the response data from + * the API. + */ +public final class VirtualBankAccountDeleteResponse extends BaseResponse { + private final VirtualBankAccount virtualBankAccount; + + private VirtualBankAccountDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.virtualBankAccount = builder.virtualBankAccount; + } + + /** Parse JSON response into VirtualBankAccountDeleteResponse object. */ + public static VirtualBankAccountDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into VirtualBankAccountDeleteResponse object with HTTP response. */ + public static VirtualBankAccountDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __virtualBankAccountJson = JsonUtil.getObject(json, "virtual_bank_account"); + if (__virtualBankAccountJson != null) { + builder.virtualBankAccount(VirtualBankAccount.fromJson(__virtualBankAccountJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse VirtualBankAccountDeleteResponse from JSON", e); + } + } + + /** Create a new builder for VirtualBankAccountDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for VirtualBankAccountDeleteResponse. */ + public static class Builder { + + private VirtualBankAccount virtualBankAccount; + + private Response httpResponse; + + private Builder() {} + + public Builder virtualBankAccount(VirtualBankAccount virtualBankAccount) { + this.virtualBankAccount = virtualBankAccount; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public VirtualBankAccountDeleteResponse build() { + return new VirtualBankAccountDeleteResponse(this); + } + } + + /** Get the virtualBankAccount from the response. */ + public VirtualBankAccount getVirtualBankAccount() { + return virtualBankAccount; + } +} diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountListResponse.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountListResponse.java index bc421115..4d4df63a 100644 --- a/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountListResponse.java +++ b/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.virtualBankAccount.VirtualBankAccount; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.VirtualBankAccountService; @@ -99,9 +100,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public VirtualBankAccountListResponse nextPage() throws Exception { + public VirtualBankAccountListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountSyncFundResponse.java b/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountSyncFundResponse.java new file mode 100644 index 00000000..5f78b7b9 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/virtualBankAccount/responses/VirtualBankAccountSyncFundResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.virtualBankAccount.responses; + +import com.chargebee.v4.models.transaction.Transaction; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for VirtualBankAccountSyncFund operation. Contains the response data + * from the API. + */ +public final class VirtualBankAccountSyncFundResponse extends BaseResponse { + private final Transaction transaction; + + private VirtualBankAccountSyncFundResponse(Builder builder) { + super(builder.httpResponse); + + this.transaction = builder.transaction; + } + + /** Parse JSON response into VirtualBankAccountSyncFundResponse object. */ + public static VirtualBankAccountSyncFundResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into VirtualBankAccountSyncFundResponse object with HTTP response. */ + public static VirtualBankAccountSyncFundResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __transactionJson = JsonUtil.getObject(json, "transaction"); + if (__transactionJson != null) { + builder.transaction(Transaction.fromJson(__transactionJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse VirtualBankAccountSyncFundResponse from JSON", e); + } + } + + /** Create a new builder for VirtualBankAccountSyncFundResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for VirtualBankAccountSyncFundResponse. */ + public static class Builder { + + private Transaction transaction; + + private Response httpResponse; + + private Builder() {} + + public Builder transaction(Transaction transaction) { + this.transaction = transaction; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public VirtualBankAccountSyncFundResponse build() { + return new VirtualBankAccountSyncFundResponse(this); + } + } + + /** Get the transaction from the response. */ + public Transaction getTransaction() { + return transaction; + } +} diff --git a/src/main/java/com/chargebee/v4/models/webhookEndpoint/params/DeleteWebhookEndpointParams.java b/src/main/java/com/chargebee/v4/models/webhookEndpoint/params/DeleteWebhookEndpointParams.java deleted file mode 100644 index 908fce70..00000000 --- a/src/main/java/com/chargebee/v4/models/webhookEndpoint/params/DeleteWebhookEndpointParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is auto-generated by Chargebee. - * For more information on how to make changes to this file, please see the README. - * Reach out to dx@chargebee.com for any questions. - * Copyright 2025 Chargebee Inc. - */ -package com.chargebee.v4.models.webhookEndpoint.params; - -import com.chargebee.v4.internal.Recommended; - -import java.util.LinkedHashMap; -import java.util.Map; - -public final class DeleteWebhookEndpointParams { - - private DeleteWebhookEndpointParams(DeleteWebhookEndpointBuilder builder) {} - - /** Get the form data for this request. */ - public Map toFormData() { - Map formData = new LinkedHashMap<>(); - - return formData; - } - - /** Create a new builder for DeleteWebhookEndpointParams. */ - @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") - public static DeleteWebhookEndpointBuilder builder() { - return new DeleteWebhookEndpointBuilder(); - } - - public static final class DeleteWebhookEndpointBuilder { - - private DeleteWebhookEndpointBuilder() {} - - public DeleteWebhookEndpointParams build() { - return new DeleteWebhookEndpointParams(this); - } - } -} diff --git a/src/main/java/com/chargebee/v4/models/webhookEndpoint/params/WebhookEndpointDeleteParams.java b/src/main/java/com/chargebee/v4/models/webhookEndpoint/params/WebhookEndpointDeleteParams.java new file mode 100644 index 00000000..659f556c --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/webhookEndpoint/params/WebhookEndpointDeleteParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.webhookEndpoint.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class WebhookEndpointDeleteParams { + + private WebhookEndpointDeleteParams(WebhookEndpointDeleteBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for WebhookEndpointDeleteParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static WebhookEndpointDeleteBuilder builder() { + return new WebhookEndpointDeleteBuilder(); + } + + public static final class WebhookEndpointDeleteBuilder { + + private WebhookEndpointDeleteBuilder() {} + + public WebhookEndpointDeleteParams build() { + return new WebhookEndpointDeleteParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/webhookEndpoint/responses/DeleteWebhookEndpointResponse.java b/src/main/java/com/chargebee/v4/models/webhookEndpoint/responses/DeleteWebhookEndpointResponse.java deleted file mode 100644 index ca804af5..00000000 --- a/src/main/java/com/chargebee/v4/models/webhookEndpoint/responses/DeleteWebhookEndpointResponse.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.chargebee.v4.models.webhookEndpoint.responses; - -import com.chargebee.v4.models.webhookEndpoint.WebhookEndpoint; - -import com.chargebee.v4.models.BaseResponse; -import com.chargebee.v4.internal.JsonUtil; -import com.chargebee.v4.transport.Response; - -/** - * Immutable response object for DeleteWebhookEndpoint operation. Contains the response data from - * the API. - */ -public final class DeleteWebhookEndpointResponse extends BaseResponse { - private final WebhookEndpoint webhookEndpoint; - - private DeleteWebhookEndpointResponse(Builder builder) { - super(builder.httpResponse); - - this.webhookEndpoint = builder.webhookEndpoint; - } - - /** Parse JSON response into DeleteWebhookEndpointResponse object. */ - public static DeleteWebhookEndpointResponse fromJson(String json) { - return fromJson(json, null); - } - - /** Parse JSON response into DeleteWebhookEndpointResponse object with HTTP response. */ - public static DeleteWebhookEndpointResponse fromJson(String json, Response httpResponse) { - try { - Builder builder = builder(); - - String __webhookEndpointJson = JsonUtil.getObject(json, "webhook_endpoint"); - if (__webhookEndpointJson != null) { - builder.webhookEndpoint(WebhookEndpoint.fromJson(__webhookEndpointJson)); - } - - builder.httpResponse(httpResponse); - return builder.build(); - } catch (Exception e) { - throw new RuntimeException("Failed to parse DeleteWebhookEndpointResponse from JSON", e); - } - } - - /** Create a new builder for DeleteWebhookEndpointResponse. */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for DeleteWebhookEndpointResponse. */ - public static class Builder { - - private WebhookEndpoint webhookEndpoint; - - private Response httpResponse; - - private Builder() {} - - public Builder webhookEndpoint(WebhookEndpoint webhookEndpoint) { - this.webhookEndpoint = webhookEndpoint; - return this; - } - - public Builder httpResponse(Response httpResponse) { - this.httpResponse = httpResponse; - return this; - } - - public DeleteWebhookEndpointResponse build() { - return new DeleteWebhookEndpointResponse(this); - } - } - - /** Get the webhookEndpoint from the response. */ - public WebhookEndpoint getWebhookEndpoint() { - return webhookEndpoint; - } -} diff --git a/src/main/java/com/chargebee/v4/models/webhookEndpoint/responses/WebhookEndpointDeleteResponse.java b/src/main/java/com/chargebee/v4/models/webhookEndpoint/responses/WebhookEndpointDeleteResponse.java new file mode 100644 index 00000000..6d2e4511 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/webhookEndpoint/responses/WebhookEndpointDeleteResponse.java @@ -0,0 +1,77 @@ +package com.chargebee.v4.models.webhookEndpoint.responses; + +import com.chargebee.v4.models.webhookEndpoint.WebhookEndpoint; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for WebhookEndpointDelete operation. Contains the response data from + * the API. + */ +public final class WebhookEndpointDeleteResponse extends BaseResponse { + private final WebhookEndpoint webhookEndpoint; + + private WebhookEndpointDeleteResponse(Builder builder) { + super(builder.httpResponse); + + this.webhookEndpoint = builder.webhookEndpoint; + } + + /** Parse JSON response into WebhookEndpointDeleteResponse object. */ + public static WebhookEndpointDeleteResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into WebhookEndpointDeleteResponse object with HTTP response. */ + public static WebhookEndpointDeleteResponse fromJson(String json, Response httpResponse) { + try { + Builder builder = builder(); + + String __webhookEndpointJson = JsonUtil.getObject(json, "webhook_endpoint"); + if (__webhookEndpointJson != null) { + builder.webhookEndpoint(WebhookEndpoint.fromJson(__webhookEndpointJson)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse WebhookEndpointDeleteResponse from JSON", e); + } + } + + /** Create a new builder for WebhookEndpointDeleteResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for WebhookEndpointDeleteResponse. */ + public static class Builder { + + private WebhookEndpoint webhookEndpoint; + + private Response httpResponse; + + private Builder() {} + + public Builder webhookEndpoint(WebhookEndpoint webhookEndpoint) { + this.webhookEndpoint = webhookEndpoint; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public WebhookEndpointDeleteResponse build() { + return new WebhookEndpointDeleteResponse(this); + } + } + + /** Get the webhookEndpoint from the response. */ + public WebhookEndpoint getWebhookEndpoint() { + return webhookEndpoint; + } +} diff --git a/src/main/java/com/chargebee/v4/models/webhookEndpoint/responses/WebhookEndpointListResponse.java b/src/main/java/com/chargebee/v4/models/webhookEndpoint/responses/WebhookEndpointListResponse.java index 5dd92e41..cb3157a5 100644 --- a/src/main/java/com/chargebee/v4/models/webhookEndpoint/responses/WebhookEndpointListResponse.java +++ b/src/main/java/com/chargebee/v4/models/webhookEndpoint/responses/WebhookEndpointListResponse.java @@ -4,6 +4,7 @@ import com.chargebee.v4.models.webhookEndpoint.WebhookEndpoint; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.internal.JsonUtil; import com.chargebee.v4.transport.Response; import com.chargebee.v4.services.WebhookEndpointService; @@ -99,9 +100,9 @@ public boolean hasNextPage() { /** * Get the next page of results. * - * @throws Exception if unable to fetch next page + * @throws ChargebeeException if unable to fetch next page */ - public WebhookEndpointListResponse nextPage() throws Exception { + public WebhookEndpointListResponse nextPage() throws ChargebeeException { if (!hasNextPage()) { throw new IllegalStateException("No more pages available"); } diff --git a/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java b/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java index 69980531..e493a30d 100644 --- a/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java +++ b/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.additionalBillingLogiq.params.AdditionalBillingLogiqExecuteParams; +import com.chargebee.v4.models.additionalBillingLogiq.params.AdditionalBillingLogiqRetrieveParams; -import com.chargebee.v4.models.additionalBillingLogiq.responses.AdditionalBillingLogiqExecuteResponse; +import com.chargebee.v4.models.additionalBillingLogiq.responses.AdditionalBillingLogiqRetrieveResponse; public final class AdditionalBillingLogiqService extends BaseService { @@ -52,27 +53,27 @@ public AdditionalBillingLogiqService withOptions(RequestOptions options) { // === Operations === /** - * execute a additionalBillingLogiq using immutable params (executes immediately) - returns raw + * retrieve a additionalBillingLogiq using immutable params (executes immediately) - returns raw * Response. */ - Response executeRaw(AdditionalBillingLogiqExecuteParams params) throws Exception { + Response retrieveRaw(AdditionalBillingLogiqRetrieveParams params) throws ChargebeeException { return get("/additional_billing_logiqs", params != null ? params.toQueryParams() : null); } /** - * execute a additionalBillingLogiq using raw JSON payload (executes immediately) - returns raw + * retrieve a additionalBillingLogiq using raw JSON payload (executes immediately) - returns raw * Response. */ - Response executeRaw(String jsonPayload) throws Exception { + Response retrieveRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public AdditionalBillingLogiqExecuteResponse execute(AdditionalBillingLogiqExecuteParams params) - throws Exception { - Response response = executeRaw(params); + public AdditionalBillingLogiqRetrieveResponse retrieve( + AdditionalBillingLogiqRetrieveParams params) throws ChargebeeException { + Response response = retrieveRaw(params); - return AdditionalBillingLogiqExecuteResponse.fromJson(response.getBodyAsString(), response); + return AdditionalBillingLogiqRetrieveResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/AddonService.java b/src/main/java/com/chargebee/v4/services/AddonService.java index e90ad990..483f1da2 100644 --- a/src/main/java/com/chargebee/v4/services/AddonService.java +++ b/src/main/java/com/chargebee/v4/services/AddonService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.addon.params.AddonCopyParams; @@ -21,7 +22,7 @@ import com.chargebee.v4.models.addon.responses.AddonCopyResponse; -import com.chargebee.v4.models.addon.responses.UnarchiveForAddonResponse; +import com.chargebee.v4.models.addon.responses.AddonUnarchiveResponse; import com.chargebee.v4.models.addon.responses.AddonRetrieveResponse; @@ -31,7 +32,7 @@ import com.chargebee.v4.models.addon.responses.AddonCreateResponse; -import com.chargebee.v4.models.addon.responses.DeleteAddonResponse; +import com.chargebee.v4.models.addon.responses.AddonDeleteResponse; public final class AddonService extends BaseService { @@ -68,127 +69,128 @@ public AddonService withOptions(RequestOptions options) { // === Operations === /** copy a addon using immutable params (executes immediately) - returns raw Response. */ - Response copyRaw(AddonCopyParams params) throws Exception { + Response copyRaw(AddonCopyParams params) throws ChargebeeException { return post("/addons/copy", params != null ? params.toFormData() : null); } /** copy a addon using raw JSON payload (executes immediately) - returns raw Response. */ - Response copyRaw(String jsonPayload) throws Exception { + Response copyRaw(String jsonPayload) throws ChargebeeException { return postJson("/addons/copy", jsonPayload); } - public AddonCopyResponse copy(AddonCopyParams params) throws Exception { + public AddonCopyResponse copy(AddonCopyParams params) throws ChargebeeException { Response response = copyRaw(params); return AddonCopyResponse.fromJson(response.getBodyAsString(), response); } - /** unarchiveForAddon a addon (executes immediately) - returns raw Response. */ - Response unarchiveForAddonRaw(String addonId) throws Exception { + /** unarchive a addon (executes immediately) - returns raw Response. */ + Response unarchiveRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}/unarchive", "addon-id", addonId); return post(path, null); } - public UnarchiveForAddonResponse unarchiveForAddon(String addonId) throws Exception { - Response response = unarchiveForAddonRaw(addonId); - return UnarchiveForAddonResponse.fromJson(response.getBodyAsString(), response); + public AddonUnarchiveResponse unarchive(String addonId) throws ChargebeeException { + Response response = unarchiveRaw(addonId); + return AddonUnarchiveResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a addon (executes immediately) - returns raw Response. */ - Response retrieveRaw(String addonId) throws Exception { + Response retrieveRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); return get(path, null); } - public AddonRetrieveResponse retrieve(String addonId) throws Exception { + public AddonRetrieveResponse retrieve(String addonId) throws ChargebeeException { Response response = retrieveRaw(addonId); return AddonRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a addon (executes immediately) - returns raw Response. */ - Response updateRaw(String addonId) throws Exception { + Response updateRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); return post(path, null); } /** update a addon using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String addonId, AddonUpdateParams params) throws Exception { + Response updateRaw(String addonId, AddonUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); return post(path, params.toFormData()); } /** update a addon using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String addonId, String jsonPayload) throws Exception { + Response updateRaw(String addonId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); return postJson(path, jsonPayload); } - public AddonUpdateResponse update(String addonId, AddonUpdateParams params) throws Exception { + public AddonUpdateResponse update(String addonId, AddonUpdateParams params) + throws ChargebeeException { Response response = updateRaw(addonId, params); return AddonUpdateResponse.fromJson(response.getBodyAsString(), response); } /** list a addon using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(AddonListParams params) throws Exception { + Response listRaw(AddonListParams params) throws ChargebeeException { return get("/addons", params != null ? params.toQueryParams() : null); } /** list a addon without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/addons", null); } /** list a addon using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public AddonListResponse list(AddonListParams params) throws Exception { + public AddonListResponse list(AddonListParams params) throws ChargebeeException { Response response = listRaw(params); return AddonListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public AddonListResponse list() throws Exception { + public AddonListResponse list() throws ChargebeeException { Response response = listRaw(); return AddonListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a addon using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(AddonCreateParams params) throws Exception { + Response createRaw(AddonCreateParams params) throws ChargebeeException { return post("/addons", params != null ? params.toFormData() : null); } /** create a addon using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/addons", jsonPayload); } - public AddonCreateResponse create(AddonCreateParams params) throws Exception { + public AddonCreateResponse create(AddonCreateParams params) throws ChargebeeException { Response response = createRaw(params); return AddonCreateResponse.fromJson(response.getBodyAsString(), response); } - /** deleteAddon a addon (executes immediately) - returns raw Response. */ - Response deleteAddonRaw(String addonId) throws Exception { + /** delete a addon (executes immediately) - returns raw Response. */ + Response deleteRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}/delete", "addon-id", addonId); return post(path, null); } - public DeleteAddonResponse deleteAddon(String addonId) throws Exception { - Response response = deleteAddonRaw(addonId); - return DeleteAddonResponse.fromJson(response.getBodyAsString(), response); + public AddonDeleteResponse delete(String addonId) throws ChargebeeException { + Response response = deleteRaw(addonId); + return AddonDeleteResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/AddressService.java b/src/main/java/com/chargebee/v4/services/AddressService.java index aaa0883a..dd8de8df 100644 --- a/src/main/java/com/chargebee/v4/services/AddressService.java +++ b/src/main/java/com/chargebee/v4/services/AddressService.java @@ -9,15 +9,16 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.address.params.AddressExecuteParams; +import com.chargebee.v4.models.address.params.AddressRetrieveParams; -import com.chargebee.v4.models.address.params.AddressCreateParams; +import com.chargebee.v4.models.address.params.AddressUpdateParams; -import com.chargebee.v4.models.address.responses.AddressExecuteResponse; +import com.chargebee.v4.models.address.responses.AddressRetrieveResponse; -import com.chargebee.v4.models.address.responses.AddressCreateResponse; +import com.chargebee.v4.models.address.responses.AddressUpdateResponse; public final class AddressService extends BaseService { @@ -53,39 +54,39 @@ public AddressService withOptions(RequestOptions options) { // === Operations === - /** execute a address using immutable params (executes immediately) - returns raw Response. */ - Response executeRaw(AddressExecuteParams params) throws Exception { + /** retrieve a address using immutable params (executes immediately) - returns raw Response. */ + Response retrieveRaw(AddressRetrieveParams params) throws ChargebeeException { return get("/addresses", params != null ? params.toQueryParams() : null); } - /** execute a address using raw JSON payload (executes immediately) - returns raw Response. */ - Response executeRaw(String jsonPayload) throws Exception { + /** retrieve a address using raw JSON payload (executes immediately) - returns raw Response. */ + Response retrieveRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public AddressExecuteResponse execute(AddressExecuteParams params) throws Exception { - Response response = executeRaw(params); + public AddressRetrieveResponse retrieve(AddressRetrieveParams params) throws ChargebeeException { + Response response = retrieveRaw(params); - return AddressExecuteResponse.fromJson(response.getBodyAsString(), response); + return AddressRetrieveResponse.fromJson(response.getBodyAsString(), response); } - /** create a address using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(AddressCreateParams params) throws Exception { + /** update a address using immutable params (executes immediately) - returns raw Response. */ + Response updateRaw(AddressUpdateParams params) throws ChargebeeException { return post("/addresses", params != null ? params.toFormData() : null); } - /** create a address using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + /** update a address using raw JSON payload (executes immediately) - returns raw Response. */ + Response updateRaw(String jsonPayload) throws ChargebeeException { return postJson("/addresses", jsonPayload); } - public AddressCreateResponse create(AddressCreateParams params) throws Exception { - Response response = createRaw(params); + public AddressUpdateResponse update(AddressUpdateParams params) throws ChargebeeException { + Response response = updateRaw(params); - return AddressCreateResponse.fromJson(response.getBodyAsString(), response); + return AddressUpdateResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/AttachedItemService.java b/src/main/java/com/chargebee/v4/services/AttachedItemService.java index 32cb651c..81c197e3 100644 --- a/src/main/java/com/chargebee/v4/services/AttachedItemService.java +++ b/src/main/java/com/chargebee/v4/services/AttachedItemService.java @@ -9,25 +9,28 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import com.chargebee.v4.models.attachedItem.params.AttachedItemRetrieveParams; + import com.chargebee.v4.models.attachedItem.params.AttachedItemUpdateParams; -import com.chargebee.v4.models.attachedItem.params.AttachedItemsForItemParams; +import com.chargebee.v4.models.attachedItem.params.AttachedItemListParams; -import com.chargebee.v4.models.attachedItem.params.AddAttachedItemForItemParams; +import com.chargebee.v4.models.attachedItem.params.AttachedItemCreateParams; -import com.chargebee.v4.models.attachedItem.params.DeleteAttachedItemParams; +import com.chargebee.v4.models.attachedItem.params.AttachedItemDeleteParams; import com.chargebee.v4.models.attachedItem.responses.AttachedItemRetrieveResponse; import com.chargebee.v4.models.attachedItem.responses.AttachedItemUpdateResponse; -import com.chargebee.v4.models.attachedItem.responses.AttachedItemsForItemResponse; +import com.chargebee.v4.models.attachedItem.responses.AttachedItemListResponse; -import com.chargebee.v4.models.attachedItem.responses.AddAttachedItemForItemResponse; +import com.chargebee.v4.models.attachedItem.responses.AttachedItemCreateResponse; -import com.chargebee.v4.models.attachedItem.responses.DeleteAttachedItemResponse; +import com.chargebee.v4.models.attachedItem.responses.AttachedItemDeleteResponse; public final class AttachedItemService extends BaseService { @@ -65,7 +68,7 @@ public AttachedItemService withOptions(RequestOptions options) { // === Operations === /** retrieve a attachedItem (executes immediately) - returns raw Response. */ - Response retrieveRaw(String attachedItemId) throws Exception { + Response retrieveRaw(String attachedItemId) throws ChargebeeException { String path = buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); @@ -73,13 +76,30 @@ Response retrieveRaw(String attachedItemId) throws Exception { return get(path, null); } - public AttachedItemRetrieveResponse retrieve(String attachedItemId) throws Exception { + /** + * retrieve a attachedItem using immutable params (executes immediately) - returns raw Response. + */ + Response retrieveRaw(String attachedItemId, AttachedItemRetrieveParams params) + throws ChargebeeException { + String path = + buildPathWithParams( + "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); + return get(path, params != null ? params.toQueryParams() : null); + } + + public AttachedItemRetrieveResponse retrieve( + String attachedItemId, AttachedItemRetrieveParams params) throws ChargebeeException { + Response response = retrieveRaw(attachedItemId, params); + return AttachedItemRetrieveResponse.fromJson(response.getBodyAsString(), response); + } + + public AttachedItemRetrieveResponse retrieve(String attachedItemId) throws ChargebeeException { Response response = retrieveRaw(attachedItemId); return AttachedItemRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a attachedItem (executes immediately) - returns raw Response. */ - Response updateRaw(String attachedItemId) throws Exception { + Response updateRaw(String attachedItemId) throws ChargebeeException { String path = buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); @@ -88,7 +108,8 @@ Response updateRaw(String attachedItemId) throws Exception { } /** update a attachedItem using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String attachedItemId, AttachedItemUpdateParams params) throws Exception { + Response updateRaw(String attachedItemId, AttachedItemUpdateParams params) + throws ChargebeeException { String path = buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); @@ -96,7 +117,7 @@ Response updateRaw(String attachedItemId, AttachedItemUpdateParams params) throw } /** update a attachedItem using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String attachedItemId, String jsonPayload) throws Exception { + Response updateRaw(String attachedItemId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); @@ -104,86 +125,69 @@ Response updateRaw(String attachedItemId, String jsonPayload) throws Exception { } public AttachedItemUpdateResponse update(String attachedItemId, AttachedItemUpdateParams params) - throws Exception { + throws ChargebeeException { Response response = updateRaw(attachedItemId, params); return AttachedItemUpdateResponse.fromJson(response.getBodyAsString(), response); } - /** - * attachedItemsForItem a attachedItem using immutable params (executes immediately) - returns raw - * Response. - */ - Response attachedItemsForItemRaw(String itemId, AttachedItemsForItemParams params) - throws Exception { + /** list a attachedItem using immutable params (executes immediately) - returns raw Response. */ + Response listRaw(String itemId, AttachedItemListParams params) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); return get(path, params != null ? params.toQueryParams() : null); } - /** - * attachedItemsForItem a attachedItem without params (executes immediately) - returns raw - * Response. - */ - Response attachedItemsForItemRaw(String itemId) throws Exception { + /** list a attachedItem without params (executes immediately) - returns raw Response. */ + Response listRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); return get(path, null); } - /** - * attachedItemsForItem a attachedItem using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response attachedItemsForItemRaw(String itemId, String jsonPayload) throws Exception { + /** list a attachedItem using raw JSON payload (executes immediately) - returns raw Response. */ + Response listRaw(String itemId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public AttachedItemsForItemResponse attachedItemsForItem( - String itemId, AttachedItemsForItemParams params) throws Exception { - Response response = attachedItemsForItemRaw(itemId, params); - return AttachedItemsForItemResponse.fromJson( + public AttachedItemListResponse list(String itemId, AttachedItemListParams params) + throws ChargebeeException { + Response response = listRaw(itemId, params); + return AttachedItemListResponse.fromJson( response.getBodyAsString(), this, params, itemId, response); } - public AttachedItemsForItemResponse attachedItemsForItem(String itemId) throws Exception { - Response response = attachedItemsForItemRaw(itemId); - return AttachedItemsForItemResponse.fromJson( + public AttachedItemListResponse list(String itemId) throws ChargebeeException { + Response response = listRaw(itemId); + return AttachedItemListResponse.fromJson( response.getBodyAsString(), this, null, itemId, response); } - /** addAttachedItemForItem a attachedItem (executes immediately) - returns raw Response. */ - Response addAttachedItemForItemRaw(String itemId) throws Exception { + /** create a attachedItem (executes immediately) - returns raw Response. */ + Response createRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); return post(path, null); } - /** - * addAttachedItemForItem a attachedItem using immutable params (executes immediately) - returns - * raw Response. - */ - Response addAttachedItemForItemRaw(String itemId, AddAttachedItemForItemParams params) - throws Exception { + /** create a attachedItem using immutable params (executes immediately) - returns raw Response. */ + Response createRaw(String itemId, AttachedItemCreateParams params) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); return post(path, params.toFormData()); } - /** - * addAttachedItemForItem a attachedItem using raw JSON payload (executes immediately) - returns - * raw Response. - */ - Response addAttachedItemForItemRaw(String itemId, String jsonPayload) throws Exception { + /** create a attachedItem using raw JSON payload (executes immediately) - returns raw Response. */ + Response createRaw(String itemId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); return postJson(path, jsonPayload); } - public AddAttachedItemForItemResponse addAttachedItemForItem( - String itemId, AddAttachedItemForItemParams params) throws Exception { - Response response = addAttachedItemForItemRaw(itemId, params); - return AddAttachedItemForItemResponse.fromJson(response.getBodyAsString(), response); + public AttachedItemCreateResponse create(String itemId, AttachedItemCreateParams params) + throws ChargebeeException { + Response response = createRaw(itemId, params); + return AttachedItemCreateResponse.fromJson(response.getBodyAsString(), response); } - /** deleteAttachedItem a attachedItem (executes immediately) - returns raw Response. */ - Response deleteAttachedItemRaw(String attachedItemId) throws Exception { + /** delete a attachedItem (executes immediately) - returns raw Response. */ + Response deleteRaw(String attachedItemId) throws ChargebeeException { String path = buildPathWithParams( "/attached_items/{attached-item-id}/delete", "attached-item-id", attachedItemId); @@ -191,32 +195,26 @@ Response deleteAttachedItemRaw(String attachedItemId) throws Exception { return post(path, null); } - /** - * deleteAttachedItem a attachedItem using immutable params (executes immediately) - returns raw - * Response. - */ - Response deleteAttachedItemRaw(String attachedItemId, DeleteAttachedItemParams params) - throws Exception { + /** delete a attachedItem using immutable params (executes immediately) - returns raw Response. */ + Response deleteRaw(String attachedItemId, AttachedItemDeleteParams params) + throws ChargebeeException { String path = buildPathWithParams( "/attached_items/{attached-item-id}/delete", "attached-item-id", attachedItemId); return post(path, params.toFormData()); } - /** - * deleteAttachedItem a attachedItem using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response deleteAttachedItemRaw(String attachedItemId, String jsonPayload) throws Exception { + /** delete a attachedItem using raw JSON payload (executes immediately) - returns raw Response. */ + Response deleteRaw(String attachedItemId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/attached_items/{attached-item-id}/delete", "attached-item-id", attachedItemId); return postJson(path, jsonPayload); } - public DeleteAttachedItemResponse deleteAttachedItem( - String attachedItemId, DeleteAttachedItemParams params) throws Exception { - Response response = deleteAttachedItemRaw(attachedItemId, params); - return DeleteAttachedItemResponse.fromJson(response.getBodyAsString(), response); + public AttachedItemDeleteResponse delete(String attachedItemId, AttachedItemDeleteParams params) + throws ChargebeeException { + Response response = deleteRaw(attachedItemId, params); + return AttachedItemDeleteResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/BaseService.java b/src/main/java/com/chargebee/v4/services/BaseService.java index 14908c62..d8f2a1cd 100644 --- a/src/main/java/com/chargebee/v4/services/BaseService.java +++ b/src/main/java/com/chargebee/v4/services/BaseService.java @@ -3,6 +3,7 @@ import com.chargebee.v4.client.request.RequestContext; import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Request; import com.chargebee.v4.transport.Response; import com.chargebee.v4.transport.UrlBuilder; @@ -97,7 +98,7 @@ protected Object clientForBuilders() { /** * Helper: POST with optional headers. */ - protected Response post(String path, Map formData) throws Exception { + protected Response post(String path, Map formData) throws ChargebeeException { String fullUrl = UrlBuilder.buildUrl(client.getBaseUrl(), path, null); Request.Builder builder = Request.builder() .method("POST") @@ -110,7 +111,7 @@ protected Response post(String path, Map formData) throws Except /** * Helper: POST JSON with optional headers. */ - protected Response postJson(String path, String jsonData) throws Exception { + protected Response postJson(String path, String jsonData) throws ChargebeeException { String fullUrl = UrlBuilder.buildUrl(client.getBaseUrl(), path, null); Request.Builder builder = Request.builder() .method("POST") @@ -173,7 +174,7 @@ protected R parseResponse(Response response, Class responseClass) { /** * GET with Object query parameters. */ - protected Response get(String path, Map queryParams) throws Exception { + protected Response get(String path, Map queryParams) throws ChargebeeException { String fullUrl = UrlBuilder.buildUrl(client.getBaseUrl(), path, queryParams); Request.Builder builder = Request.builder() .method("GET") diff --git a/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java b/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java index d0859fe9..d9794724 100644 --- a/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.brandConfiguration.params.BrandConfigurationExecuteParams; +import com.chargebee.v4.models.brandConfiguration.params.BrandConfigurationRetrieveParams; -import com.chargebee.v4.models.brandConfiguration.responses.BrandConfigurationExecuteResponse; +import com.chargebee.v4.models.brandConfiguration.responses.BrandConfigurationRetrieveResponse; public final class BrandConfigurationService extends BaseService { @@ -51,27 +52,27 @@ public BrandConfigurationService withOptions(RequestOptions options) { // === Operations === /** - * execute a brandConfiguration using immutable params (executes immediately) - returns raw + * retrieve a brandConfiguration using immutable params (executes immediately) - returns raw * Response. */ - Response executeRaw(BrandConfigurationExecuteParams params) throws Exception { + Response retrieveRaw(BrandConfigurationRetrieveParams params) throws ChargebeeException { return get("/brand_configurations", params != null ? params.toQueryParams() : null); } /** - * execute a brandConfiguration using raw JSON payload (executes immediately) - returns raw + * retrieve a brandConfiguration using raw JSON payload (executes immediately) - returns raw * Response. */ - Response executeRaw(String jsonPayload) throws Exception { + Response retrieveRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public BrandConfigurationExecuteResponse execute(BrandConfigurationExecuteParams params) - throws Exception { - Response response = executeRaw(params); + public BrandConfigurationRetrieveResponse retrieve(BrandConfigurationRetrieveParams params) + throws ChargebeeException { + Response response = retrieveRaw(params); - return BrandConfigurationExecuteResponse.fromJson(response.getBodyAsString(), response); + return BrandConfigurationRetrieveResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/BusinessEntityService.java b/src/main/java/com/chargebee/v4/services/BusinessEntityService.java index ba5c57f0..fef0494a 100644 --- a/src/main/java/com/chargebee/v4/services/BusinessEntityService.java +++ b/src/main/java/com/chargebee/v4/services/BusinessEntityService.java @@ -9,15 +9,16 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.businessEntity.params.BusinessEntityListTransfersParams; +import com.chargebee.v4.models.businessEntity.params.BusinessEntityGetTransfersParams; -import com.chargebee.v4.models.businessEntity.params.BusinessEntityTransfersParams; +import com.chargebee.v4.models.businessEntity.params.BusinessEntityCreateTransfersParams; -import com.chargebee.v4.models.businessEntity.responses.BusinessEntityListTransfersResponse; +import com.chargebee.v4.models.businessEntity.responses.BusinessEntityGetTransfersResponse; -import com.chargebee.v4.models.businessEntity.responses.BusinessEntityTransfersResponse; +import com.chargebee.v4.models.businessEntity.responses.BusinessEntityCreateTransfersResponse; public final class BusinessEntityService extends BaseService { @@ -55,67 +56,66 @@ public BusinessEntityService withOptions(RequestOptions options) { // === Operations === /** - * listTransfers a businessEntity using immutable params (executes immediately) - returns raw + * getTransfers a businessEntity using immutable params (executes immediately) - returns raw * Response. */ - Response listTransfersRaw(BusinessEntityListTransfersParams params) throws Exception { + Response getTransfersRaw(BusinessEntityGetTransfersParams params) throws ChargebeeException { return get("/business_entities/transfers", params != null ? params.toQueryParams() : null); } - /** - * listTransfers a businessEntity without params (executes immediately) - returns raw Response. - */ - Response listTransfersRaw() throws Exception { + /** getTransfers a businessEntity without params (executes immediately) - returns raw Response. */ + Response getTransfersRaw() throws ChargebeeException { return get("/business_entities/transfers", null); } /** - * listTransfers a businessEntity using raw JSON payload (executes immediately) - returns raw + * getTransfers a businessEntity using raw JSON payload (executes immediately) - returns raw * Response. */ - Response listTransfersRaw(String jsonPayload) throws Exception { + Response getTransfersRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public BusinessEntityListTransfersResponse listTransfers(BusinessEntityListTransfersParams params) - throws Exception { - Response response = listTransfersRaw(params); + public BusinessEntityGetTransfersResponse getTransfers(BusinessEntityGetTransfersParams params) + throws ChargebeeException { + Response response = getTransfersRaw(params); - return BusinessEntityListTransfersResponse.fromJson( + return BusinessEntityGetTransfersResponse.fromJson( response.getBodyAsString(), this, params, response); } - public BusinessEntityListTransfersResponse listTransfers() throws Exception { - Response response = listTransfersRaw(); - return BusinessEntityListTransfersResponse.fromJson( + public BusinessEntityGetTransfersResponse getTransfers() throws ChargebeeException { + Response response = getTransfersRaw(); + return BusinessEntityGetTransfersResponse.fromJson( response.getBodyAsString(), this, null, response); } /** - * transfers a businessEntity using immutable params (executes immediately) - returns raw + * createTransfers a businessEntity using immutable params (executes immediately) - returns raw * Response. */ - Response transfersRaw(BusinessEntityTransfersParams params) throws Exception { + Response createTransfersRaw(BusinessEntityCreateTransfersParams params) + throws ChargebeeException { return post("/business_entities/transfers", params != null ? params.toFormData() : null); } /** - * transfers a businessEntity using raw JSON payload (executes immediately) - returns raw + * createTransfers a businessEntity using raw JSON payload (executes immediately) - returns raw * Response. */ - Response transfersRaw(String jsonPayload) throws Exception { + Response createTransfersRaw(String jsonPayload) throws ChargebeeException { return postJson("/business_entities/transfers", jsonPayload); } - public BusinessEntityTransfersResponse transfers(BusinessEntityTransfersParams params) - throws Exception { - Response response = transfersRaw(params); + public BusinessEntityCreateTransfersResponse createTransfers( + BusinessEntityCreateTransfersParams params) throws ChargebeeException { + Response response = createTransfersRaw(params); - return BusinessEntityTransfersResponse.fromJson(response.getBodyAsString(), response); + return BusinessEntityCreateTransfersResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/BusinessProfileService.java b/src/main/java/com/chargebee/v4/services/BusinessProfileService.java index 4992c8ed..65cea03d 100644 --- a/src/main/java/com/chargebee/v4/services/BusinessProfileService.java +++ b/src/main/java/com/chargebee/v4/services/BusinessProfileService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.businessProfile.params.BusinessProfileExecuteParams; +import com.chargebee.v4.models.businessProfile.params.BusinessProfileRetrieveParams; -import com.chargebee.v4.models.businessProfile.responses.BusinessProfileExecuteResponse; +import com.chargebee.v4.models.businessProfile.responses.BusinessProfileRetrieveResponse; public final class BusinessProfileService extends BaseService { @@ -51,25 +52,27 @@ public BusinessProfileService withOptions(RequestOptions options) { // === Operations === /** - * execute a businessProfile using immutable params (executes immediately) - returns raw Response. + * retrieve a businessProfile using immutable params (executes immediately) - returns raw + * Response. */ - Response executeRaw(BusinessProfileExecuteParams params) throws Exception { + Response retrieveRaw(BusinessProfileRetrieveParams params) throws ChargebeeException { return get("/business_profiles", params != null ? params.toQueryParams() : null); } /** - * execute a businessProfile using raw JSON payload (executes immediately) - returns raw Response. + * retrieve a businessProfile using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response executeRaw(String jsonPayload) throws Exception { + Response retrieveRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public BusinessProfileExecuteResponse execute(BusinessProfileExecuteParams params) - throws Exception { - Response response = executeRaw(params); + public BusinessProfileRetrieveResponse retrieve(BusinessProfileRetrieveParams params) + throws ChargebeeException { + Response response = retrieveRaw(params); - return BusinessProfileExecuteResponse.fromJson(response.getBodyAsString(), response); + return BusinessProfileRetrieveResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/CardService.java b/src/main/java/com/chargebee/v4/services/CardService.java index e2af057e..7df2fa95 100644 --- a/src/main/java/com/chargebee/v4/services/CardService.java +++ b/src/main/java/com/chargebee/v4/services/CardService.java @@ -9,13 +9,14 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.card.params.CopyCardForCustomerParams; import com.chargebee.v4.models.card.params.CardSwitchGatewayForCustomerParams; -import com.chargebee.v4.models.card.params.CreditCardForCustomerParams; +import com.chargebee.v4.models.card.params.UpdateCardForCustomerParams; import com.chargebee.v4.models.card.responses.CopyCardForCustomerResponse; @@ -25,7 +26,7 @@ import com.chargebee.v4.models.card.responses.DeleteCardForCustomerResponse; -import com.chargebee.v4.models.card.responses.CreditCardForCustomerResponse; +import com.chargebee.v4.models.card.responses.UpdateCardForCustomerResponse; public final class CardService extends BaseService { @@ -62,7 +63,7 @@ public CardService withOptions(RequestOptions options) { // === Operations === /** copyCardForCustomer a card (executes immediately) - returns raw Response. */ - Response copyCardForCustomerRaw(String customerId) throws Exception { + Response copyCardForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/copy_card", "customer-id", customerId); @@ -74,7 +75,7 @@ Response copyCardForCustomerRaw(String customerId) throws Exception { * Response. */ Response copyCardForCustomerRaw(String customerId, CopyCardForCustomerParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/copy_card", "customer-id", customerId); return post(path, params.toFormData()); @@ -84,32 +85,32 @@ Response copyCardForCustomerRaw(String customerId, CopyCardForCustomerParams par * copyCardForCustomer a card using raw JSON payload (executes immediately) - returns raw * Response. */ - Response copyCardForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response copyCardForCustomerRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/copy_card", "customer-id", customerId); return postJson(path, jsonPayload); } public CopyCardForCustomerResponse copyCardForCustomer( - String customerId, CopyCardForCustomerParams params) throws Exception { + String customerId, CopyCardForCustomerParams params) throws ChargebeeException { Response response = copyCardForCustomerRaw(customerId, params); return CopyCardForCustomerResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a card (executes immediately) - returns raw Response. */ - Response retrieveRaw(String customerId) throws Exception { + Response retrieveRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/cards/{customer-id}", "customer-id", customerId); return get(path, null); } - public CardRetrieveResponse retrieve(String customerId) throws Exception { + public CardRetrieveResponse retrieve(String customerId) throws ChargebeeException { Response response = retrieveRaw(customerId); return CardRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** switchGatewayForCustomer a card (executes immediately) - returns raw Response. */ - Response switchGatewayForCustomerRaw(String customerId) throws Exception { + Response switchGatewayForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/switch_gateway", "customer-id", customerId); @@ -121,7 +122,7 @@ Response switchGatewayForCustomerRaw(String customerId) throws Exception { * Response. */ Response switchGatewayForCustomerRaw(String customerId, CardSwitchGatewayForCustomerParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/switch_gateway", "customer-id", customerId); return post(path, params.toFormData()); @@ -131,33 +132,35 @@ Response switchGatewayForCustomerRaw(String customerId, CardSwitchGatewayForCust * switchGatewayForCustomer a card using raw JSON payload (executes immediately) - returns raw * Response. */ - Response switchGatewayForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response switchGatewayForCustomerRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/switch_gateway", "customer-id", customerId); return postJson(path, jsonPayload); } public CardSwitchGatewayForCustomerResponse switchGatewayForCustomer( - String customerId, CardSwitchGatewayForCustomerParams params) throws Exception { + String customerId, CardSwitchGatewayForCustomerParams params) throws ChargebeeException { Response response = switchGatewayForCustomerRaw(customerId, params); return CardSwitchGatewayForCustomerResponse.fromJson(response.getBodyAsString(), response); } /** deleteCardForCustomer a card (executes immediately) - returns raw Response. */ - Response deleteCardForCustomerRaw(String customerId) throws Exception { + Response deleteCardForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete_card", "customer-id", customerId); return post(path, null); } - public DeleteCardForCustomerResponse deleteCardForCustomer(String customerId) throws Exception { + public DeleteCardForCustomerResponse deleteCardForCustomer(String customerId) + throws ChargebeeException { Response response = deleteCardForCustomerRaw(customerId); return DeleteCardForCustomerResponse.fromJson(response.getBodyAsString(), response); } - /** creditCardForCustomer a card (executes immediately) - returns raw Response. */ - Response creditCardForCustomerRaw(String customerId) throws Exception { + /** updateCardForCustomer a card (executes immediately) - returns raw Response. */ + Response updateCardForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/credit_card", "customer-id", customerId); @@ -165,29 +168,30 @@ Response creditCardForCustomerRaw(String customerId) throws Exception { } /** - * creditCardForCustomer a card using immutable params (executes immediately) - returns raw + * updateCardForCustomer a card using immutable params (executes immediately) - returns raw * Response. */ - Response creditCardForCustomerRaw(String customerId, CreditCardForCustomerParams params) - throws Exception { + Response updateCardForCustomerRaw(String customerId, UpdateCardForCustomerParams params) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/credit_card", "customer-id", customerId); return post(path, params.toFormData()); } /** - * creditCardForCustomer a card using raw JSON payload (executes immediately) - returns raw + * updateCardForCustomer a card using raw JSON payload (executes immediately) - returns raw * Response. */ - Response creditCardForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response updateCardForCustomerRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/credit_card", "customer-id", customerId); return postJson(path, jsonPayload); } - public CreditCardForCustomerResponse creditCardForCustomer( - String customerId, CreditCardForCustomerParams params) throws Exception { - Response response = creditCardForCustomerRaw(customerId, params); - return CreditCardForCustomerResponse.fromJson(response.getBodyAsString(), response); + public UpdateCardForCustomerResponse updateCardForCustomer( + String customerId, UpdateCardForCustomerParams params) throws ChargebeeException { + Response response = updateCardForCustomerRaw(customerId, params); + return UpdateCardForCustomerResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/CommentService.java b/src/main/java/com/chargebee/v4/services/CommentService.java index caefabe7..19c69d32 100644 --- a/src/main/java/com/chargebee/v4/services/CommentService.java +++ b/src/main/java/com/chargebee/v4/services/CommentService.java @@ -9,13 +9,14 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.comment.params.CommentListParams; import com.chargebee.v4.models.comment.params.CommentCreateParams; -import com.chargebee.v4.models.comment.responses.DeleteCommentResponse; +import com.chargebee.v4.models.comment.responses.CommentDeleteResponse; import com.chargebee.v4.models.comment.responses.CommentRetrieveResponse; @@ -57,72 +58,72 @@ public CommentService withOptions(RequestOptions options) { // === Operations === - /** deleteComment a comment (executes immediately) - returns raw Response. */ - Response deleteCommentRaw(String commentId) throws Exception { + /** delete a comment (executes immediately) - returns raw Response. */ + Response deleteRaw(String commentId) throws ChargebeeException { String path = buildPathWithParams("/comments/{comment-id}/delete", "comment-id", commentId); return post(path, null); } - public DeleteCommentResponse deleteComment(String commentId) throws Exception { - Response response = deleteCommentRaw(commentId); - return DeleteCommentResponse.fromJson(response.getBodyAsString(), response); + public CommentDeleteResponse delete(String commentId) throws ChargebeeException { + Response response = deleteRaw(commentId); + return CommentDeleteResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a comment (executes immediately) - returns raw Response. */ - Response retrieveRaw(String commentId) throws Exception { + Response retrieveRaw(String commentId) throws ChargebeeException { String path = buildPathWithParams("/comments/{comment-id}", "comment-id", commentId); return get(path, null); } - public CommentRetrieveResponse retrieve(String commentId) throws Exception { + public CommentRetrieveResponse retrieve(String commentId) throws ChargebeeException { Response response = retrieveRaw(commentId); return CommentRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** list a comment using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(CommentListParams params) throws Exception { + Response listRaw(CommentListParams params) throws ChargebeeException { return get("/comments", params != null ? params.toQueryParams() : null); } /** list a comment without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/comments", null); } /** list a comment using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public CommentListResponse list(CommentListParams params) throws Exception { + public CommentListResponse list(CommentListParams params) throws ChargebeeException { Response response = listRaw(params); return CommentListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public CommentListResponse list() throws Exception { + public CommentListResponse list() throws ChargebeeException { Response response = listRaw(); return CommentListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a comment using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(CommentCreateParams params) throws Exception { + Response createRaw(CommentCreateParams params) throws ChargebeeException { return post("/comments", params != null ? params.toFormData() : null); } /** create a comment using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/comments", jsonPayload); } - public CommentCreateResponse create(CommentCreateParams params) throws Exception { + public CommentCreateResponse create(CommentCreateParams params) throws ChargebeeException { Response response = createRaw(params); return CommentCreateResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/ConfigurationService.java b/src/main/java/com/chargebee/v4/services/ConfigurationService.java index b6e3647b..79d38235 100644 --- a/src/main/java/com/chargebee/v4/services/ConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/ConfigurationService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.configuration.params.ConfigurationExecuteParams; +import com.chargebee.v4.models.configuration.params.ConfigurationListParams; -import com.chargebee.v4.models.configuration.responses.ConfigurationExecuteResponse; +import com.chargebee.v4.models.configuration.responses.ConfigurationListResponse; public final class ConfigurationService extends BaseService { @@ -50,25 +51,21 @@ public ConfigurationService withOptions(RequestOptions options) { // === Operations === - /** - * execute a configuration using immutable params (executes immediately) - returns raw Response. - */ - Response executeRaw(ConfigurationExecuteParams params) throws Exception { + /** list a configuration using immutable params (executes immediately) - returns raw Response. */ + Response listRaw(ConfigurationListParams params) throws ChargebeeException { return get("/configurations", params != null ? params.toQueryParams() : null); } - /** - * execute a configuration using raw JSON payload (executes immediately) - returns raw Response. - */ - Response executeRaw(String jsonPayload) throws Exception { + /** list a configuration using raw JSON payload (executes immediately) - returns raw Response. */ + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public ConfigurationExecuteResponse execute(ConfigurationExecuteParams params) throws Exception { - Response response = executeRaw(params); + public ConfigurationListResponse list(ConfigurationListParams params) throws ChargebeeException { + Response response = listRaw(params); - return ConfigurationExecuteResponse.fromJson(response.getBodyAsString(), response); + return ConfigurationListResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/CouponCodeService.java b/src/main/java/com/chargebee/v4/services/CouponCodeService.java index 7bb23ee5..5da0cb04 100644 --- a/src/main/java/com/chargebee/v4/services/CouponCodeService.java +++ b/src/main/java/com/chargebee/v4/services/CouponCodeService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.couponCode.params.CouponCodeListParams; @@ -21,7 +22,7 @@ import com.chargebee.v4.models.couponCode.responses.CouponCodeRetrieveResponse; -import com.chargebee.v4.models.couponCode.responses.ArchiveForCouponCodeResponse; +import com.chargebee.v4.models.couponCode.responses.CouponCodeArchiveResponse; public final class CouponCodeService extends BaseService { @@ -58,67 +59,67 @@ public CouponCodeService withOptions(RequestOptions options) { // === Operations === /** list a couponCode using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(CouponCodeListParams params) throws Exception { + Response listRaw(CouponCodeListParams params) throws ChargebeeException { return get("/coupon_codes", params != null ? params.toQueryParams() : null); } /** list a couponCode without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/coupon_codes", null); } /** list a couponCode using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public CouponCodeListResponse list(CouponCodeListParams params) throws Exception { + public CouponCodeListResponse list(CouponCodeListParams params) throws ChargebeeException { Response response = listRaw(params); return CouponCodeListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public CouponCodeListResponse list() throws Exception { + public CouponCodeListResponse list() throws ChargebeeException { Response response = listRaw(); return CouponCodeListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a couponCode using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(CouponCodeCreateParams params) throws Exception { + Response createRaw(CouponCodeCreateParams params) throws ChargebeeException { return post("/coupon_codes", params != null ? params.toFormData() : null); } /** create a couponCode using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/coupon_codes", jsonPayload); } - public CouponCodeCreateResponse create(CouponCodeCreateParams params) throws Exception { + public CouponCodeCreateResponse create(CouponCodeCreateParams params) throws ChargebeeException { Response response = createRaw(params); return CouponCodeCreateResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a couponCode (executes immediately) - returns raw Response. */ - Response retrieveRaw(String couponCodeCode) throws Exception { + Response retrieveRaw(String couponCodeCode) throws ChargebeeException { String path = buildPathWithParams("/coupon_codes/{coupon-code-code}", "coupon-code-code", couponCodeCode); return get(path, null); } - public CouponCodeRetrieveResponse retrieve(String couponCodeCode) throws Exception { + public CouponCodeRetrieveResponse retrieve(String couponCodeCode) throws ChargebeeException { Response response = retrieveRaw(couponCodeCode); return CouponCodeRetrieveResponse.fromJson(response.getBodyAsString(), response); } - /** archiveForCouponCode a couponCode (executes immediately) - returns raw Response. */ - Response archiveForCouponCodeRaw(String couponCodeCode) throws Exception { + /** archive a couponCode (executes immediately) - returns raw Response. */ + Response archiveRaw(String couponCodeCode) throws ChargebeeException { String path = buildPathWithParams( "/coupon_codes/{coupon-code-code}/archive", "coupon-code-code", couponCodeCode); @@ -126,8 +127,8 @@ Response archiveForCouponCodeRaw(String couponCodeCode) throws Exception { return post(path, null); } - public ArchiveForCouponCodeResponse archiveForCouponCode(String couponCodeCode) throws Exception { - Response response = archiveForCouponCodeRaw(couponCodeCode); - return ArchiveForCouponCodeResponse.fromJson(response.getBodyAsString(), response); + public CouponCodeArchiveResponse archive(String couponCodeCode) throws ChargebeeException { + Response response = archiveRaw(couponCodeCode); + return CouponCodeArchiveResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/CouponService.java b/src/main/java/com/chargebee/v4/services/CouponService.java index 2c966642..f3765e19 100644 --- a/src/main/java/com/chargebee/v4/services/CouponService.java +++ b/src/main/java/com/chargebee/v4/services/CouponService.java @@ -9,13 +9,14 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.coupon.params.CouponListParams; import com.chargebee.v4.models.coupon.params.CouponCreateParams; -import com.chargebee.v4.models.coupon.params.UpdateForItemsForCouponParams; +import com.chargebee.v4.models.coupon.params.CouponUpdateForItemsParams; import com.chargebee.v4.models.coupon.params.CouponCopyParams; @@ -27,11 +28,11 @@ import com.chargebee.v4.models.coupon.responses.CouponCreateResponse; -import com.chargebee.v4.models.coupon.responses.UpdateForItemsForCouponResponse; +import com.chargebee.v4.models.coupon.responses.CouponUpdateForItemsResponse; -import com.chargebee.v4.models.coupon.responses.UnarchiveForCouponResponse; +import com.chargebee.v4.models.coupon.responses.CouponUnarchiveResponse; -import com.chargebee.v4.models.coupon.responses.DeleteCouponResponse; +import com.chargebee.v4.models.coupon.responses.CouponDeleteResponse; import com.chargebee.v4.models.coupon.responses.CouponCopyResponse; @@ -76,54 +77,54 @@ public CouponService withOptions(RequestOptions options) { // === Operations === /** list a coupon using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(CouponListParams params) throws Exception { + Response listRaw(CouponListParams params) throws ChargebeeException { return get("/coupons", params != null ? params.toQueryParams() : null); } /** list a coupon without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/coupons", null); } /** list a coupon using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public CouponListResponse list(CouponListParams params) throws Exception { + public CouponListResponse list(CouponListParams params) throws ChargebeeException { Response response = listRaw(params); return CouponListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public CouponListResponse list() throws Exception { + public CouponListResponse list() throws ChargebeeException { Response response = listRaw(); return CouponListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a coupon using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(CouponCreateParams params) throws Exception { + Response createRaw(CouponCreateParams params) throws ChargebeeException { return post("/coupons", params != null ? params.toFormData() : null); } /** create a coupon using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/coupons", jsonPayload); } - public CouponCreateResponse create(CouponCreateParams params) throws Exception { + public CouponCreateResponse create(CouponCreateParams params) throws ChargebeeException { Response response = createRaw(params); return CouponCreateResponse.fromJson(response.getBodyAsString(), response); } - /** updateForItemsForCoupon a coupon (executes immediately) - returns raw Response. */ - Response updateForItemsForCouponRaw(String couponId) throws Exception { + /** updateForItems a coupon (executes immediately) - returns raw Response. */ + Response updateForItemsRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}/update_for_items", "coupon-id", couponId); @@ -131,106 +132,105 @@ Response updateForItemsForCouponRaw(String couponId) throws Exception { } /** - * updateForItemsForCoupon a coupon using immutable params (executes immediately) - returns raw - * Response. + * updateForItems a coupon using immutable params (executes immediately) - returns raw Response. */ - Response updateForItemsForCouponRaw(String couponId, UpdateForItemsForCouponParams params) - throws Exception { + Response updateForItemsRaw(String couponId, CouponUpdateForItemsParams params) + throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}/update_for_items", "coupon-id", couponId); return post(path, params.toFormData()); } /** - * updateForItemsForCoupon a coupon using raw JSON payload (executes immediately) - returns raw - * Response. + * updateForItems a coupon using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateForItemsForCouponRaw(String couponId, String jsonPayload) throws Exception { + Response updateForItemsRaw(String couponId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}/update_for_items", "coupon-id", couponId); return postJson(path, jsonPayload); } - public UpdateForItemsForCouponResponse updateForItemsForCoupon( - String couponId, UpdateForItemsForCouponParams params) throws Exception { - Response response = updateForItemsForCouponRaw(couponId, params); - return UpdateForItemsForCouponResponse.fromJson(response.getBodyAsString(), response); + public CouponUpdateForItemsResponse updateForItems( + String couponId, CouponUpdateForItemsParams params) throws ChargebeeException { + Response response = updateForItemsRaw(couponId, params); + return CouponUpdateForItemsResponse.fromJson(response.getBodyAsString(), response); } - /** unarchiveForCoupon a coupon (executes immediately) - returns raw Response. */ - Response unarchiveForCouponRaw(String couponId) throws Exception { + /** unarchive a coupon (executes immediately) - returns raw Response. */ + Response unarchiveRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}/unarchive", "coupon-id", couponId); return post(path, null); } - public UnarchiveForCouponResponse unarchiveForCoupon(String couponId) throws Exception { - Response response = unarchiveForCouponRaw(couponId); - return UnarchiveForCouponResponse.fromJson(response.getBodyAsString(), response); + public CouponUnarchiveResponse unarchive(String couponId) throws ChargebeeException { + Response response = unarchiveRaw(couponId); + return CouponUnarchiveResponse.fromJson(response.getBodyAsString(), response); } - /** deleteCoupon a coupon (executes immediately) - returns raw Response. */ - Response deleteCouponRaw(String couponId) throws Exception { + /** delete a coupon (executes immediately) - returns raw Response. */ + Response deleteRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}/delete", "coupon-id", couponId); return post(path, null); } - public DeleteCouponResponse deleteCoupon(String couponId) throws Exception { - Response response = deleteCouponRaw(couponId); - return DeleteCouponResponse.fromJson(response.getBodyAsString(), response); + public CouponDeleteResponse delete(String couponId) throws ChargebeeException { + Response response = deleteRaw(couponId); + return CouponDeleteResponse.fromJson(response.getBodyAsString(), response); } /** copy a coupon using immutable params (executes immediately) - returns raw Response. */ - Response copyRaw(CouponCopyParams params) throws Exception { + Response copyRaw(CouponCopyParams params) throws ChargebeeException { return post("/coupons/copy", params != null ? params.toFormData() : null); } /** copy a coupon using raw JSON payload (executes immediately) - returns raw Response. */ - Response copyRaw(String jsonPayload) throws Exception { + Response copyRaw(String jsonPayload) throws ChargebeeException { return postJson("/coupons/copy", jsonPayload); } - public CouponCopyResponse copy(CouponCopyParams params) throws Exception { + public CouponCopyResponse copy(CouponCopyParams params) throws ChargebeeException { Response response = copyRaw(params); return CouponCopyResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a coupon (executes immediately) - returns raw Response. */ - Response retrieveRaw(String couponId) throws Exception { + Response retrieveRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); return get(path, null); } - public CouponRetrieveResponse retrieve(String couponId) throws Exception { + public CouponRetrieveResponse retrieve(String couponId) throws ChargebeeException { Response response = retrieveRaw(couponId); return CouponRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a coupon (executes immediately) - returns raw Response. */ - Response updateRaw(String couponId) throws Exception { + Response updateRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); return post(path, null); } /** update a coupon using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String couponId, CouponUpdateParams params) throws Exception { + Response updateRaw(String couponId, CouponUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); return post(path, params.toFormData()); } /** update a coupon using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String couponId, String jsonPayload) throws Exception { + Response updateRaw(String couponId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); return postJson(path, jsonPayload); } - public CouponUpdateResponse update(String couponId, CouponUpdateParams params) throws Exception { + public CouponUpdateResponse update(String couponId, CouponUpdateParams params) + throws ChargebeeException { Response response = updateRaw(couponId, params); return CouponUpdateResponse.fromJson(response.getBodyAsString(), response); } @@ -238,7 +238,7 @@ public CouponUpdateResponse update(String couponId, CouponUpdateParams params) t /** * createForItems a coupon using immutable params (executes immediately) - returns raw Response. */ - Response createForItemsRaw(CouponCreateForItemsParams params) throws Exception { + Response createForItemsRaw(CouponCreateForItemsParams params) throws ChargebeeException { return post("/coupons/create_for_items", params != null ? params.toFormData() : null); } @@ -246,13 +246,13 @@ Response createForItemsRaw(CouponCreateForItemsParams params) throws Exception { /** * createForItems a coupon using raw JSON payload (executes immediately) - returns raw Response. */ - Response createForItemsRaw(String jsonPayload) throws Exception { + Response createForItemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/coupons/create_for_items", jsonPayload); } public CouponCreateForItemsResponse createForItems(CouponCreateForItemsParams params) - throws Exception { + throws ChargebeeException { Response response = createForItemsRaw(params); return CouponCreateForItemsResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/CouponSetService.java b/src/main/java/com/chargebee/v4/services/CouponSetService.java index 9d3189c1..1fc65517 100644 --- a/src/main/java/com/chargebee/v4/services/CouponSetService.java +++ b/src/main/java/com/chargebee/v4/services/CouponSetService.java @@ -9,29 +9,30 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.couponSet.params.CouponSetListParams; import com.chargebee.v4.models.couponSet.params.CouponSetCreateParams; -import com.chargebee.v4.models.couponSet.params.UpdateCouponSetParams; +import com.chargebee.v4.models.couponSet.params.CouponSetUpdateParams; -import com.chargebee.v4.models.couponSet.params.AddCouponCodesForCouponSetParams; +import com.chargebee.v4.models.couponSet.params.CouponSetAddCouponCodesParams; import com.chargebee.v4.models.couponSet.responses.CouponSetListResponse; import com.chargebee.v4.models.couponSet.responses.CouponSetCreateResponse; -import com.chargebee.v4.models.couponSet.responses.UpdateCouponSetResponse; +import com.chargebee.v4.models.couponSet.responses.CouponSetUpdateResponse; import com.chargebee.v4.models.couponSet.responses.CouponSetRetrieveResponse; -import com.chargebee.v4.models.couponSet.responses.AddCouponCodesForCouponSetResponse; +import com.chargebee.v4.models.couponSet.responses.CouponSetAddCouponCodesResponse; -import com.chargebee.v4.models.couponSet.responses.DeleteUnusedCouponCodesForCouponSetResponse; +import com.chargebee.v4.models.couponSet.responses.CouponSetDeleteUnusedCouponCodesResponse; -import com.chargebee.v4.models.couponSet.responses.DeleteCouponSetResponse; +import com.chargebee.v4.models.couponSet.responses.CouponSetDeleteResponse; public final class CouponSetService extends BaseService { @@ -68,100 +69,94 @@ public CouponSetService withOptions(RequestOptions options) { // === Operations === /** list a couponSet using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(CouponSetListParams params) throws Exception { + Response listRaw(CouponSetListParams params) throws ChargebeeException { return get("/coupon_sets", params != null ? params.toQueryParams() : null); } /** list a couponSet without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/coupon_sets", null); } /** list a couponSet using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public CouponSetListResponse list(CouponSetListParams params) throws Exception { + public CouponSetListResponse list(CouponSetListParams params) throws ChargebeeException { Response response = listRaw(params); return CouponSetListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public CouponSetListResponse list() throws Exception { + public CouponSetListResponse list() throws ChargebeeException { Response response = listRaw(); return CouponSetListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a couponSet using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(CouponSetCreateParams params) throws Exception { + Response createRaw(CouponSetCreateParams params) throws ChargebeeException { return post("/coupon_sets", params != null ? params.toFormData() : null); } /** create a couponSet using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/coupon_sets", jsonPayload); } - public CouponSetCreateResponse create(CouponSetCreateParams params) throws Exception { + public CouponSetCreateResponse create(CouponSetCreateParams params) throws ChargebeeException { Response response = createRaw(params); return CouponSetCreateResponse.fromJson(response.getBodyAsString(), response); } - /** updateCouponSet a couponSet (executes immediately) - returns raw Response. */ - Response updateCouponSetRaw(String couponSetId) throws Exception { + /** update a couponSet (executes immediately) - returns raw Response. */ + Response updateRaw(String couponSetId) throws ChargebeeException { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}/update", "coupon-set-id", couponSetId); return post(path, null); } - /** - * updateCouponSet a couponSet using immutable params (executes immediately) - returns raw - * Response. - */ - Response updateCouponSetRaw(String couponSetId, UpdateCouponSetParams params) throws Exception { + /** update a couponSet using immutable params (executes immediately) - returns raw Response. */ + Response updateRaw(String couponSetId, CouponSetUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}/update", "coupon-set-id", couponSetId); return post(path, params.toFormData()); } - /** - * updateCouponSet a couponSet using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response updateCouponSetRaw(String couponSetId, String jsonPayload) throws Exception { + /** update a couponSet using raw JSON payload (executes immediately) - returns raw Response. */ + Response updateRaw(String couponSetId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}/update", "coupon-set-id", couponSetId); return postJson(path, jsonPayload); } - public UpdateCouponSetResponse updateCouponSet(String couponSetId, UpdateCouponSetParams params) - throws Exception { - Response response = updateCouponSetRaw(couponSetId, params); - return UpdateCouponSetResponse.fromJson(response.getBodyAsString(), response); + public CouponSetUpdateResponse update(String couponSetId, CouponSetUpdateParams params) + throws ChargebeeException { + Response response = updateRaw(couponSetId, params); + return CouponSetUpdateResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a couponSet (executes immediately) - returns raw Response. */ - Response retrieveRaw(String couponSetId) throws Exception { + Response retrieveRaw(String couponSetId) throws ChargebeeException { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}", "coupon-set-id", couponSetId); return get(path, null); } - public CouponSetRetrieveResponse retrieve(String couponSetId) throws Exception { + public CouponSetRetrieveResponse retrieve(String couponSetId) throws ChargebeeException { Response response = retrieveRaw(couponSetId); return CouponSetRetrieveResponse.fromJson(response.getBodyAsString(), response); } - /** addCouponCodesForCouponSet a couponSet (executes immediately) - returns raw Response. */ - Response addCouponCodesForCouponSetRaw(String couponSetId) throws Exception { + /** addCouponCodes a couponSet (executes immediately) - returns raw Response. */ + Response addCouponCodesRaw(String couponSetId) throws ChargebeeException { String path = buildPathWithParams( "/coupon_sets/{coupon-set-id}/add_coupon_codes", "coupon-set-id", couponSetId); @@ -170,11 +165,11 @@ Response addCouponCodesForCouponSetRaw(String couponSetId) throws Exception { } /** - * addCouponCodesForCouponSet a couponSet using immutable params (executes immediately) - returns - * raw Response. + * addCouponCodes a couponSet using immutable params (executes immediately) - returns raw + * Response. */ - Response addCouponCodesForCouponSetRaw( - String couponSetId, AddCouponCodesForCouponSetParams params) throws Exception { + Response addCouponCodesRaw(String couponSetId, CouponSetAddCouponCodesParams params) + throws ChargebeeException { String path = buildPathWithParams( "/coupon_sets/{coupon-set-id}/add_coupon_codes", "coupon-set-id", couponSetId); @@ -182,26 +177,24 @@ Response addCouponCodesForCouponSetRaw( } /** - * addCouponCodesForCouponSet a couponSet using raw JSON payload (executes immediately) - returns - * raw Response. + * addCouponCodes a couponSet using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response addCouponCodesForCouponSetRaw(String couponSetId, String jsonPayload) throws Exception { + Response addCouponCodesRaw(String couponSetId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/coupon_sets/{coupon-set-id}/add_coupon_codes", "coupon-set-id", couponSetId); return postJson(path, jsonPayload); } - public AddCouponCodesForCouponSetResponse addCouponCodesForCouponSet( - String couponSetId, AddCouponCodesForCouponSetParams params) throws Exception { - Response response = addCouponCodesForCouponSetRaw(couponSetId, params); - return AddCouponCodesForCouponSetResponse.fromJson(response.getBodyAsString(), response); + public CouponSetAddCouponCodesResponse addCouponCodes( + String couponSetId, CouponSetAddCouponCodesParams params) throws ChargebeeException { + Response response = addCouponCodesRaw(couponSetId, params); + return CouponSetAddCouponCodesResponse.fromJson(response.getBodyAsString(), response); } - /** - * deleteUnusedCouponCodesForCouponSet a couponSet (executes immediately) - returns raw Response. - */ - Response deleteUnusedCouponCodesForCouponSetRaw(String couponSetId) throws Exception { + /** deleteUnusedCouponCodes a couponSet (executes immediately) - returns raw Response. */ + Response deleteUnusedCouponCodesRaw(String couponSetId) throws ChargebeeException { String path = buildPathWithParams( "/coupon_sets/{coupon-set-id}/delete_unused_coupon_codes", @@ -211,23 +204,22 @@ Response deleteUnusedCouponCodesForCouponSetRaw(String couponSetId) throws Excep return post(path, null); } - public DeleteUnusedCouponCodesForCouponSetResponse deleteUnusedCouponCodesForCouponSet( - String couponSetId) throws Exception { - Response response = deleteUnusedCouponCodesForCouponSetRaw(couponSetId); - return DeleteUnusedCouponCodesForCouponSetResponse.fromJson( - response.getBodyAsString(), response); + public CouponSetDeleteUnusedCouponCodesResponse deleteUnusedCouponCodes(String couponSetId) + throws ChargebeeException { + Response response = deleteUnusedCouponCodesRaw(couponSetId); + return CouponSetDeleteUnusedCouponCodesResponse.fromJson(response.getBodyAsString(), response); } - /** deleteCouponSet a couponSet (executes immediately) - returns raw Response. */ - Response deleteCouponSetRaw(String couponSetId) throws Exception { + /** delete a couponSet (executes immediately) - returns raw Response. */ + Response deleteRaw(String couponSetId) throws ChargebeeException { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}/delete", "coupon-set-id", couponSetId); return post(path, null); } - public DeleteCouponSetResponse deleteCouponSet(String couponSetId) throws Exception { - Response response = deleteCouponSetRaw(couponSetId); - return DeleteCouponSetResponse.fromJson(response.getBodyAsString(), response); + public CouponSetDeleteResponse delete(String couponSetId) throws ChargebeeException { + Response response = deleteRaw(couponSetId); + return CouponSetDeleteResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/CreditNoteService.java b/src/main/java/com/chargebee/v4/services/CreditNoteService.java index 1270a577..d05572c0 100644 --- a/src/main/java/com/chargebee/v4/services/CreditNoteService.java +++ b/src/main/java/com/chargebee/v4/services/CreditNoteService.java @@ -9,53 +9,56 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.creditNote.params.RecordRefundForCreditNoteParams; +import com.chargebee.v4.models.creditNote.params.CreditNoteRecordRefundParams; import com.chargebee.v4.models.creditNote.params.ImportCreditNoteParams; -import com.chargebee.v4.models.creditNote.params.DeleteCreditNoteParams; +import com.chargebee.v4.models.creditNote.params.CreditNoteDeleteParams; import com.chargebee.v4.models.creditNote.params.CreditNotesForCustomerParams; -import com.chargebee.v4.models.creditNote.params.PdfForCreditNoteParams; +import com.chargebee.v4.models.creditNote.params.CreditNotePdfParams; import com.chargebee.v4.models.creditNote.params.VoidCreditNoteParams; -import com.chargebee.v4.models.creditNote.params.RefundForCreditNoteParams; +import com.chargebee.v4.models.creditNote.params.CreditNoteRefundParams; import com.chargebee.v4.models.creditNote.params.CreditNoteListParams; import com.chargebee.v4.models.creditNote.params.CreditNoteCreateParams; -import com.chargebee.v4.models.creditNote.params.RemoveTaxWithheldRefundForCreditNoteParams; +import com.chargebee.v4.models.creditNote.params.CreditNoteRemoveTaxWithheldRefundParams; -import com.chargebee.v4.models.creditNote.responses.RecordRefundForCreditNoteResponse; +import com.chargebee.v4.models.creditNote.params.CreditNoteRetrieveParams; + +import com.chargebee.v4.models.creditNote.responses.CreditNoteRecordRefundResponse; import com.chargebee.v4.models.creditNote.responses.ImportCreditNoteResponse; -import com.chargebee.v4.models.creditNote.responses.DeleteCreditNoteResponse; +import com.chargebee.v4.models.creditNote.responses.CreditNoteDeleteResponse; import com.chargebee.v4.models.creditNote.responses.CreditNotesForCustomerResponse; -import com.chargebee.v4.models.creditNote.responses.PdfForCreditNoteResponse; +import com.chargebee.v4.models.creditNote.responses.CreditNotePdfResponse; -import com.chargebee.v4.models.creditNote.responses.SendEinvoiceForCreditNoteResponse; +import com.chargebee.v4.models.creditNote.responses.CreditNoteSendEinvoiceResponse; import com.chargebee.v4.models.creditNote.responses.VoidCreditNoteResponse; -import com.chargebee.v4.models.creditNote.responses.RefundForCreditNoteResponse; +import com.chargebee.v4.models.creditNote.responses.CreditNoteRefundResponse; import com.chargebee.v4.models.creditNote.responses.CreditNoteListResponse; import com.chargebee.v4.models.creditNote.responses.CreditNoteCreateResponse; -import com.chargebee.v4.models.creditNote.responses.DownloadEinvoiceForCreditNoteResponse; +import com.chargebee.v4.models.creditNote.responses.CreditNoteDownloadEinvoiceResponse; -import com.chargebee.v4.models.creditNote.responses.ResendEinvoiceForCreditNoteResponse; +import com.chargebee.v4.models.creditNote.responses.CreditNoteResendEinvoiceResponse; -import com.chargebee.v4.models.creditNote.responses.RemoveTaxWithheldRefundForCreditNoteResponse; +import com.chargebee.v4.models.creditNote.responses.CreditNoteRemoveTaxWithheldRefundResponse; import com.chargebee.v4.models.creditNote.responses.CreditNoteRetrieveResponse; @@ -93,8 +96,8 @@ public CreditNoteService withOptions(RequestOptions options) { // === Operations === - /** recordRefundForCreditNote a creditNote (executes immediately) - returns raw Response. */ - Response recordRefundForCreditNoteRaw(String creditNoteId) throws Exception { + /** recordRefund a creditNote (executes immediately) - returns raw Response. */ + Response recordRefundRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/record_refund", "credit-note-id", creditNoteId); @@ -103,11 +106,10 @@ Response recordRefundForCreditNoteRaw(String creditNoteId) throws Exception { } /** - * recordRefundForCreditNote a creditNote using immutable params (executes immediately) - returns - * raw Response. + * recordRefund a creditNote using immutable params (executes immediately) - returns raw Response. */ - Response recordRefundForCreditNoteRaw(String creditNoteId, RecordRefundForCreditNoteParams params) - throws Exception { + Response recordRefundRaw(String creditNoteId, CreditNoteRecordRefundParams params) + throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/record_refund", "credit-note-id", creditNoteId); @@ -115,27 +117,26 @@ Response recordRefundForCreditNoteRaw(String creditNoteId, RecordRefundForCredit } /** - * recordRefundForCreditNote a creditNote using raw JSON payload (executes immediately) - returns - * raw Response. + * recordRefund a creditNote using raw JSON payload (executes immediately) - returns raw Response. */ - Response recordRefundForCreditNoteRaw(String creditNoteId, String jsonPayload) throws Exception { + Response recordRefundRaw(String creditNoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/record_refund", "credit-note-id", creditNoteId); return postJson(path, jsonPayload); } - public RecordRefundForCreditNoteResponse recordRefundForCreditNote( - String creditNoteId, RecordRefundForCreditNoteParams params) throws Exception { - Response response = recordRefundForCreditNoteRaw(creditNoteId, params); - return RecordRefundForCreditNoteResponse.fromJson(response.getBodyAsString(), response); + public CreditNoteRecordRefundResponse recordRefund( + String creditNoteId, CreditNoteRecordRefundParams params) throws ChargebeeException { + Response response = recordRefundRaw(creditNoteId, params); + return CreditNoteRecordRefundResponse.fromJson(response.getBodyAsString(), response); } /** * importCreditNote a creditNote using immutable params (executes immediately) - returns raw * Response. */ - Response importCreditNoteRaw(ImportCreditNoteParams params) throws Exception { + Response importCreditNoteRaw(ImportCreditNoteParams params) throws ChargebeeException { return post("/credit_notes/import_credit_note", params != null ? params.toFormData() : null); } @@ -144,19 +145,20 @@ Response importCreditNoteRaw(ImportCreditNoteParams params) throws Exception { * importCreditNote a creditNote using raw JSON payload (executes immediately) - returns raw * Response. */ - Response importCreditNoteRaw(String jsonPayload) throws Exception { + Response importCreditNoteRaw(String jsonPayload) throws ChargebeeException { return postJson("/credit_notes/import_credit_note", jsonPayload); } - public ImportCreditNoteResponse importCreditNote(ImportCreditNoteParams params) throws Exception { + public ImportCreditNoteResponse importCreditNote(ImportCreditNoteParams params) + throws ChargebeeException { Response response = importCreditNoteRaw(params); return ImportCreditNoteResponse.fromJson(response.getBodyAsString(), response); } - /** deleteCreditNote a creditNote (executes immediately) - returns raw Response. */ - Response deleteCreditNoteRaw(String creditNoteId) throws Exception { + /** delete a creditNote (executes immediately) - returns raw Response. */ + Response deleteRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/delete", "credit-note-id", creditNoteId); @@ -164,33 +166,26 @@ Response deleteCreditNoteRaw(String creditNoteId) throws Exception { return post(path, null); } - /** - * deleteCreditNote a creditNote using immutable params (executes immediately) - returns raw - * Response. - */ - Response deleteCreditNoteRaw(String creditNoteId, DeleteCreditNoteParams params) - throws Exception { + /** delete a creditNote using immutable params (executes immediately) - returns raw Response. */ + Response deleteRaw(String creditNoteId, CreditNoteDeleteParams params) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/delete", "credit-note-id", creditNoteId); return post(path, params.toFormData()); } - /** - * deleteCreditNote a creditNote using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response deleteCreditNoteRaw(String creditNoteId, String jsonPayload) throws Exception { + /** delete a creditNote using raw JSON payload (executes immediately) - returns raw Response. */ + Response deleteRaw(String creditNoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/delete", "credit-note-id", creditNoteId); return postJson(path, jsonPayload); } - public DeleteCreditNoteResponse deleteCreditNote( - String creditNoteId, DeleteCreditNoteParams params) throws Exception { - Response response = deleteCreditNoteRaw(creditNoteId, params); - return DeleteCreditNoteResponse.fromJson(response.getBodyAsString(), response); + public CreditNoteDeleteResponse delete(String creditNoteId, CreditNoteDeleteParams params) + throws ChargebeeException { + Response response = deleteRaw(creditNoteId, params); + return CreditNoteDeleteResponse.fromJson(response.getBodyAsString(), response); } /** @@ -198,7 +193,7 @@ public DeleteCreditNoteResponse deleteCreditNote( * Response. */ Response creditNotesForCustomerRaw(String customerId, CreditNotesForCustomerParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/credit_notes", "customer-id", customerId); return get(path, params != null ? params.toQueryParams() : null); @@ -208,7 +203,7 @@ Response creditNotesForCustomerRaw(String customerId, CreditNotesForCustomerPara * creditNotesForCustomer a creditNote without params (executes immediately) - returns raw * Response. */ - Response creditNotesForCustomerRaw(String customerId) throws Exception { + Response creditNotesForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/credit_notes", "customer-id", customerId); return get(path, null); @@ -218,62 +213,57 @@ Response creditNotesForCustomerRaw(String customerId) throws Exception { * creditNotesForCustomer a creditNote using raw JSON payload (executes immediately) - returns raw * Response. */ - Response creditNotesForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response creditNotesForCustomerRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/credit_notes", "customer-id", customerId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public CreditNotesForCustomerResponse creditNotesForCustomer( - String customerId, CreditNotesForCustomerParams params) throws Exception { + String customerId, CreditNotesForCustomerParams params) throws ChargebeeException { Response response = creditNotesForCustomerRaw(customerId, params); return CreditNotesForCustomerResponse.fromJson( response.getBodyAsString(), this, params, customerId, response); } - public CreditNotesForCustomerResponse creditNotesForCustomer(String customerId) throws Exception { + public CreditNotesForCustomerResponse creditNotesForCustomer(String customerId) + throws ChargebeeException { Response response = creditNotesForCustomerRaw(customerId); return CreditNotesForCustomerResponse.fromJson( response.getBodyAsString(), this, null, customerId, response); } - /** pdfForCreditNote a creditNote (executes immediately) - returns raw Response. */ - Response pdfForCreditNoteRaw(String creditNoteId) throws Exception { + /** pdf a creditNote (executes immediately) - returns raw Response. */ + Response pdfRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams("/credit_notes/{credit-note-id}/pdf", "credit-note-id", creditNoteId); return post(path, null); } - /** - * pdfForCreditNote a creditNote using immutable params (executes immediately) - returns raw - * Response. - */ - Response pdfForCreditNoteRaw(String creditNoteId, PdfForCreditNoteParams params) - throws Exception { + /** pdf a creditNote using immutable params (executes immediately) - returns raw Response. */ + Response pdfRaw(String creditNoteId, CreditNotePdfParams params) throws ChargebeeException { String path = buildPathWithParams("/credit_notes/{credit-note-id}/pdf", "credit-note-id", creditNoteId); return post(path, params.toFormData()); } - /** - * pdfForCreditNote a creditNote using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response pdfForCreditNoteRaw(String creditNoteId, String jsonPayload) throws Exception { + /** pdf a creditNote using raw JSON payload (executes immediately) - returns raw Response. */ + Response pdfRaw(String creditNoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/credit_notes/{credit-note-id}/pdf", "credit-note-id", creditNoteId); return postJson(path, jsonPayload); } - public PdfForCreditNoteResponse pdfForCreditNote( - String creditNoteId, PdfForCreditNoteParams params) throws Exception { - Response response = pdfForCreditNoteRaw(creditNoteId, params); - return PdfForCreditNoteResponse.fromJson(response.getBodyAsString(), response); + public CreditNotePdfResponse pdf(String creditNoteId, CreditNotePdfParams params) + throws ChargebeeException { + Response response = pdfRaw(creditNoteId, params); + return CreditNotePdfResponse.fromJson(response.getBodyAsString(), response); } - /** sendEinvoiceForCreditNote a creditNote (executes immediately) - returns raw Response. */ - Response sendEinvoiceForCreditNoteRaw(String creditNoteId) throws Exception { + /** sendEinvoice a creditNote (executes immediately) - returns raw Response. */ + Response sendEinvoiceRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/send_einvoice", "credit-note-id", creditNoteId); @@ -281,14 +271,14 @@ Response sendEinvoiceForCreditNoteRaw(String creditNoteId) throws Exception { return post(path, null); } - public SendEinvoiceForCreditNoteResponse sendEinvoiceForCreditNote(String creditNoteId) - throws Exception { - Response response = sendEinvoiceForCreditNoteRaw(creditNoteId); - return SendEinvoiceForCreditNoteResponse.fromJson(response.getBodyAsString(), response); + public CreditNoteSendEinvoiceResponse sendEinvoice(String creditNoteId) + throws ChargebeeException { + Response response = sendEinvoiceRaw(creditNoteId); + return CreditNoteSendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } /** voidCreditNote a creditNote (executes immediately) - returns raw Response. */ - Response voidCreditNoteRaw(String creditNoteId) throws Exception { + Response voidCreditNoteRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams("/credit_notes/{credit-note-id}/void", "credit-note-id", creditNoteId); @@ -299,7 +289,8 @@ Response voidCreditNoteRaw(String creditNoteId) throws Exception { * voidCreditNote a creditNote using immutable params (executes immediately) - returns raw * Response. */ - Response voidCreditNoteRaw(String creditNoteId, VoidCreditNoteParams params) throws Exception { + Response voidCreditNoteRaw(String creditNoteId, VoidCreditNoteParams params) + throws ChargebeeException { String path = buildPathWithParams("/credit_notes/{credit-note-id}/void", "credit-note-id", creditNoteId); return post(path, params.toFormData()); @@ -309,20 +300,20 @@ Response voidCreditNoteRaw(String creditNoteId, VoidCreditNoteParams params) thr * voidCreditNote a creditNote using raw JSON payload (executes immediately) - returns raw * Response. */ - Response voidCreditNoteRaw(String creditNoteId, String jsonPayload) throws Exception { + Response voidCreditNoteRaw(String creditNoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/credit_notes/{credit-note-id}/void", "credit-note-id", creditNoteId); return postJson(path, jsonPayload); } public VoidCreditNoteResponse voidCreditNote(String creditNoteId, VoidCreditNoteParams params) - throws Exception { + throws ChargebeeException { Response response = voidCreditNoteRaw(creditNoteId, params); return VoidCreditNoteResponse.fromJson(response.getBodyAsString(), response); } - /** refundForCreditNote a creditNote (executes immediately) - returns raw Response. */ - Response refundForCreditNoteRaw(String creditNoteId) throws Exception { + /** refund a creditNote (executes immediately) - returns raw Response. */ + Response refundRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/refund", "credit-note-id", creditNoteId); @@ -330,84 +321,77 @@ Response refundForCreditNoteRaw(String creditNoteId) throws Exception { return post(path, null); } - /** - * refundForCreditNote a creditNote using immutable params (executes immediately) - returns raw - * Response. - */ - Response refundForCreditNoteRaw(String creditNoteId, RefundForCreditNoteParams params) - throws Exception { + /** refund a creditNote using immutable params (executes immediately) - returns raw Response. */ + Response refundRaw(String creditNoteId, CreditNoteRefundParams params) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/refund", "credit-note-id", creditNoteId); return post(path, params.toFormData()); } - /** - * refundForCreditNote a creditNote using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response refundForCreditNoteRaw(String creditNoteId, String jsonPayload) throws Exception { + /** refund a creditNote using raw JSON payload (executes immediately) - returns raw Response. */ + Response refundRaw(String creditNoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/refund", "credit-note-id", creditNoteId); return postJson(path, jsonPayload); } - public RefundForCreditNoteResponse refundForCreditNote( - String creditNoteId, RefundForCreditNoteParams params) throws Exception { - Response response = refundForCreditNoteRaw(creditNoteId, params); - return RefundForCreditNoteResponse.fromJson(response.getBodyAsString(), response); + public CreditNoteRefundResponse refund(String creditNoteId, CreditNoteRefundParams params) + throws ChargebeeException { + Response response = refundRaw(creditNoteId, params); + return CreditNoteRefundResponse.fromJson(response.getBodyAsString(), response); } /** list a creditNote using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(CreditNoteListParams params) throws Exception { + Response listRaw(CreditNoteListParams params) throws ChargebeeException { return get("/credit_notes", params != null ? params.toQueryParams() : null); } /** list a creditNote without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/credit_notes", null); } /** list a creditNote using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public CreditNoteListResponse list(CreditNoteListParams params) throws Exception { + public CreditNoteListResponse list(CreditNoteListParams params) throws ChargebeeException { Response response = listRaw(params); return CreditNoteListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public CreditNoteListResponse list() throws Exception { + public CreditNoteListResponse list() throws ChargebeeException { Response response = listRaw(); return CreditNoteListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a creditNote using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(CreditNoteCreateParams params) throws Exception { + Response createRaw(CreditNoteCreateParams params) throws ChargebeeException { return post("/credit_notes", params != null ? params.toFormData() : null); } /** create a creditNote using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/credit_notes", jsonPayload); } - public CreditNoteCreateResponse create(CreditNoteCreateParams params) throws Exception { + public CreditNoteCreateResponse create(CreditNoteCreateParams params) throws ChargebeeException { Response response = createRaw(params); return CreditNoteCreateResponse.fromJson(response.getBodyAsString(), response); } - /** downloadEinvoiceForCreditNote a creditNote (executes immediately) - returns raw Response. */ - Response downloadEinvoiceForCreditNoteRaw(String creditNoteId) throws Exception { + /** downloadEinvoice a creditNote (executes immediately) - returns raw Response. */ + Response downloadEinvoiceRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/download_einvoice", "credit-note-id", creditNoteId); @@ -415,14 +399,14 @@ Response downloadEinvoiceForCreditNoteRaw(String creditNoteId) throws Exception return get(path, null); } - public DownloadEinvoiceForCreditNoteResponse downloadEinvoiceForCreditNote(String creditNoteId) - throws Exception { - Response response = downloadEinvoiceForCreditNoteRaw(creditNoteId); - return DownloadEinvoiceForCreditNoteResponse.fromJson(response.getBodyAsString(), response); + public CreditNoteDownloadEinvoiceResponse downloadEinvoice(String creditNoteId) + throws ChargebeeException { + Response response = downloadEinvoiceRaw(creditNoteId); + return CreditNoteDownloadEinvoiceResponse.fromJson(response.getBodyAsString(), response); } - /** resendEinvoiceForCreditNote a creditNote (executes immediately) - returns raw Response. */ - Response resendEinvoiceForCreditNoteRaw(String creditNoteId) throws Exception { + /** resendEinvoice a creditNote (executes immediately) - returns raw Response. */ + Response resendEinvoiceRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/resend_einvoice", "credit-note-id", creditNoteId); @@ -430,17 +414,14 @@ Response resendEinvoiceForCreditNoteRaw(String creditNoteId) throws Exception { return post(path, null); } - public ResendEinvoiceForCreditNoteResponse resendEinvoiceForCreditNote(String creditNoteId) - throws Exception { - Response response = resendEinvoiceForCreditNoteRaw(creditNoteId); - return ResendEinvoiceForCreditNoteResponse.fromJson(response.getBodyAsString(), response); + public CreditNoteResendEinvoiceResponse resendEinvoice(String creditNoteId) + throws ChargebeeException { + Response response = resendEinvoiceRaw(creditNoteId); + return CreditNoteResendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } - /** - * removeTaxWithheldRefundForCreditNote a creditNote (executes immediately) - returns raw - * Response. - */ - Response removeTaxWithheldRefundForCreditNoteRaw(String creditNoteId) throws Exception { + /** removeTaxWithheldRefund a creditNote (executes immediately) - returns raw Response. */ + Response removeTaxWithheldRefundRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/remove_tax_withheld_refund", @@ -451,11 +432,12 @@ Response removeTaxWithheldRefundForCreditNoteRaw(String creditNoteId) throws Exc } /** - * removeTaxWithheldRefundForCreditNote a creditNote using immutable params (executes immediately) - * - returns raw Response. + * removeTaxWithheldRefund a creditNote using immutable params (executes immediately) - returns + * raw Response. */ - Response removeTaxWithheldRefundForCreditNoteRaw( - String creditNoteId, RemoveTaxWithheldRefundForCreditNoteParams params) throws Exception { + Response removeTaxWithheldRefundRaw( + String creditNoteId, CreditNoteRemoveTaxWithheldRefundParams params) + throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/remove_tax_withheld_refund", @@ -465,11 +447,11 @@ Response removeTaxWithheldRefundForCreditNoteRaw( } /** - * removeTaxWithheldRefundForCreditNote a creditNote using raw JSON payload (executes immediately) - * - returns raw Response. + * removeTaxWithheldRefund a creditNote using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response removeTaxWithheldRefundForCreditNoteRaw(String creditNoteId, String jsonPayload) - throws Exception { + Response removeTaxWithheldRefundRaw(String creditNoteId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/credit_notes/{credit-note-id}/remove_tax_withheld_refund", @@ -478,22 +460,36 @@ Response removeTaxWithheldRefundForCreditNoteRaw(String creditNoteId, String jso return postJson(path, jsonPayload); } - public RemoveTaxWithheldRefundForCreditNoteResponse removeTaxWithheldRefundForCreditNote( - String creditNoteId, RemoveTaxWithheldRefundForCreditNoteParams params) throws Exception { - Response response = removeTaxWithheldRefundForCreditNoteRaw(creditNoteId, params); - return RemoveTaxWithheldRefundForCreditNoteResponse.fromJson( - response.getBodyAsString(), response); + public CreditNoteRemoveTaxWithheldRefundResponse removeTaxWithheldRefund( + String creditNoteId, CreditNoteRemoveTaxWithheldRefundParams params) + throws ChargebeeException { + Response response = removeTaxWithheldRefundRaw(creditNoteId, params); + return CreditNoteRemoveTaxWithheldRefundResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a creditNote (executes immediately) - returns raw Response. */ - Response retrieveRaw(String creditNoteId) throws Exception { + Response retrieveRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams("/credit_notes/{credit-note-id}", "credit-note-id", creditNoteId); return get(path, null); } - public CreditNoteRetrieveResponse retrieve(String creditNoteId) throws Exception { + /** retrieve a creditNote using immutable params (executes immediately) - returns raw Response. */ + Response retrieveRaw(String creditNoteId, CreditNoteRetrieveParams params) + throws ChargebeeException { + String path = + buildPathWithParams("/credit_notes/{credit-note-id}", "credit-note-id", creditNoteId); + return get(path, params != null ? params.toQueryParams() : null); + } + + public CreditNoteRetrieveResponse retrieve(String creditNoteId, CreditNoteRetrieveParams params) + throws ChargebeeException { + Response response = retrieveRaw(creditNoteId, params); + return CreditNoteRetrieveResponse.fromJson(response.getBodyAsString(), response); + } + + public CreditNoteRetrieveResponse retrieve(String creditNoteId) throws ChargebeeException { Response response = retrieveRaw(creditNoteId); return CreditNoteRetrieveResponse.fromJson(response.getBodyAsString(), response); } diff --git a/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java b/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java index 5da11d35..0dd52a44 100644 --- a/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java +++ b/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.csvTaxRule.params.CsvTaxRuleCreateParams; @@ -50,18 +51,18 @@ public CsvTaxRuleService withOptions(RequestOptions options) { // === Operations === /** create a csvTaxRule using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(CsvTaxRuleCreateParams params) throws Exception { + Response createRaw(CsvTaxRuleCreateParams params) throws ChargebeeException { return post("/csv_tax_rules", params != null ? params.toFormData() : null); } /** create a csvTaxRule using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/csv_tax_rules", jsonPayload); } - public CsvTaxRuleCreateResponse create(CsvTaxRuleCreateParams params) throws Exception { + public CsvTaxRuleCreateResponse create(CsvTaxRuleCreateParams params) throws ChargebeeException { Response response = createRaw(params); return CsvTaxRuleCreateResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/CurrencyService.java b/src/main/java/com/chargebee/v4/services/CurrencyService.java index d714c94c..f6f010d3 100644 --- a/src/main/java/com/chargebee/v4/services/CurrencyService.java +++ b/src/main/java/com/chargebee/v4/services/CurrencyService.java @@ -9,17 +9,18 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.currency.params.AddScheduleForCurrencyParams; +import com.chargebee.v4.models.currency.params.CurrencyAddScheduleParams; import com.chargebee.v4.models.currency.params.CurrencyCreateParams; import com.chargebee.v4.models.currency.params.CurrencyUpdateParams; -import com.chargebee.v4.models.currency.params.CurrencyListListParams; +import com.chargebee.v4.models.currency.params.CurrencyListParams; -import com.chargebee.v4.models.currency.responses.AddScheduleForCurrencyResponse; +import com.chargebee.v4.models.currency.responses.CurrencyAddScheduleResponse; import com.chargebee.v4.models.currency.responses.CurrencyCreateResponse; @@ -27,9 +28,9 @@ import com.chargebee.v4.models.currency.responses.CurrencyUpdateResponse; -import com.chargebee.v4.models.currency.responses.RemoveScheduleForCurrencyResponse; +import com.chargebee.v4.models.currency.responses.CurrencyRemoveScheduleResponse; -import com.chargebee.v4.models.currency.responses.CurrencyListListResponse; +import com.chargebee.v4.models.currency.responses.CurrencyListResponse; public final class CurrencyService extends BaseService { @@ -65,8 +66,8 @@ public CurrencyService withOptions(RequestOptions options) { // === Operations === - /** addScheduleForCurrency a currency (executes immediately) - returns raw Response. */ - Response addScheduleForCurrencyRaw(String siteCurrencyId) throws Exception { + /** addSchedule a currency (executes immediately) - returns raw Response. */ + Response addScheduleRaw(String siteCurrencyId) throws ChargebeeException { String path = buildPathWithParams( "/currencies/{site-currency-id}/add_schedule", "site-currency-id", siteCurrencyId); @@ -75,11 +76,10 @@ Response addScheduleForCurrencyRaw(String siteCurrencyId) throws Exception { } /** - * addScheduleForCurrency a currency using immutable params (executes immediately) - returns raw - * Response. + * addSchedule a currency using immutable params (executes immediately) - returns raw Response. */ - Response addScheduleForCurrencyRaw(String siteCurrencyId, AddScheduleForCurrencyParams params) - throws Exception { + Response addScheduleRaw(String siteCurrencyId, CurrencyAddScheduleParams params) + throws ChargebeeException { String path = buildPathWithParams( "/currencies/{site-currency-id}/add_schedule", "site-currency-id", siteCurrencyId); @@ -87,55 +87,54 @@ Response addScheduleForCurrencyRaw(String siteCurrencyId, AddScheduleForCurrency } /** - * addScheduleForCurrency a currency using raw JSON payload (executes immediately) - returns raw - * Response. + * addSchedule a currency using raw JSON payload (executes immediately) - returns raw Response. */ - Response addScheduleForCurrencyRaw(String siteCurrencyId, String jsonPayload) throws Exception { + Response addScheduleRaw(String siteCurrencyId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/currencies/{site-currency-id}/add_schedule", "site-currency-id", siteCurrencyId); return postJson(path, jsonPayload); } - public AddScheduleForCurrencyResponse addScheduleForCurrency( - String siteCurrencyId, AddScheduleForCurrencyParams params) throws Exception { - Response response = addScheduleForCurrencyRaw(siteCurrencyId, params); - return AddScheduleForCurrencyResponse.fromJson(response.getBodyAsString(), response); + public CurrencyAddScheduleResponse addSchedule( + String siteCurrencyId, CurrencyAddScheduleParams params) throws ChargebeeException { + Response response = addScheduleRaw(siteCurrencyId, params); + return CurrencyAddScheduleResponse.fromJson(response.getBodyAsString(), response); } /** create a currency using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(CurrencyCreateParams params) throws Exception { + Response createRaw(CurrencyCreateParams params) throws ChargebeeException { return post("/currencies", params != null ? params.toFormData() : null); } /** create a currency using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/currencies", jsonPayload); } - public CurrencyCreateResponse create(CurrencyCreateParams params) throws Exception { + public CurrencyCreateResponse create(CurrencyCreateParams params) throws ChargebeeException { Response response = createRaw(params); return CurrencyCreateResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a currency (executes immediately) - returns raw Response. */ - Response retrieveRaw(String siteCurrencyId) throws Exception { + Response retrieveRaw(String siteCurrencyId) throws ChargebeeException { String path = buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); return get(path, null); } - public CurrencyRetrieveResponse retrieve(String siteCurrencyId) throws Exception { + public CurrencyRetrieveResponse retrieve(String siteCurrencyId) throws ChargebeeException { Response response = retrieveRaw(siteCurrencyId); return CurrencyRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a currency (executes immediately) - returns raw Response. */ - Response updateRaw(String siteCurrencyId) throws Exception { + Response updateRaw(String siteCurrencyId) throws ChargebeeException { String path = buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); @@ -143,27 +142,27 @@ Response updateRaw(String siteCurrencyId) throws Exception { } /** update a currency using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String siteCurrencyId, CurrencyUpdateParams params) throws Exception { + Response updateRaw(String siteCurrencyId, CurrencyUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); return post(path, params.toFormData()); } /** update a currency using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String siteCurrencyId, String jsonPayload) throws Exception { + Response updateRaw(String siteCurrencyId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); return postJson(path, jsonPayload); } public CurrencyUpdateResponse update(String siteCurrencyId, CurrencyUpdateParams params) - throws Exception { + throws ChargebeeException { Response response = updateRaw(siteCurrencyId, params); return CurrencyUpdateResponse.fromJson(response.getBodyAsString(), response); } - /** removeScheduleForCurrency a currency (executes immediately) - returns raw Response. */ - Response removeScheduleForCurrencyRaw(String siteCurrencyId) throws Exception { + /** removeSchedule a currency (executes immediately) - returns raw Response. */ + Response removeScheduleRaw(String siteCurrencyId) throws ChargebeeException { String path = buildPathWithParams( "/currencies/{site-currency-id}/remove_schedule", "site-currency-id", siteCurrencyId); @@ -171,38 +170,38 @@ Response removeScheduleForCurrencyRaw(String siteCurrencyId) throws Exception { return post(path, null); } - public RemoveScheduleForCurrencyResponse removeScheduleForCurrency(String siteCurrencyId) - throws Exception { - Response response = removeScheduleForCurrencyRaw(siteCurrencyId); - return RemoveScheduleForCurrencyResponse.fromJson(response.getBodyAsString(), response); + public CurrencyRemoveScheduleResponse removeSchedule(String siteCurrencyId) + throws ChargebeeException { + Response response = removeScheduleRaw(siteCurrencyId); + return CurrencyRemoveScheduleResponse.fromJson(response.getBodyAsString(), response); } - /** listList a currency using immutable params (executes immediately) - returns raw Response. */ - Response listListRaw(CurrencyListListParams params) throws Exception { + /** list a currency using immutable params (executes immediately) - returns raw Response. */ + Response listRaw(CurrencyListParams params) throws ChargebeeException { return get("/currencies/list", params != null ? params.toQueryParams() : null); } - /** listList a currency without params (executes immediately) - returns raw Response. */ - Response listListRaw() throws Exception { + /** list a currency without params (executes immediately) - returns raw Response. */ + Response listRaw() throws ChargebeeException { return get("/currencies/list", null); } - /** listList a currency using raw JSON payload (executes immediately) - returns raw Response. */ - Response listListRaw(String jsonPayload) throws Exception { + /** list a currency using raw JSON payload (executes immediately) - returns raw Response. */ + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public CurrencyListListResponse listList(CurrencyListListParams params) throws Exception { - Response response = listListRaw(params); + public CurrencyListResponse list(CurrencyListParams params) throws ChargebeeException { + Response response = listRaw(params); - return CurrencyListListResponse.fromJson(response.getBodyAsString(), this, params, response); + return CurrencyListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public CurrencyListListResponse listList() throws Exception { - Response response = listListRaw(); - return CurrencyListListResponse.fromJson(response.getBodyAsString(), this, null, response); + public CurrencyListResponse list() throws ChargebeeException { + Response response = listRaw(); + return CurrencyListResponse.fromJson(response.getBodyAsString(), this, null, response); } } diff --git a/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java b/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java index 96cc96e5..22fcbe72 100644 --- a/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.customerEntitlement.params.CustomerEntitlementsForCustomerParams; +import com.chargebee.v4.models.customerEntitlement.params.CustomerEntitlementEntitlementsForCustomerParams; -import com.chargebee.v4.models.customerEntitlement.responses.CustomerEntitlementsForCustomerResponse; +import com.chargebee.v4.models.customerEntitlement.responses.CustomerEntitlementEntitlementsForCustomerResponse; public final class CustomerEntitlementService extends BaseService { @@ -51,11 +52,12 @@ public CustomerEntitlementService withOptions(RequestOptions options) { // === Operations === /** - * customerEntitlementsForCustomer a customerEntitlement using immutable params (executes - * immediately) - returns raw Response. + * entitlementsForCustomer a customerEntitlement using immutable params (executes immediately) - + * returns raw Response. */ - Response customerEntitlementsForCustomerRaw( - String customerId, CustomerEntitlementsForCustomerParams params) throws Exception { + Response entitlementsForCustomerRaw( + String customerId, CustomerEntitlementEntitlementsForCustomerParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/customer_entitlements", "customer-id", customerId); @@ -63,10 +65,10 @@ Response customerEntitlementsForCustomerRaw( } /** - * customerEntitlementsForCustomer a customerEntitlement without params (executes immediately) - - * returns raw Response. + * entitlementsForCustomer a customerEntitlement without params (executes immediately) - returns + * raw Response. */ - Response customerEntitlementsForCustomerRaw(String customerId) throws Exception { + Response entitlementsForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/customer_entitlements", "customer-id", customerId); @@ -74,28 +76,29 @@ Response customerEntitlementsForCustomerRaw(String customerId) throws Exception } /** - * customerEntitlementsForCustomer a customerEntitlement using raw JSON payload (executes - * immediately) - returns raw Response. + * entitlementsForCustomer a customerEntitlement using raw JSON payload (executes immediately) - + * returns raw Response. */ - Response customerEntitlementsForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response entitlementsForCustomerRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/customer_entitlements", "customer-id", customerId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public CustomerEntitlementsForCustomerResponse customerEntitlementsForCustomer( - String customerId, CustomerEntitlementsForCustomerParams params) throws Exception { - Response response = customerEntitlementsForCustomerRaw(customerId, params); - return CustomerEntitlementsForCustomerResponse.fromJson( + public CustomerEntitlementEntitlementsForCustomerResponse entitlementsForCustomer( + String customerId, CustomerEntitlementEntitlementsForCustomerParams params) + throws ChargebeeException { + Response response = entitlementsForCustomerRaw(customerId, params); + return CustomerEntitlementEntitlementsForCustomerResponse.fromJson( response.getBodyAsString(), this, params, customerId, response); } - public CustomerEntitlementsForCustomerResponse customerEntitlementsForCustomer(String customerId) - throws Exception { - Response response = customerEntitlementsForCustomerRaw(customerId); - return CustomerEntitlementsForCustomerResponse.fromJson( + public CustomerEntitlementEntitlementsForCustomerResponse entitlementsForCustomer( + String customerId) throws ChargebeeException { + Response response = entitlementsForCustomerRaw(customerId); + return CustomerEntitlementEntitlementsForCustomerResponse.fromJson( response.getBodyAsString(), this, null, customerId, response); } } diff --git a/src/main/java/com/chargebee/v4/services/CustomerService.java b/src/main/java/com/chargebee/v4/services/CustomerService.java index 90981a9b..11787ba2 100644 --- a/src/main/java/com/chargebee/v4/services/CustomerService.java +++ b/src/main/java/com/chargebee/v4/services/CustomerService.java @@ -9,103 +9,106 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.customer.params.DeleteCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerDeleteParams; -import com.chargebee.v4.models.customer.params.AddPromotionalCreditsForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerAddPromotionalCreditsParams; -import com.chargebee.v4.models.customer.params.RelationshipsForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerRelationshipsParams; -import com.chargebee.v4.models.customer.params.DeleteContactForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerDeleteContactParams; -import com.chargebee.v4.models.customer.params.AssignPaymentRoleForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerAssignPaymentRoleParams; import com.chargebee.v4.models.customer.params.CustomerMoveParams; -import com.chargebee.v4.models.customer.params.UpdatePaymentMethodForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerHierarchyParams; + +import com.chargebee.v4.models.customer.params.CustomerUpdatePaymentMethodParams; import com.chargebee.v4.models.customer.params.CustomerUpdateParams; -import com.chargebee.v4.models.customer.params.HierarchyDetailForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerListHierarchyDetailParams; -import com.chargebee.v4.models.customer.params.ChangeBillingDateForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerChangeBillingDateParams; import com.chargebee.v4.models.customer.params.CustomerListParams; import com.chargebee.v4.models.customer.params.CustomerCreateParams; -import com.chargebee.v4.models.customer.params.AddContactForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerAddContactParams; import com.chargebee.v4.models.customer.params.ContactsForCustomerParams; -import com.chargebee.v4.models.customer.params.DeductPromotionalCreditsForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerDeductPromotionalCreditsParams; import com.chargebee.v4.models.customer.params.CustomerMergeParams; -import com.chargebee.v4.models.customer.params.CollectPaymentForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerCollectPaymentParams; -import com.chargebee.v4.models.customer.params.RecordExcessPaymentForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerRecordExcessPaymentParams; -import com.chargebee.v4.models.customer.params.SetPromotionalCreditsForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerSetPromotionalCreditsParams; -import com.chargebee.v4.models.customer.params.UpdateContactForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerUpdateContactParams; -import com.chargebee.v4.models.customer.params.UpdateHierarchySettingsForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerUpdateHierarchySettingsParams; -import com.chargebee.v4.models.customer.params.UpdateBillingInfoForCustomerParams; +import com.chargebee.v4.models.customer.params.CustomerUpdateBillingInfoParams; -import com.chargebee.v4.models.customer.responses.DeleteCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerDeleteResponse; -import com.chargebee.v4.models.customer.responses.AddPromotionalCreditsForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerAddPromotionalCreditsResponse; -import com.chargebee.v4.models.customer.responses.RelationshipsForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerRelationshipsResponse; -import com.chargebee.v4.models.customer.responses.DeleteRelationshipForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerDeleteRelationshipResponse; -import com.chargebee.v4.models.customer.responses.DeleteContactForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerDeleteContactResponse; -import com.chargebee.v4.models.customer.responses.AssignPaymentRoleForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerAssignPaymentRoleResponse; import com.chargebee.v4.models.customer.responses.CustomerMoveResponse; -import com.chargebee.v4.models.customer.responses.HierarchyForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerHierarchyResponse; -import com.chargebee.v4.models.customer.responses.UpdatePaymentMethodForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerUpdatePaymentMethodResponse; import com.chargebee.v4.models.customer.responses.CustomerRetrieveResponse; import com.chargebee.v4.models.customer.responses.CustomerUpdateResponse; -import com.chargebee.v4.models.customer.responses.HierarchyDetailForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerListHierarchyDetailResponse; -import com.chargebee.v4.models.customer.responses.ChangeBillingDateForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerChangeBillingDateResponse; import com.chargebee.v4.models.customer.responses.CustomerListResponse; import com.chargebee.v4.models.customer.responses.CustomerCreateResponse; -import com.chargebee.v4.models.customer.responses.AddContactForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerAddContactResponse; import com.chargebee.v4.models.customer.responses.ContactsForCustomerResponse; -import com.chargebee.v4.models.customer.responses.DeductPromotionalCreditsForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerDeductPromotionalCreditsResponse; -import com.chargebee.v4.models.customer.responses.ClearPersonalDataForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerClearPersonalDataResponse; import com.chargebee.v4.models.customer.responses.CustomerMergeResponse; -import com.chargebee.v4.models.customer.responses.CollectPaymentForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerCollectPaymentResponse; -import com.chargebee.v4.models.customer.responses.RecordExcessPaymentForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerRecordExcessPaymentResponse; -import com.chargebee.v4.models.customer.responses.SetPromotionalCreditsForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerSetPromotionalCreditsResponse; -import com.chargebee.v4.models.customer.responses.UpdateContactForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerUpdateContactResponse; -import com.chargebee.v4.models.customer.responses.UpdateHierarchySettingsForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerUpdateHierarchySettingsResponse; -import com.chargebee.v4.models.customer.responses.UpdateBillingInfoForCustomerResponse; +import com.chargebee.v4.models.customer.responses.CustomerUpdateBillingInfoResponse; public final class CustomerService extends BaseService { @@ -141,37 +144,33 @@ public CustomerService withOptions(RequestOptions options) { // === Operations === - /** deleteCustomer a customer (executes immediately) - returns raw Response. */ - Response deleteCustomerRaw(String customerId) throws Exception { + /** delete a customer (executes immediately) - returns raw Response. */ + Response deleteRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete", "customer-id", customerId); return post(path, null); } - /** - * deleteCustomer a customer using immutable params (executes immediately) - returns raw Response. - */ - Response deleteCustomerRaw(String customerId, DeleteCustomerParams params) throws Exception { + /** delete a customer using immutable params (executes immediately) - returns raw Response. */ + Response deleteRaw(String customerId, CustomerDeleteParams params) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete", "customer-id", customerId); return post(path, params.toFormData()); } - /** - * deleteCustomer a customer using raw JSON payload (executes immediately) - returns raw Response. - */ - Response deleteCustomerRaw(String customerId, String jsonPayload) throws Exception { + /** delete a customer using raw JSON payload (executes immediately) - returns raw Response. */ + Response deleteRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete", "customer-id", customerId); return postJson(path, jsonPayload); } - public DeleteCustomerResponse deleteCustomer(String customerId, DeleteCustomerParams params) - throws Exception { - Response response = deleteCustomerRaw(customerId, params); - return DeleteCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerDeleteResponse delete(String customerId, CustomerDeleteParams params) + throws ChargebeeException { + Response response = deleteRaw(customerId, params); + return CustomerDeleteResponse.fromJson(response.getBodyAsString(), response); } - /** addPromotionalCreditsForCustomer a customer (executes immediately) - returns raw Response. */ - Response addPromotionalCreditsForCustomerRaw(String customerId) throws Exception { + /** addPromotionalCredits a customer (executes immediately) - returns raw Response. */ + Response addPromotionalCreditsRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/add_promotional_credits", "customer-id", customerId); @@ -180,11 +179,11 @@ Response addPromotionalCreditsForCustomerRaw(String customerId) throws Exception } /** - * addPromotionalCreditsForCustomer a customer using immutable params (executes immediately) - - * returns raw Response. + * addPromotionalCredits a customer using immutable params (executes immediately) - returns raw + * Response. */ - Response addPromotionalCreditsForCustomerRaw( - String customerId, AddPromotionalCreditsForCustomerParams params) throws Exception { + Response addPromotionalCreditsRaw(String customerId, CustomerAddPromotionalCreditsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/add_promotional_credits", "customer-id", customerId); @@ -192,25 +191,25 @@ Response addPromotionalCreditsForCustomerRaw( } /** - * addPromotionalCreditsForCustomer a customer using raw JSON payload (executes immediately) - - * returns raw Response. + * addPromotionalCredits a customer using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response addPromotionalCreditsForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response addPromotionalCreditsRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/add_promotional_credits", "customer-id", customerId); return postJson(path, jsonPayload); } - public AddPromotionalCreditsForCustomerResponse addPromotionalCreditsForCustomer( - String customerId, AddPromotionalCreditsForCustomerParams params) throws Exception { - Response response = addPromotionalCreditsForCustomerRaw(customerId, params); - return AddPromotionalCreditsForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerAddPromotionalCreditsResponse addPromotionalCredits( + String customerId, CustomerAddPromotionalCreditsParams params) throws ChargebeeException { + Response response = addPromotionalCreditsRaw(customerId, params); + return CustomerAddPromotionalCreditsResponse.fromJson(response.getBodyAsString(), response); } - /** relationshipsForCustomer a customer (executes immediately) - returns raw Response. */ - Response relationshipsForCustomerRaw(String customerId) throws Exception { + /** relationships a customer (executes immediately) - returns raw Response. */ + Response relationshipsRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/relationships", "customer-id", customerId); @@ -218,34 +217,32 @@ Response relationshipsForCustomerRaw(String customerId) throws Exception { } /** - * relationshipsForCustomer a customer using immutable params (executes immediately) - returns raw - * Response. + * relationships a customer using immutable params (executes immediately) - returns raw Response. */ - Response relationshipsForCustomerRaw(String customerId, RelationshipsForCustomerParams params) - throws Exception { + Response relationshipsRaw(String customerId, CustomerRelationshipsParams params) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/relationships", "customer-id", customerId); return post(path, params.toFormData()); } /** - * relationshipsForCustomer a customer using raw JSON payload (executes immediately) - returns raw - * Response. + * relationships a customer using raw JSON payload (executes immediately) - returns raw Response. */ - Response relationshipsForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response relationshipsRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/relationships", "customer-id", customerId); return postJson(path, jsonPayload); } - public RelationshipsForCustomerResponse relationshipsForCustomer( - String customerId, RelationshipsForCustomerParams params) throws Exception { - Response response = relationshipsForCustomerRaw(customerId, params); - return RelationshipsForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerRelationshipsResponse relationships( + String customerId, CustomerRelationshipsParams params) throws ChargebeeException { + Response response = relationshipsRaw(customerId, params); + return CustomerRelationshipsResponse.fromJson(response.getBodyAsString(), response); } - /** deleteRelationshipForCustomer a customer (executes immediately) - returns raw Response. */ - Response deleteRelationshipForCustomerRaw(String customerId) throws Exception { + /** deleteRelationship a customer (executes immediately) - returns raw Response. */ + Response deleteRelationshipRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/delete_relationship", "customer-id", customerId); @@ -253,14 +250,14 @@ Response deleteRelationshipForCustomerRaw(String customerId) throws Exception { return post(path, null); } - public DeleteRelationshipForCustomerResponse deleteRelationshipForCustomer(String customerId) - throws Exception { - Response response = deleteRelationshipForCustomerRaw(customerId); - return DeleteRelationshipForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerDeleteRelationshipResponse deleteRelationship(String customerId) + throws ChargebeeException { + Response response = deleteRelationshipRaw(customerId); + return CustomerDeleteRelationshipResponse.fromJson(response.getBodyAsString(), response); } - /** deleteContactForCustomer a customer (executes immediately) - returns raw Response. */ - Response deleteContactForCustomerRaw(String customerId) throws Exception { + /** deleteContact a customer (executes immediately) - returns raw Response. */ + Response deleteContactRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete_contact", "customer-id", customerId); @@ -268,34 +265,32 @@ Response deleteContactForCustomerRaw(String customerId) throws Exception { } /** - * deleteContactForCustomer a customer using immutable params (executes immediately) - returns raw - * Response. + * deleteContact a customer using immutable params (executes immediately) - returns raw Response. */ - Response deleteContactForCustomerRaw(String customerId, DeleteContactForCustomerParams params) - throws Exception { + Response deleteContactRaw(String customerId, CustomerDeleteContactParams params) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete_contact", "customer-id", customerId); return post(path, params.toFormData()); } /** - * deleteContactForCustomer a customer using raw JSON payload (executes immediately) - returns raw - * Response. + * deleteContact a customer using raw JSON payload (executes immediately) - returns raw Response. */ - Response deleteContactForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response deleteContactRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete_contact", "customer-id", customerId); return postJson(path, jsonPayload); } - public DeleteContactForCustomerResponse deleteContactForCustomer( - String customerId, DeleteContactForCustomerParams params) throws Exception { - Response response = deleteContactForCustomerRaw(customerId, params); - return DeleteContactForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerDeleteContactResponse deleteContact( + String customerId, CustomerDeleteContactParams params) throws ChargebeeException { + Response response = deleteContactRaw(customerId, params); + return CustomerDeleteContactResponse.fromJson(response.getBodyAsString(), response); } - /** assignPaymentRoleForCustomer a customer (executes immediately) - returns raw Response. */ - Response assignPaymentRoleForCustomerRaw(String customerId) throws Exception { + /** assignPaymentRole a customer (executes immediately) - returns raw Response. */ + Response assignPaymentRoleRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/assign_payment_role", "customer-id", customerId); @@ -304,11 +299,11 @@ Response assignPaymentRoleForCustomerRaw(String customerId) throws Exception { } /** - * assignPaymentRoleForCustomer a customer using immutable params (executes immediately) - returns - * raw Response. + * assignPaymentRole a customer using immutable params (executes immediately) - returns raw + * Response. */ - Response assignPaymentRoleForCustomerRaw( - String customerId, AssignPaymentRoleForCustomerParams params) throws Exception { + Response assignPaymentRoleRaw(String customerId, CustomerAssignPaymentRoleParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/assign_payment_role", "customer-id", customerId); @@ -316,55 +311,69 @@ Response assignPaymentRoleForCustomerRaw( } /** - * assignPaymentRoleForCustomer a customer using raw JSON payload (executes immediately) - returns - * raw Response. + * assignPaymentRole a customer using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response assignPaymentRoleForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response assignPaymentRoleRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/assign_payment_role", "customer-id", customerId); return postJson(path, jsonPayload); } - public AssignPaymentRoleForCustomerResponse assignPaymentRoleForCustomer( - String customerId, AssignPaymentRoleForCustomerParams params) throws Exception { - Response response = assignPaymentRoleForCustomerRaw(customerId, params); - return AssignPaymentRoleForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerAssignPaymentRoleResponse assignPaymentRole( + String customerId, CustomerAssignPaymentRoleParams params) throws ChargebeeException { + Response response = assignPaymentRoleRaw(customerId, params); + return CustomerAssignPaymentRoleResponse.fromJson(response.getBodyAsString(), response); } /** move a customer using immutable params (executes immediately) - returns raw Response. */ - Response moveRaw(CustomerMoveParams params) throws Exception { + Response moveRaw(CustomerMoveParams params) throws ChargebeeException { return post("/customers/move", params != null ? params.toFormData() : null); } /** move a customer using raw JSON payload (executes immediately) - returns raw Response. */ - Response moveRaw(String jsonPayload) throws Exception { + Response moveRaw(String jsonPayload) throws ChargebeeException { return postJson("/customers/move", jsonPayload); } - public CustomerMoveResponse move(CustomerMoveParams params) throws Exception { + public CustomerMoveResponse move(CustomerMoveParams params) throws ChargebeeException { Response response = moveRaw(params); return CustomerMoveResponse.fromJson(response.getBodyAsString(), response); } - /** hierarchyForCustomer a customer (executes immediately) - returns raw Response. */ - Response hierarchyForCustomerRaw(String customerId) throws Exception { + /** hierarchy a customer (executes immediately) - returns raw Response. */ + Response hierarchyRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/hierarchy", "customer-id", customerId); return get(path, null); } - public HierarchyForCustomerResponse hierarchyForCustomer(String customerId) throws Exception { - Response response = hierarchyForCustomerRaw(customerId); - return HierarchyForCustomerResponse.fromJson(response.getBodyAsString(), response); + /** hierarchy a customer using immutable params (executes immediately) - returns raw Response. */ + Response hierarchyRaw(String customerId, CustomerHierarchyParams params) + throws ChargebeeException { + String path = + buildPathWithParams("/customers/{customer-id}/hierarchy", "customer-id", customerId); + return get(path, params != null ? params.toQueryParams() : null); + } + + public CustomerHierarchyResponse hierarchy(String customerId, CustomerHierarchyParams params) + throws ChargebeeException { + Response response = hierarchyRaw(customerId, params); + return CustomerHierarchyResponse.fromJson(response.getBodyAsString(), response); + } + + public CustomerHierarchyResponse hierarchy(String customerId) throws ChargebeeException { + Response response = hierarchyRaw(customerId); + return CustomerHierarchyResponse.fromJson(response.getBodyAsString(), response); } - /** updatePaymentMethodForCustomer a customer (executes immediately) - returns raw Response. */ - Response updatePaymentMethodForCustomerRaw(String customerId) throws Exception { + /** updatePaymentMethod a customer (executes immediately) - returns raw Response. */ + Response updatePaymentMethodRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/update_payment_method", "customer-id", customerId); @@ -373,11 +382,11 @@ Response updatePaymentMethodForCustomerRaw(String customerId) throws Exception { } /** - * updatePaymentMethodForCustomer a customer using immutable params (executes immediately) - - * returns raw Response. + * updatePaymentMethod a customer using immutable params (executes immediately) - returns raw + * Response. */ - Response updatePaymentMethodForCustomerRaw( - String customerId, UpdatePaymentMethodForCustomerParams params) throws Exception { + Response updatePaymentMethodRaw(String customerId, CustomerUpdatePaymentMethodParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/update_payment_method", "customer-id", customerId); @@ -385,107 +394,105 @@ Response updatePaymentMethodForCustomerRaw( } /** - * updatePaymentMethodForCustomer a customer using raw JSON payload (executes immediately) - - * returns raw Response. + * updatePaymentMethod a customer using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response updatePaymentMethodForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response updatePaymentMethodRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/update_payment_method", "customer-id", customerId); return postJson(path, jsonPayload); } - public UpdatePaymentMethodForCustomerResponse updatePaymentMethodForCustomer( - String customerId, UpdatePaymentMethodForCustomerParams params) throws Exception { - Response response = updatePaymentMethodForCustomerRaw(customerId, params); - return UpdatePaymentMethodForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerUpdatePaymentMethodResponse updatePaymentMethod( + String customerId, CustomerUpdatePaymentMethodParams params) throws ChargebeeException { + Response response = updatePaymentMethodRaw(customerId, params); + return CustomerUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a customer (executes immediately) - returns raw Response. */ - Response retrieveRaw(String customerId) throws Exception { + Response retrieveRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); return get(path, null); } - public CustomerRetrieveResponse retrieve(String customerId) throws Exception { + public CustomerRetrieveResponse retrieve(String customerId) throws ChargebeeException { Response response = retrieveRaw(customerId); return CustomerRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a customer (executes immediately) - returns raw Response. */ - Response updateRaw(String customerId) throws Exception { + Response updateRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); return post(path, null); } /** update a customer using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String customerId, CustomerUpdateParams params) throws Exception { + Response updateRaw(String customerId, CustomerUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); return post(path, params.toFormData()); } /** update a customer using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String customerId, String jsonPayload) throws Exception { + Response updateRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); return postJson(path, jsonPayload); } public CustomerUpdateResponse update(String customerId, CustomerUpdateParams params) - throws Exception { + throws ChargebeeException { Response response = updateRaw(customerId, params); return CustomerUpdateResponse.fromJson(response.getBodyAsString(), response); } /** - * hierarchyDetailForCustomer a customer using immutable params (executes immediately) - returns - * raw Response. + * listHierarchyDetail a customer using immutable params (executes immediately) - returns raw + * Response. */ - Response hierarchyDetailForCustomerRaw(String customerId, HierarchyDetailForCustomerParams params) - throws Exception { + Response listHierarchyDetailRaw(String customerId, CustomerListHierarchyDetailParams params) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/hierarchy_detail", "customer-id", customerId); return get(path, params != null ? params.toQueryParams() : null); } /** - * hierarchyDetailForCustomer a customer without params (executes immediately) - returns raw - * Response. + * listHierarchyDetail a customer without params (executes immediately) - returns raw Response. */ - Response hierarchyDetailForCustomerRaw(String customerId) throws Exception { + Response listHierarchyDetailRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/hierarchy_detail", "customer-id", customerId); return get(path, null); } /** - * hierarchyDetailForCustomer a customer using raw JSON payload (executes immediately) - returns - * raw Response. + * listHierarchyDetail a customer using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response hierarchyDetailForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response listHierarchyDetailRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/hierarchy_detail", "customer-id", customerId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public HierarchyDetailForCustomerResponse hierarchyDetailForCustomer( - String customerId, HierarchyDetailForCustomerParams params) throws Exception { - Response response = hierarchyDetailForCustomerRaw(customerId, params); - return HierarchyDetailForCustomerResponse.fromJson( + public CustomerListHierarchyDetailResponse listHierarchyDetail( + String customerId, CustomerListHierarchyDetailParams params) throws ChargebeeException { + Response response = listHierarchyDetailRaw(customerId, params); + return CustomerListHierarchyDetailResponse.fromJson( response.getBodyAsString(), this, params, customerId, response); } - public HierarchyDetailForCustomerResponse hierarchyDetailForCustomer(String customerId) - throws Exception { - Response response = hierarchyDetailForCustomerRaw(customerId); - return HierarchyDetailForCustomerResponse.fromJson( + public CustomerListHierarchyDetailResponse listHierarchyDetail(String customerId) + throws ChargebeeException { + Response response = listHierarchyDetailRaw(customerId); + return CustomerListHierarchyDetailResponse.fromJson( response.getBodyAsString(), this, null, customerId, response); } - /** changeBillingDateForCustomer a customer (executes immediately) - returns raw Response. */ - Response changeBillingDateForCustomerRaw(String customerId) throws Exception { + /** changeBillingDate a customer (executes immediately) - returns raw Response. */ + Response changeBillingDateRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/change_billing_date", "customer-id", customerId); @@ -494,11 +501,11 @@ Response changeBillingDateForCustomerRaw(String customerId) throws Exception { } /** - * changeBillingDateForCustomer a customer using immutable params (executes immediately) - returns - * raw Response. + * changeBillingDate a customer using immutable params (executes immediately) - returns raw + * Response. */ - Response changeBillingDateForCustomerRaw( - String customerId, ChangeBillingDateForCustomerParams params) throws Exception { + Response changeBillingDateRaw(String customerId, CustomerChangeBillingDateParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/change_billing_date", "customer-id", customerId); @@ -506,102 +513,96 @@ Response changeBillingDateForCustomerRaw( } /** - * changeBillingDateForCustomer a customer using raw JSON payload (executes immediately) - returns - * raw Response. + * changeBillingDate a customer using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response changeBillingDateForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response changeBillingDateRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/change_billing_date", "customer-id", customerId); return postJson(path, jsonPayload); } - public ChangeBillingDateForCustomerResponse changeBillingDateForCustomer( - String customerId, ChangeBillingDateForCustomerParams params) throws Exception { - Response response = changeBillingDateForCustomerRaw(customerId, params); - return ChangeBillingDateForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerChangeBillingDateResponse changeBillingDate( + String customerId, CustomerChangeBillingDateParams params) throws ChargebeeException { + Response response = changeBillingDateRaw(customerId, params); + return CustomerChangeBillingDateResponse.fromJson(response.getBodyAsString(), response); } /** list a customer using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(CustomerListParams params) throws Exception { + Response listRaw(CustomerListParams params) throws ChargebeeException { return get("/customers", params != null ? params.toQueryParams() : null); } /** list a customer without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/customers", null); } /** list a customer using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public CustomerListResponse list(CustomerListParams params) throws Exception { + public CustomerListResponse list(CustomerListParams params) throws ChargebeeException { Response response = listRaw(params); return CustomerListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public CustomerListResponse list() throws Exception { + public CustomerListResponse list() throws ChargebeeException { Response response = listRaw(); return CustomerListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a customer using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(CustomerCreateParams params) throws Exception { + Response createRaw(CustomerCreateParams params) throws ChargebeeException { return post("/customers", params != null ? params.toFormData() : null); } /** create a customer using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/customers", jsonPayload); } - public CustomerCreateResponse create(CustomerCreateParams params) throws Exception { + public CustomerCreateResponse create(CustomerCreateParams params) throws ChargebeeException { Response response = createRaw(params); return CustomerCreateResponse.fromJson(response.getBodyAsString(), response); } - /** addContactForCustomer a customer (executes immediately) - returns raw Response. */ - Response addContactForCustomerRaw(String customerId) throws Exception { + /** addContact a customer (executes immediately) - returns raw Response. */ + Response addContactRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/add_contact", "customer-id", customerId); return post(path, null); } - /** - * addContactForCustomer a customer using immutable params (executes immediately) - returns raw - * Response. - */ - Response addContactForCustomerRaw(String customerId, AddContactForCustomerParams params) - throws Exception { + /** addContact a customer using immutable params (executes immediately) - returns raw Response. */ + Response addContactRaw(String customerId, CustomerAddContactParams params) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/add_contact", "customer-id", customerId); return post(path, params.toFormData()); } - /** - * addContactForCustomer a customer using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response addContactForCustomerRaw(String customerId, String jsonPayload) throws Exception { + /** addContact a customer using raw JSON payload (executes immediately) - returns raw Response. */ + Response addContactRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/add_contact", "customer-id", customerId); return postJson(path, jsonPayload); } - public AddContactForCustomerResponse addContactForCustomer( - String customerId, AddContactForCustomerParams params) throws Exception { - Response response = addContactForCustomerRaw(customerId, params); - return AddContactForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerAddContactResponse addContact(String customerId, CustomerAddContactParams params) + throws ChargebeeException { + Response response = addContactRaw(customerId, params); + return CustomerAddContactResponse.fromJson(response.getBodyAsString(), response); } /** @@ -609,7 +610,7 @@ public AddContactForCustomerResponse addContactForCustomer( * Response. */ Response contactsForCustomerRaw(String customerId, ContactsForCustomerParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/contacts", "customer-id", customerId); return get(path, params != null ? params.toQueryParams() : null); @@ -618,7 +619,7 @@ Response contactsForCustomerRaw(String customerId, ContactsForCustomerParams par /** * contactsForCustomer a customer without params (executes immediately) - returns raw Response. */ - Response contactsForCustomerRaw(String customerId) throws Exception { + Response contactsForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/contacts", "customer-id", customerId); return get(path, null); @@ -628,29 +629,28 @@ Response contactsForCustomerRaw(String customerId) throws Exception { * contactsForCustomer a customer using raw JSON payload (executes immediately) - returns raw * Response. */ - Response contactsForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response contactsForCustomerRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/contacts", "customer-id", customerId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public ContactsForCustomerResponse contactsForCustomer( - String customerId, ContactsForCustomerParams params) throws Exception { + String customerId, ContactsForCustomerParams params) throws ChargebeeException { Response response = contactsForCustomerRaw(customerId, params); return ContactsForCustomerResponse.fromJson( response.getBodyAsString(), this, params, customerId, response); } - public ContactsForCustomerResponse contactsForCustomer(String customerId) throws Exception { + public ContactsForCustomerResponse contactsForCustomer(String customerId) + throws ChargebeeException { Response response = contactsForCustomerRaw(customerId); return ContactsForCustomerResponse.fromJson( response.getBodyAsString(), this, null, customerId, response); } - /** - * deductPromotionalCreditsForCustomer a customer (executes immediately) - returns raw Response. - */ - Response deductPromotionalCreditsForCustomerRaw(String customerId) throws Exception { + /** deductPromotionalCredits a customer (executes immediately) - returns raw Response. */ + Response deductPromotionalCreditsRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/deduct_promotional_credits", "customer-id", customerId); @@ -659,11 +659,11 @@ Response deductPromotionalCreditsForCustomerRaw(String customerId) throws Except } /** - * deductPromotionalCreditsForCustomer a customer using immutable params (executes immediately) - - * returns raw Response. + * deductPromotionalCredits a customer using immutable params (executes immediately) - returns raw + * Response. */ - Response deductPromotionalCreditsForCustomerRaw( - String customerId, DeductPromotionalCreditsForCustomerParams params) throws Exception { + Response deductPromotionalCreditsRaw( + String customerId, CustomerDeductPromotionalCreditsParams params) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/deduct_promotional_credits", "customer-id", customerId); @@ -671,26 +671,25 @@ Response deductPromotionalCreditsForCustomerRaw( } /** - * deductPromotionalCreditsForCustomer a customer using raw JSON payload (executes immediately) - - * returns raw Response. + * deductPromotionalCredits a customer using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response deductPromotionalCreditsForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response deductPromotionalCreditsRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/deduct_promotional_credits", "customer-id", customerId); return postJson(path, jsonPayload); } - public DeductPromotionalCreditsForCustomerResponse deductPromotionalCreditsForCustomer( - String customerId, DeductPromotionalCreditsForCustomerParams params) throws Exception { - Response response = deductPromotionalCreditsForCustomerRaw(customerId, params); - return DeductPromotionalCreditsForCustomerResponse.fromJson( - response.getBodyAsString(), response); + public CustomerDeductPromotionalCreditsResponse deductPromotionalCredits( + String customerId, CustomerDeductPromotionalCreditsParams params) throws ChargebeeException { + Response response = deductPromotionalCreditsRaw(customerId, params); + return CustomerDeductPromotionalCreditsResponse.fromJson(response.getBodyAsString(), response); } - /** clearPersonalDataForCustomer a customer (executes immediately) - returns raw Response. */ - Response clearPersonalDataForCustomerRaw(String customerId) throws Exception { + /** clearPersonalData a customer (executes immediately) - returns raw Response. */ + Response clearPersonalDataRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/clear_personal_data", "customer-id", customerId); @@ -698,32 +697,32 @@ Response clearPersonalDataForCustomerRaw(String customerId) throws Exception { return post(path, null); } - public ClearPersonalDataForCustomerResponse clearPersonalDataForCustomer(String customerId) - throws Exception { - Response response = clearPersonalDataForCustomerRaw(customerId); - return ClearPersonalDataForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerClearPersonalDataResponse clearPersonalData(String customerId) + throws ChargebeeException { + Response response = clearPersonalDataRaw(customerId); + return CustomerClearPersonalDataResponse.fromJson(response.getBodyAsString(), response); } /** merge a customer using immutable params (executes immediately) - returns raw Response. */ - Response mergeRaw(CustomerMergeParams params) throws Exception { + Response mergeRaw(CustomerMergeParams params) throws ChargebeeException { return post("/customers/merge", params != null ? params.toFormData() : null); } /** merge a customer using raw JSON payload (executes immediately) - returns raw Response. */ - Response mergeRaw(String jsonPayload) throws Exception { + Response mergeRaw(String jsonPayload) throws ChargebeeException { return postJson("/customers/merge", jsonPayload); } - public CustomerMergeResponse merge(CustomerMergeParams params) throws Exception { + public CustomerMergeResponse merge(CustomerMergeParams params) throws ChargebeeException { Response response = mergeRaw(params); return CustomerMergeResponse.fromJson(response.getBodyAsString(), response); } - /** collectPaymentForCustomer a customer (executes immediately) - returns raw Response. */ - Response collectPaymentForCustomerRaw(String customerId) throws Exception { + /** collectPayment a customer (executes immediately) - returns raw Response. */ + Response collectPaymentRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/collect_payment", "customer-id", customerId); @@ -731,34 +730,32 @@ Response collectPaymentForCustomerRaw(String customerId) throws Exception { } /** - * collectPaymentForCustomer a customer using immutable params (executes immediately) - returns - * raw Response. + * collectPayment a customer using immutable params (executes immediately) - returns raw Response. */ - Response collectPaymentForCustomerRaw(String customerId, CollectPaymentForCustomerParams params) - throws Exception { + Response collectPaymentRaw(String customerId, CustomerCollectPaymentParams params) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/collect_payment", "customer-id", customerId); return post(path, params.toFormData()); } /** - * collectPaymentForCustomer a customer using raw JSON payload (executes immediately) - returns - * raw Response. + * collectPayment a customer using raw JSON payload (executes immediately) - returns raw Response. */ - Response collectPaymentForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response collectPaymentRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/collect_payment", "customer-id", customerId); return postJson(path, jsonPayload); } - public CollectPaymentForCustomerResponse collectPaymentForCustomer( - String customerId, CollectPaymentForCustomerParams params) throws Exception { - Response response = collectPaymentForCustomerRaw(customerId, params); - return CollectPaymentForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerCollectPaymentResponse collectPayment( + String customerId, CustomerCollectPaymentParams params) throws ChargebeeException { + Response response = collectPaymentRaw(customerId, params); + return CustomerCollectPaymentResponse.fromJson(response.getBodyAsString(), response); } - /** recordExcessPaymentForCustomer a customer (executes immediately) - returns raw Response. */ - Response recordExcessPaymentForCustomerRaw(String customerId) throws Exception { + /** recordExcessPayment a customer (executes immediately) - returns raw Response. */ + Response recordExcessPaymentRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/record_excess_payment", "customer-id", customerId); @@ -767,11 +764,11 @@ Response recordExcessPaymentForCustomerRaw(String customerId) throws Exception { } /** - * recordExcessPaymentForCustomer a customer using immutable params (executes immediately) - - * returns raw Response. + * recordExcessPayment a customer using immutable params (executes immediately) - returns raw + * Response. */ - Response recordExcessPaymentForCustomerRaw( - String customerId, RecordExcessPaymentForCustomerParams params) throws Exception { + Response recordExcessPaymentRaw(String customerId, CustomerRecordExcessPaymentParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/record_excess_payment", "customer-id", customerId); @@ -779,25 +776,24 @@ Response recordExcessPaymentForCustomerRaw( } /** - * recordExcessPaymentForCustomer a customer using raw JSON payload (executes immediately) - - * returns raw Response. + * recordExcessPayment a customer using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response recordExcessPaymentForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response recordExcessPaymentRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/record_excess_payment", "customer-id", customerId); return postJson(path, jsonPayload); } - public RecordExcessPaymentForCustomerResponse recordExcessPaymentForCustomer( - String customerId, RecordExcessPaymentForCustomerParams params) throws Exception { - Response response = recordExcessPaymentForCustomerRaw(customerId, params); - return RecordExcessPaymentForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerRecordExcessPaymentResponse recordExcessPayment( + String customerId, CustomerRecordExcessPaymentParams params) throws ChargebeeException { + Response response = recordExcessPaymentRaw(customerId, params); + return CustomerRecordExcessPaymentResponse.fromJson(response.getBodyAsString(), response); } - /** setPromotionalCreditsForCustomer a customer (executes immediately) - returns raw Response. */ - Response setPromotionalCreditsForCustomerRaw(String customerId) throws Exception { + /** setPromotionalCredits a customer (executes immediately) - returns raw Response. */ + Response setPromotionalCreditsRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/set_promotional_credits", "customer-id", customerId); @@ -806,11 +802,11 @@ Response setPromotionalCreditsForCustomerRaw(String customerId) throws Exception } /** - * setPromotionalCreditsForCustomer a customer using immutable params (executes immediately) - - * returns raw Response. + * setPromotionalCredits a customer using immutable params (executes immediately) - returns raw + * Response. */ - Response setPromotionalCreditsForCustomerRaw( - String customerId, SetPromotionalCreditsForCustomerParams params) throws Exception { + Response setPromotionalCreditsRaw(String customerId, CustomerSetPromotionalCreditsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/set_promotional_credits", "customer-id", customerId); @@ -818,25 +814,25 @@ Response setPromotionalCreditsForCustomerRaw( } /** - * setPromotionalCreditsForCustomer a customer using raw JSON payload (executes immediately) - - * returns raw Response. + * setPromotionalCredits a customer using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response setPromotionalCreditsForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response setPromotionalCreditsRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/set_promotional_credits", "customer-id", customerId); return postJson(path, jsonPayload); } - public SetPromotionalCreditsForCustomerResponse setPromotionalCreditsForCustomer( - String customerId, SetPromotionalCreditsForCustomerParams params) throws Exception { - Response response = setPromotionalCreditsForCustomerRaw(customerId, params); - return SetPromotionalCreditsForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerSetPromotionalCreditsResponse setPromotionalCredits( + String customerId, CustomerSetPromotionalCreditsParams params) throws ChargebeeException { + Response response = setPromotionalCreditsRaw(customerId, params); + return CustomerSetPromotionalCreditsResponse.fromJson(response.getBodyAsString(), response); } - /** updateContactForCustomer a customer (executes immediately) - returns raw Response. */ - Response updateContactForCustomerRaw(String customerId) throws Exception { + /** updateContact a customer (executes immediately) - returns raw Response. */ + Response updateContactRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/update_contact", "customer-id", customerId); @@ -844,36 +840,32 @@ Response updateContactForCustomerRaw(String customerId) throws Exception { } /** - * updateContactForCustomer a customer using immutable params (executes immediately) - returns raw - * Response. + * updateContact a customer using immutable params (executes immediately) - returns raw Response. */ - Response updateContactForCustomerRaw(String customerId, UpdateContactForCustomerParams params) - throws Exception { + Response updateContactRaw(String customerId, CustomerUpdateContactParams params) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/update_contact", "customer-id", customerId); return post(path, params.toFormData()); } /** - * updateContactForCustomer a customer using raw JSON payload (executes immediately) - returns raw - * Response. + * updateContact a customer using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateContactForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response updateContactRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/update_contact", "customer-id", customerId); return postJson(path, jsonPayload); } - public UpdateContactForCustomerResponse updateContactForCustomer( - String customerId, UpdateContactForCustomerParams params) throws Exception { - Response response = updateContactForCustomerRaw(customerId, params); - return UpdateContactForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerUpdateContactResponse updateContact( + String customerId, CustomerUpdateContactParams params) throws ChargebeeException { + Response response = updateContactRaw(customerId, params); + return CustomerUpdateContactResponse.fromJson(response.getBodyAsString(), response); } - /** - * updateHierarchySettingsForCustomer a customer (executes immediately) - returns raw Response. - */ - Response updateHierarchySettingsForCustomerRaw(String customerId) throws Exception { + /** updateHierarchySettings a customer (executes immediately) - returns raw Response. */ + Response updateHierarchySettingsRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/update_hierarchy_settings", "customer-id", customerId); @@ -882,11 +874,11 @@ Response updateHierarchySettingsForCustomerRaw(String customerId) throws Excepti } /** - * updateHierarchySettingsForCustomer a customer using immutable params (executes immediately) - - * returns raw Response. + * updateHierarchySettings a customer using immutable params (executes immediately) - returns raw + * Response. */ - Response updateHierarchySettingsForCustomerRaw( - String customerId, UpdateHierarchySettingsForCustomerParams params) throws Exception { + Response updateHierarchySettingsRaw( + String customerId, CustomerUpdateHierarchySettingsParams params) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/update_hierarchy_settings", "customer-id", customerId); @@ -894,26 +886,25 @@ Response updateHierarchySettingsForCustomerRaw( } /** - * updateHierarchySettingsForCustomer a customer using raw JSON payload (executes immediately) - - * returns raw Response. + * updateHierarchySettings a customer using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response updateHierarchySettingsForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response updateHierarchySettingsRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/update_hierarchy_settings", "customer-id", customerId); return postJson(path, jsonPayload); } - public UpdateHierarchySettingsForCustomerResponse updateHierarchySettingsForCustomer( - String customerId, UpdateHierarchySettingsForCustomerParams params) throws Exception { - Response response = updateHierarchySettingsForCustomerRaw(customerId, params); - return UpdateHierarchySettingsForCustomerResponse.fromJson( - response.getBodyAsString(), response); + public CustomerUpdateHierarchySettingsResponse updateHierarchySettings( + String customerId, CustomerUpdateHierarchySettingsParams params) throws ChargebeeException { + Response response = updateHierarchySettingsRaw(customerId, params); + return CustomerUpdateHierarchySettingsResponse.fromJson(response.getBodyAsString(), response); } - /** updateBillingInfoForCustomer a customer (executes immediately) - returns raw Response. */ - Response updateBillingInfoForCustomerRaw(String customerId) throws Exception { + /** updateBillingInfo a customer (executes immediately) - returns raw Response. */ + Response updateBillingInfoRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/update_billing_info", "customer-id", customerId); @@ -922,11 +913,11 @@ Response updateBillingInfoForCustomerRaw(String customerId) throws Exception { } /** - * updateBillingInfoForCustomer a customer using immutable params (executes immediately) - returns - * raw Response. + * updateBillingInfo a customer using immutable params (executes immediately) - returns raw + * Response. */ - Response updateBillingInfoForCustomerRaw( - String customerId, UpdateBillingInfoForCustomerParams params) throws Exception { + Response updateBillingInfoRaw(String customerId, CustomerUpdateBillingInfoParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/update_billing_info", "customer-id", customerId); @@ -934,19 +925,19 @@ Response updateBillingInfoForCustomerRaw( } /** - * updateBillingInfoForCustomer a customer using raw JSON payload (executes immediately) - returns - * raw Response. + * updateBillingInfo a customer using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response updateBillingInfoForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response updateBillingInfoRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/update_billing_info", "customer-id", customerId); return postJson(path, jsonPayload); } - public UpdateBillingInfoForCustomerResponse updateBillingInfoForCustomer( - String customerId, UpdateBillingInfoForCustomerParams params) throws Exception { - Response response = updateBillingInfoForCustomerRaw(customerId, params); - return UpdateBillingInfoForCustomerResponse.fromJson(response.getBodyAsString(), response); + public CustomerUpdateBillingInfoResponse updateBillingInfo( + String customerId, CustomerUpdateBillingInfoParams params) throws ChargebeeException { + Response response = updateBillingInfoRaw(customerId, params); + return CustomerUpdateBillingInfoResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java b/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java index 8ebc503b..5d9884a8 100644 --- a/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java +++ b/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java @@ -9,19 +9,22 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.differentialPrice.params.DeleteDifferentialPriceParams; +import com.chargebee.v4.models.differentialPrice.params.DifferentialPriceDeleteParams; -import com.chargebee.v4.models.differentialPrice.params.AddDifferentialPriceForItemPriceParams; +import com.chargebee.v4.models.differentialPrice.params.DifferentialPriceCreateParams; import com.chargebee.v4.models.differentialPrice.params.DifferentialPriceListParams; +import com.chargebee.v4.models.differentialPrice.params.DifferentialPriceRetrieveParams; + import com.chargebee.v4.models.differentialPrice.params.DifferentialPriceUpdateParams; -import com.chargebee.v4.models.differentialPrice.responses.DeleteDifferentialPriceResponse; +import com.chargebee.v4.models.differentialPrice.responses.DifferentialPriceDeleteResponse; -import com.chargebee.v4.models.differentialPrice.responses.AddDifferentialPriceForItemPriceResponse; +import com.chargebee.v4.models.differentialPrice.responses.DifferentialPriceCreateResponse; import com.chargebee.v4.models.differentialPrice.responses.DifferentialPriceListResponse; @@ -64,8 +67,8 @@ public DifferentialPriceService withOptions(RequestOptions options) { // === Operations === - /** deleteDifferentialPrice a differentialPrice (executes immediately) - returns raw Response. */ - Response deleteDifferentialPriceRaw(String differentialPriceId) throws Exception { + /** delete a differentialPrice (executes immediately) - returns raw Response. */ + Response deleteRaw(String differentialPriceId) throws ChargebeeException { String path = buildPathWithParams( "/differential_prices/{differential-price-id}/delete", @@ -76,11 +79,11 @@ Response deleteDifferentialPriceRaw(String differentialPriceId) throws Exception } /** - * deleteDifferentialPrice a differentialPrice using immutable params (executes immediately) - - * returns raw Response. + * delete a differentialPrice using immutable params (executes immediately) - returns raw + * Response. */ - Response deleteDifferentialPriceRaw( - String differentialPriceId, DeleteDifferentialPriceParams params) throws Exception { + Response deleteRaw(String differentialPriceId, DifferentialPriceDeleteParams params) + throws ChargebeeException { String path = buildPathWithParams( "/differential_prices/{differential-price-id}/delete", @@ -90,11 +93,10 @@ Response deleteDifferentialPriceRaw( } /** - * deleteDifferentialPrice a differentialPrice using raw JSON payload (executes immediately) - - * returns raw Response. + * delete a differentialPrice using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response deleteDifferentialPriceRaw(String differentialPriceId, String jsonPayload) - throws Exception { + Response deleteRaw(String differentialPriceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/differential_prices/{differential-price-id}/delete", @@ -103,17 +105,14 @@ Response deleteDifferentialPriceRaw(String differentialPriceId, String jsonPaylo return postJson(path, jsonPayload); } - public DeleteDifferentialPriceResponse deleteDifferentialPrice( - String differentialPriceId, DeleteDifferentialPriceParams params) throws Exception { - Response response = deleteDifferentialPriceRaw(differentialPriceId, params); - return DeleteDifferentialPriceResponse.fromJson(response.getBodyAsString(), response); + public DifferentialPriceDeleteResponse delete( + String differentialPriceId, DifferentialPriceDeleteParams params) throws ChargebeeException { + Response response = deleteRaw(differentialPriceId, params); + return DifferentialPriceDeleteResponse.fromJson(response.getBodyAsString(), response); } - /** - * addDifferentialPriceForItemPrice a differentialPrice (executes immediately) - returns raw - * Response. - */ - Response addDifferentialPriceForItemPriceRaw(String itemPriceId) throws Exception { + /** create a differentialPrice (executes immediately) - returns raw Response. */ + Response createRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams( "/item_prices/{item-price-id}/differential_prices", "item-price-id", itemPriceId); @@ -122,11 +121,11 @@ Response addDifferentialPriceForItemPriceRaw(String itemPriceId) throws Exceptio } /** - * addDifferentialPriceForItemPrice a differentialPrice using immutable params (executes - * immediately) - returns raw Response. + * create a differentialPrice using immutable params (executes immediately) - returns raw + * Response. */ - Response addDifferentialPriceForItemPriceRaw( - String itemPriceId, AddDifferentialPriceForItemPriceParams params) throws Exception { + Response createRaw(String itemPriceId, DifferentialPriceCreateParams params) + throws ChargebeeException { String path = buildPathWithParams( "/item_prices/{item-price-id}/differential_prices", "item-price-id", itemPriceId); @@ -134,33 +133,32 @@ Response addDifferentialPriceForItemPriceRaw( } /** - * addDifferentialPriceForItemPrice a differentialPrice using raw JSON payload (executes - * immediately) - returns raw Response. + * create a differentialPrice using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response addDifferentialPriceForItemPriceRaw(String itemPriceId, String jsonPayload) - throws Exception { + Response createRaw(String itemPriceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/item_prices/{item-price-id}/differential_prices", "item-price-id", itemPriceId); return postJson(path, jsonPayload); } - public AddDifferentialPriceForItemPriceResponse addDifferentialPriceForItemPrice( - String itemPriceId, AddDifferentialPriceForItemPriceParams params) throws Exception { - Response response = addDifferentialPriceForItemPriceRaw(itemPriceId, params); - return AddDifferentialPriceForItemPriceResponse.fromJson(response.getBodyAsString(), response); + public DifferentialPriceCreateResponse create( + String itemPriceId, DifferentialPriceCreateParams params) throws ChargebeeException { + Response response = createRaw(itemPriceId, params); + return DifferentialPriceCreateResponse.fromJson(response.getBodyAsString(), response); } /** * list a differentialPrice using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(DifferentialPriceListParams params) throws Exception { + Response listRaw(DifferentialPriceListParams params) throws ChargebeeException { return get("/differential_prices", params != null ? params.toQueryParams() : null); } /** list a differentialPrice without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/differential_prices", null); } @@ -168,25 +166,26 @@ Response listRaw() throws Exception { /** * list a differentialPrice using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public DifferentialPriceListResponse list(DifferentialPriceListParams params) throws Exception { + public DifferentialPriceListResponse list(DifferentialPriceListParams params) + throws ChargebeeException { Response response = listRaw(params); return DifferentialPriceListResponse.fromJson( response.getBodyAsString(), this, params, response); } - public DifferentialPriceListResponse list() throws Exception { + public DifferentialPriceListResponse list() throws ChargebeeException { Response response = listRaw(); return DifferentialPriceListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** retrieve a differentialPrice (executes immediately) - returns raw Response. */ - Response retrieveRaw(String differentialPriceId) throws Exception { + Response retrieveRaw(String differentialPriceId) throws ChargebeeException { String path = buildPathWithParams( "/differential_prices/{differential-price-id}", @@ -196,13 +195,35 @@ Response retrieveRaw(String differentialPriceId) throws Exception { return get(path, null); } - public DifferentialPriceRetrieveResponse retrieve(String differentialPriceId) throws Exception { + /** + * retrieve a differentialPrice using immutable params (executes immediately) - returns raw + * Response. + */ + Response retrieveRaw(String differentialPriceId, DifferentialPriceRetrieveParams params) + throws ChargebeeException { + String path = + buildPathWithParams( + "/differential_prices/{differential-price-id}", + "differential-price-id", + differentialPriceId); + return get(path, params != null ? params.toQueryParams() : null); + } + + public DifferentialPriceRetrieveResponse retrieve( + String differentialPriceId, DifferentialPriceRetrieveParams params) + throws ChargebeeException { + Response response = retrieveRaw(differentialPriceId, params); + return DifferentialPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); + } + + public DifferentialPriceRetrieveResponse retrieve(String differentialPriceId) + throws ChargebeeException { Response response = retrieveRaw(differentialPriceId); return DifferentialPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a differentialPrice (executes immediately) - returns raw Response. */ - Response updateRaw(String differentialPriceId) throws Exception { + Response updateRaw(String differentialPriceId) throws ChargebeeException { String path = buildPathWithParams( "/differential_prices/{differential-price-id}", @@ -217,7 +238,7 @@ Response updateRaw(String differentialPriceId) throws Exception { * Response. */ Response updateRaw(String differentialPriceId, DifferentialPriceUpdateParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/differential_prices/{differential-price-id}", @@ -230,7 +251,7 @@ Response updateRaw(String differentialPriceId, DifferentialPriceUpdateParams par * update a differentialPrice using raw JSON payload (executes immediately) - returns raw * Response. */ - Response updateRaw(String differentialPriceId, String jsonPayload) throws Exception { + Response updateRaw(String differentialPriceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/differential_prices/{differential-price-id}", @@ -240,7 +261,7 @@ Response updateRaw(String differentialPriceId, String jsonPayload) throws Except } public DifferentialPriceUpdateResponse update( - String differentialPriceId, DifferentialPriceUpdateParams params) throws Exception { + String differentialPriceId, DifferentialPriceUpdateParams params) throws ChargebeeException { Response response = updateRaw(differentialPriceId, params); return DifferentialPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } diff --git a/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java b/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java index 3ea82204..96428647 100644 --- a/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java +++ b/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java @@ -9,13 +9,14 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.entitlementOverride.params.EntitlementOverridesForSubscriptionParams; +import com.chargebee.v4.models.entitlementOverride.params.ListEntitlementOverrideForSubscriptionParams; import com.chargebee.v4.models.entitlementOverride.params.AddEntitlementOverrideForSubscriptionParams; -import com.chargebee.v4.models.entitlementOverride.responses.EntitlementOverridesForSubscriptionResponse; +import com.chargebee.v4.models.entitlementOverride.responses.ListEntitlementOverrideForSubscriptionResponse; import com.chargebee.v4.models.entitlementOverride.responses.AddEntitlementOverrideForSubscriptionResponse; @@ -55,11 +56,12 @@ public EntitlementOverrideService withOptions(RequestOptions options) { // === Operations === /** - * entitlementOverridesForSubscription a entitlementOverride using immutable params (executes + * listEntitlementOverrideForSubscription a entitlementOverride using immutable params (executes * immediately) - returns raw Response. */ - Response entitlementOverridesForSubscriptionRaw( - String subscriptionId, EntitlementOverridesForSubscriptionParams params) throws Exception { + Response listEntitlementOverrideForSubscriptionRaw( + String subscriptionId, ListEntitlementOverrideForSubscriptionParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/entitlement_overrides", @@ -69,10 +71,11 @@ Response entitlementOverridesForSubscriptionRaw( } /** - * entitlementOverridesForSubscription a entitlementOverride without params (executes immediately) - * - returns raw Response. + * listEntitlementOverrideForSubscription a entitlementOverride without params (executes + * immediately) - returns raw Response. */ - Response entitlementOverridesForSubscriptionRaw(String subscriptionId) throws Exception { + Response listEntitlementOverrideForSubscriptionRaw(String subscriptionId) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/entitlement_overrides", @@ -82,11 +85,11 @@ Response entitlementOverridesForSubscriptionRaw(String subscriptionId) throws Ex } /** - * entitlementOverridesForSubscription a entitlementOverride using raw JSON payload (executes + * listEntitlementOverrideForSubscription a entitlementOverride using raw JSON payload (executes * immediately) - returns raw Response. */ - Response entitlementOverridesForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response listEntitlementOverrideForSubscriptionRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/entitlement_overrides", @@ -95,17 +98,18 @@ Response entitlementOverridesForSubscriptionRaw(String subscriptionId, String js throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public EntitlementOverridesForSubscriptionResponse entitlementOverridesForSubscription( - String subscriptionId, EntitlementOverridesForSubscriptionParams params) throws Exception { - Response response = entitlementOverridesForSubscriptionRaw(subscriptionId, params); - return EntitlementOverridesForSubscriptionResponse.fromJson( + public ListEntitlementOverrideForSubscriptionResponse listEntitlementOverrideForSubscription( + String subscriptionId, ListEntitlementOverrideForSubscriptionParams params) + throws ChargebeeException { + Response response = listEntitlementOverrideForSubscriptionRaw(subscriptionId, params); + return ListEntitlementOverrideForSubscriptionResponse.fromJson( response.getBodyAsString(), this, params, subscriptionId, response); } - public EntitlementOverridesForSubscriptionResponse entitlementOverridesForSubscription( - String subscriptionId) throws Exception { - Response response = entitlementOverridesForSubscriptionRaw(subscriptionId); - return EntitlementOverridesForSubscriptionResponse.fromJson( + public ListEntitlementOverrideForSubscriptionResponse listEntitlementOverrideForSubscription( + String subscriptionId) throws ChargebeeException { + Response response = listEntitlementOverrideForSubscriptionRaw(subscriptionId); + return ListEntitlementOverrideForSubscriptionResponse.fromJson( response.getBodyAsString(), this, null, subscriptionId, response); } @@ -113,7 +117,8 @@ public EntitlementOverridesForSubscriptionResponse entitlementOverridesForSubscr * addEntitlementOverrideForSubscription a entitlementOverride (executes immediately) - returns * raw Response. */ - Response addEntitlementOverrideForSubscriptionRaw(String subscriptionId) throws Exception { + Response addEntitlementOverrideForSubscriptionRaw(String subscriptionId) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/entitlement_overrides", @@ -128,7 +133,8 @@ Response addEntitlementOverrideForSubscriptionRaw(String subscriptionId) throws * immediately) - returns raw Response. */ Response addEntitlementOverrideForSubscriptionRaw( - String subscriptionId, AddEntitlementOverrideForSubscriptionParams params) throws Exception { + String subscriptionId, AddEntitlementOverrideForSubscriptionParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/entitlement_overrides", @@ -142,7 +148,7 @@ Response addEntitlementOverrideForSubscriptionRaw( * immediately) - returns raw Response. */ Response addEntitlementOverrideForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/entitlement_overrides", @@ -152,7 +158,8 @@ Response addEntitlementOverrideForSubscriptionRaw(String subscriptionId, String } public AddEntitlementOverrideForSubscriptionResponse addEntitlementOverrideForSubscription( - String subscriptionId, AddEntitlementOverrideForSubscriptionParams params) throws Exception { + String subscriptionId, AddEntitlementOverrideForSubscriptionParams params) + throws ChargebeeException { Response response = addEntitlementOverrideForSubscriptionRaw(subscriptionId, params); return AddEntitlementOverrideForSubscriptionResponse.fromJson( response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/EntitlementService.java b/src/main/java/com/chargebee/v4/services/EntitlementService.java index 519e48e1..d1dac0b8 100644 --- a/src/main/java/com/chargebee/v4/services/EntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/EntitlementService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.entitlement.params.EntitlementListParams; @@ -54,47 +55,48 @@ public EntitlementService withOptions(RequestOptions options) { // === Operations === /** list a entitlement using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(EntitlementListParams params) throws Exception { + Response listRaw(EntitlementListParams params) throws ChargebeeException { return get("/entitlements", params != null ? params.toQueryParams() : null); } /** list a entitlement without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/entitlements", null); } /** list a entitlement using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public EntitlementListResponse list(EntitlementListParams params) throws Exception { + public EntitlementListResponse list(EntitlementListParams params) throws ChargebeeException { Response response = listRaw(params); return EntitlementListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public EntitlementListResponse list() throws Exception { + public EntitlementListResponse list() throws ChargebeeException { Response response = listRaw(); return EntitlementListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a entitlement using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(EntitlementCreateParams params) throws Exception { + Response createRaw(EntitlementCreateParams params) throws ChargebeeException { return post("/entitlements", params != null ? params.toFormData() : null); } /** create a entitlement using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/entitlements", jsonPayload); } - public EntitlementCreateResponse create(EntitlementCreateParams params) throws Exception { + public EntitlementCreateResponse create(EntitlementCreateParams params) + throws ChargebeeException { Response response = createRaw(params); return EntitlementCreateResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/EstimateService.java b/src/main/java/com/chargebee/v4/services/EstimateService.java index 33c06ae9..3ec4de4a 100644 --- a/src/main/java/com/chargebee/v4/services/EstimateService.java +++ b/src/main/java/com/chargebee/v4/services/EstimateService.java @@ -9,15 +9,18 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.estimate.params.EstimateCreateSubscriptionForItemsParams; +import com.chargebee.v4.models.estimate.params.RenewalEstimateParams; + +import com.chargebee.v4.models.estimate.params.CreateSubscriptionItemEstimateParams; import com.chargebee.v4.models.estimate.params.EstimatePaymentSchedulesParams; -import com.chargebee.v4.models.estimate.params.CancelSubscriptionForItemsEstimateForSubscriptionParams; +import com.chargebee.v4.models.estimate.params.EstimateCancelSubscriptionForItemsParams; -import com.chargebee.v4.models.estimate.params.ResumeSubscriptionEstimateForSubscriptionParams; +import com.chargebee.v4.models.estimate.params.EstimateResumeSubscriptionParams; import com.chargebee.v4.models.estimate.params.EstimateCreateInvoiceForItemsParams; @@ -25,35 +28,37 @@ import com.chargebee.v4.models.estimate.params.EstimateUpdateSubscriptionForItemsParams; -import com.chargebee.v4.models.estimate.params.RegenerateInvoiceEstimateForSubscriptionParams; +import com.chargebee.v4.models.estimate.params.RegenerateInvoiceEstimateParams; -import com.chargebee.v4.models.estimate.params.CreateSubscriptionForItemsEstimateForCustomerParams; +import com.chargebee.v4.models.estimate.params.CreateSubscriptionItemForCustomerEstimateParams; -import com.chargebee.v4.models.estimate.params.ChangeTermEndEstimateForSubscriptionParams; +import com.chargebee.v4.models.estimate.params.EstimateChangeTermEndParams; -import com.chargebee.v4.models.estimate.params.PauseSubscriptionEstimateForSubscriptionParams; +import com.chargebee.v4.models.estimate.params.EstimatePauseSubscriptionParams; -import com.chargebee.v4.models.estimate.params.AdvanceInvoiceEstimateForSubscriptionParams; +import com.chargebee.v4.models.estimate.params.AdvanceInvoiceEstimateParams; import com.chargebee.v4.models.estimate.params.EstimateUpdateSubscriptionParams; import com.chargebee.v4.models.estimate.params.EstimateGiftSubscriptionParams; +import com.chargebee.v4.models.estimate.params.CreateSubscriptionForCustomerEstimateParams; + import com.chargebee.v4.models.estimate.params.EstimateCreateSubscriptionParams; import com.chargebee.v4.models.estimate.params.EstimateCreateInvoiceParams; -import com.chargebee.v4.models.estimate.params.CancelSubscriptionEstimateForSubscriptionParams; +import com.chargebee.v4.models.estimate.params.EstimateCancelSubscriptionParams; -import com.chargebee.v4.models.estimate.responses.RenewalEstimateForSubscriptionResponse; +import com.chargebee.v4.models.estimate.responses.RenewalEstimateResponse; -import com.chargebee.v4.models.estimate.responses.EstimateCreateSubscriptionForItemsResponse; +import com.chargebee.v4.models.estimate.responses.CreateSubscriptionItemEstimateResponse; import com.chargebee.v4.models.estimate.responses.EstimatePaymentSchedulesResponse; -import com.chargebee.v4.models.estimate.responses.CancelSubscriptionForItemsEstimateForSubscriptionResponse; +import com.chargebee.v4.models.estimate.responses.EstimateCancelSubscriptionForItemsResponse; -import com.chargebee.v4.models.estimate.responses.ResumeSubscriptionEstimateForSubscriptionResponse; +import com.chargebee.v4.models.estimate.responses.EstimateResumeSubscriptionResponse; import com.chargebee.v4.models.estimate.responses.EstimateCreateInvoiceForItemsResponse; @@ -61,29 +66,29 @@ import com.chargebee.v4.models.estimate.responses.EstimateUpdateSubscriptionForItemsResponse; -import com.chargebee.v4.models.estimate.responses.UpcomingInvoicesEstimateForCustomerResponse; +import com.chargebee.v4.models.estimate.responses.UpcomingInvoicesEstimateResponse; -import com.chargebee.v4.models.estimate.responses.RegenerateInvoiceEstimateForSubscriptionResponse; +import com.chargebee.v4.models.estimate.responses.RegenerateInvoiceEstimateResponse; -import com.chargebee.v4.models.estimate.responses.CreateSubscriptionForItemsEstimateForCustomerResponse; +import com.chargebee.v4.models.estimate.responses.CreateSubscriptionItemForCustomerEstimateResponse; -import com.chargebee.v4.models.estimate.responses.ChangeTermEndEstimateForSubscriptionResponse; +import com.chargebee.v4.models.estimate.responses.EstimateChangeTermEndResponse; -import com.chargebee.v4.models.estimate.responses.PauseSubscriptionEstimateForSubscriptionResponse; +import com.chargebee.v4.models.estimate.responses.EstimatePauseSubscriptionResponse; -import com.chargebee.v4.models.estimate.responses.AdvanceInvoiceEstimateForSubscriptionResponse; +import com.chargebee.v4.models.estimate.responses.AdvanceInvoiceEstimateResponse; import com.chargebee.v4.models.estimate.responses.EstimateUpdateSubscriptionResponse; import com.chargebee.v4.models.estimate.responses.EstimateGiftSubscriptionResponse; -import com.chargebee.v4.models.estimate.responses.CreateSubscriptionEstimateForCustomerResponse; +import com.chargebee.v4.models.estimate.responses.CreateSubscriptionForCustomerEstimateResponse; import com.chargebee.v4.models.estimate.responses.EstimateCreateSubscriptionResponse; import com.chargebee.v4.models.estimate.responses.EstimateCreateInvoiceResponse; -import com.chargebee.v4.models.estimate.responses.CancelSubscriptionEstimateForSubscriptionResponse; +import com.chargebee.v4.models.estimate.responses.EstimateCancelSubscriptionResponse; public final class EstimateService extends BaseService { @@ -119,8 +124,8 @@ public EstimateService withOptions(RequestOptions options) { // === Operations === - /** renewalEstimateForSubscription a estimate (executes immediately) - returns raw Response. */ - Response renewalEstimateForSubscriptionRaw(String subscriptionId) throws Exception { + /** renewalEstimate a estimate (executes immediately) - returns raw Response. */ + Response renewalEstimateRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/renewal_estimate", "subscription-id", subscriptionId); @@ -128,45 +133,61 @@ Response renewalEstimateForSubscriptionRaw(String subscriptionId) throws Excepti return get(path, null); } - public RenewalEstimateForSubscriptionResponse renewalEstimateForSubscription( - String subscriptionId) throws Exception { - Response response = renewalEstimateForSubscriptionRaw(subscriptionId); - return RenewalEstimateForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + /** + * renewalEstimate a estimate using immutable params (executes immediately) - returns raw + * Response. + */ + Response renewalEstimateRaw(String subscriptionId, RenewalEstimateParams params) + throws ChargebeeException { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/renewal_estimate", "subscription-id", subscriptionId); + return get(path, params != null ? params.toQueryParams() : null); + } + + public RenewalEstimateResponse renewalEstimate( + String subscriptionId, RenewalEstimateParams params) throws ChargebeeException { + Response response = renewalEstimateRaw(subscriptionId, params); + return RenewalEstimateResponse.fromJson(response.getBodyAsString(), response); + } + + public RenewalEstimateResponse renewalEstimate(String subscriptionId) throws ChargebeeException { + Response response = renewalEstimateRaw(subscriptionId); + return RenewalEstimateResponse.fromJson(response.getBodyAsString(), response); } /** - * createSubscriptionForItems a estimate using immutable params (executes immediately) - returns - * raw Response. + * createSubscriptionItemEstimate a estimate using immutable params (executes immediately) - + * returns raw Response. */ - Response createSubscriptionForItemsRaw(EstimateCreateSubscriptionForItemsParams params) - throws Exception { + Response createSubscriptionItemEstimateRaw(CreateSubscriptionItemEstimateParams params) + throws ChargebeeException { return post( "/estimates/create_subscription_for_items", params != null ? params.toFormData() : null); } /** - * createSubscriptionForItems a estimate using raw JSON payload (executes immediately) - returns - * raw Response. + * createSubscriptionItemEstimate a estimate using raw JSON payload (executes immediately) - + * returns raw Response. */ - Response createSubscriptionForItemsRaw(String jsonPayload) throws Exception { + Response createSubscriptionItemEstimateRaw(String jsonPayload) throws ChargebeeException { return postJson("/estimates/create_subscription_for_items", jsonPayload); } - public EstimateCreateSubscriptionForItemsResponse createSubscriptionForItems( - EstimateCreateSubscriptionForItemsParams params) throws Exception { - Response response = createSubscriptionForItemsRaw(params); + public CreateSubscriptionItemEstimateResponse createSubscriptionItemEstimate( + CreateSubscriptionItemEstimateParams params) throws ChargebeeException { + Response response = createSubscriptionItemEstimateRaw(params); - return EstimateCreateSubscriptionForItemsResponse.fromJson( - response.getBodyAsString(), response); + return CreateSubscriptionItemEstimateResponse.fromJson(response.getBodyAsString(), response); } /** * paymentSchedules a estimate using immutable params (executes immediately) - returns raw * Response. */ - Response paymentSchedulesRaw(EstimatePaymentSchedulesParams params) throws Exception { + Response paymentSchedulesRaw(EstimatePaymentSchedulesParams params) throws ChargebeeException { return post("/estimates/payment_schedules", params != null ? params.toFormData() : null); } @@ -175,24 +196,20 @@ Response paymentSchedulesRaw(EstimatePaymentSchedulesParams params) throws Excep * paymentSchedules a estimate using raw JSON payload (executes immediately) - returns raw * Response. */ - Response paymentSchedulesRaw(String jsonPayload) throws Exception { + Response paymentSchedulesRaw(String jsonPayload) throws ChargebeeException { return postJson("/estimates/payment_schedules", jsonPayload); } public EstimatePaymentSchedulesResponse paymentSchedules(EstimatePaymentSchedulesParams params) - throws Exception { + throws ChargebeeException { Response response = paymentSchedulesRaw(params); return EstimatePaymentSchedulesResponse.fromJson(response.getBodyAsString(), response); } - /** - * cancelSubscriptionForItemsEstimateForSubscription a estimate (executes immediately) - returns - * raw Response. - */ - Response cancelSubscriptionForItemsEstimateForSubscriptionRaw(String subscriptionId) - throws Exception { + /** cancelSubscriptionForItems a estimate (executes immediately) - returns raw Response. */ + Response cancelSubscriptionForItemsRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_subscription_for_items_estimate", @@ -203,12 +220,12 @@ Response cancelSubscriptionForItemsEstimateForSubscriptionRaw(String subscriptio } /** - * cancelSubscriptionForItemsEstimateForSubscription a estimate using immutable params (executes - * immediately) - returns raw Response. + * cancelSubscriptionForItems a estimate using immutable params (executes immediately) - returns + * raw Response. */ - Response cancelSubscriptionForItemsEstimateForSubscriptionRaw( - String subscriptionId, CancelSubscriptionForItemsEstimateForSubscriptionParams params) - throws Exception { + Response cancelSubscriptionForItemsRaw( + String subscriptionId, EstimateCancelSubscriptionForItemsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_subscription_for_items_estimate", @@ -218,11 +235,11 @@ Response cancelSubscriptionForItemsEstimateForSubscriptionRaw( } /** - * cancelSubscriptionForItemsEstimateForSubscription a estimate using raw JSON payload (executes - * immediately) - returns raw Response. + * cancelSubscriptionForItems a estimate using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response cancelSubscriptionForItemsEstimateForSubscriptionRaw( - String subscriptionId, String jsonPayload) throws Exception { + Response cancelSubscriptionForItemsRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_subscription_for_items_estimate", @@ -231,21 +248,16 @@ Response cancelSubscriptionForItemsEstimateForSubscriptionRaw( return postJson(path, jsonPayload); } - public CancelSubscriptionForItemsEstimateForSubscriptionResponse - cancelSubscriptionForItemsEstimateForSubscription( - String subscriptionId, CancelSubscriptionForItemsEstimateForSubscriptionParams params) - throws Exception { - Response response = - cancelSubscriptionForItemsEstimateForSubscriptionRaw(subscriptionId, params); - return CancelSubscriptionForItemsEstimateForSubscriptionResponse.fromJson( + public EstimateCancelSubscriptionForItemsResponse cancelSubscriptionForItems( + String subscriptionId, EstimateCancelSubscriptionForItemsParams params) + throws ChargebeeException { + Response response = cancelSubscriptionForItemsRaw(subscriptionId, params); + return EstimateCancelSubscriptionForItemsResponse.fromJson( response.getBodyAsString(), response); } - /** - * resumeSubscriptionEstimateForSubscription a estimate (executes immediately) - returns raw - * Response. - */ - Response resumeSubscriptionEstimateForSubscriptionRaw(String subscriptionId) throws Exception { + /** resumeSubscription a estimate (executes immediately) - returns raw Response. */ + Response resumeSubscriptionRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/resume_subscription_estimate", @@ -256,12 +268,11 @@ Response resumeSubscriptionEstimateForSubscriptionRaw(String subscriptionId) thr } /** - * resumeSubscriptionEstimateForSubscription a estimate using immutable params (executes - * immediately) - returns raw Response. + * resumeSubscription a estimate using immutable params (executes immediately) - returns raw + * Response. */ - Response resumeSubscriptionEstimateForSubscriptionRaw( - String subscriptionId, ResumeSubscriptionEstimateForSubscriptionParams params) - throws Exception { + Response resumeSubscriptionRaw(String subscriptionId, EstimateResumeSubscriptionParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/resume_subscription_estimate", @@ -271,11 +282,11 @@ Response resumeSubscriptionEstimateForSubscriptionRaw( } /** - * resumeSubscriptionEstimateForSubscription a estimate using raw JSON payload (executes - * immediately) - returns raw Response. + * resumeSubscription a estimate using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response resumeSubscriptionEstimateForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response resumeSubscriptionRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/resume_subscription_estimate", @@ -284,20 +295,18 @@ Response resumeSubscriptionEstimateForSubscriptionRaw(String subscriptionId, Str return postJson(path, jsonPayload); } - public ResumeSubscriptionEstimateForSubscriptionResponse - resumeSubscriptionEstimateForSubscription( - String subscriptionId, ResumeSubscriptionEstimateForSubscriptionParams params) - throws Exception { - Response response = resumeSubscriptionEstimateForSubscriptionRaw(subscriptionId, params); - return ResumeSubscriptionEstimateForSubscriptionResponse.fromJson( - response.getBodyAsString(), response); + public EstimateResumeSubscriptionResponse resumeSubscription( + String subscriptionId, EstimateResumeSubscriptionParams params) throws ChargebeeException { + Response response = resumeSubscriptionRaw(subscriptionId, params); + return EstimateResumeSubscriptionResponse.fromJson(response.getBodyAsString(), response); } /** * createInvoiceForItems a estimate using immutable params (executes immediately) - returns raw * Response. */ - Response createInvoiceForItemsRaw(EstimateCreateInvoiceForItemsParams params) throws Exception { + Response createInvoiceForItemsRaw(EstimateCreateInvoiceForItemsParams params) + throws ChargebeeException { return post("/estimates/create_invoice_for_items", params != null ? params.toFormData() : null); } @@ -306,13 +315,13 @@ Response createInvoiceForItemsRaw(EstimateCreateInvoiceForItemsParams params) th * createInvoiceForItems a estimate using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createInvoiceForItemsRaw(String jsonPayload) throws Exception { + Response createInvoiceForItemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/estimates/create_invoice_for_items", jsonPayload); } public EstimateCreateInvoiceForItemsResponse createInvoiceForItems( - EstimateCreateInvoiceForItemsParams params) throws Exception { + EstimateCreateInvoiceForItemsParams params) throws ChargebeeException { Response response = createInvoiceForItemsRaw(params); return EstimateCreateInvoiceForItemsResponse.fromJson(response.getBodyAsString(), response); @@ -323,7 +332,7 @@ public EstimateCreateInvoiceForItemsResponse createInvoiceForItems( * Response. */ Response giftSubscriptionForItemsRaw(EstimateGiftSubscriptionForItemsParams params) - throws Exception { + throws ChargebeeException { return post( "/estimates/gift_subscription_for_items", params != null ? params.toFormData() : null); @@ -333,13 +342,13 @@ Response giftSubscriptionForItemsRaw(EstimateGiftSubscriptionForItemsParams para * giftSubscriptionForItems a estimate using raw JSON payload (executes immediately) - returns raw * Response. */ - Response giftSubscriptionForItemsRaw(String jsonPayload) throws Exception { + Response giftSubscriptionForItemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/estimates/gift_subscription_for_items", jsonPayload); } public EstimateGiftSubscriptionForItemsResponse giftSubscriptionForItems( - EstimateGiftSubscriptionForItemsParams params) throws Exception { + EstimateGiftSubscriptionForItemsParams params) throws ChargebeeException { Response response = giftSubscriptionForItemsRaw(params); return EstimateGiftSubscriptionForItemsResponse.fromJson(response.getBodyAsString(), response); @@ -350,7 +359,7 @@ public EstimateGiftSubscriptionForItemsResponse giftSubscriptionForItems( * raw Response. */ Response updateSubscriptionForItemsRaw(EstimateUpdateSubscriptionForItemsParams params) - throws Exception { + throws ChargebeeException { return post( "/estimates/update_subscription_for_items", params != null ? params.toFormData() : null); @@ -360,23 +369,21 @@ Response updateSubscriptionForItemsRaw(EstimateUpdateSubscriptionForItemsParams * updateSubscriptionForItems a estimate using raw JSON payload (executes immediately) - returns * raw Response. */ - Response updateSubscriptionForItemsRaw(String jsonPayload) throws Exception { + Response updateSubscriptionForItemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/estimates/update_subscription_for_items", jsonPayload); } public EstimateUpdateSubscriptionForItemsResponse updateSubscriptionForItems( - EstimateUpdateSubscriptionForItemsParams params) throws Exception { + EstimateUpdateSubscriptionForItemsParams params) throws ChargebeeException { Response response = updateSubscriptionForItemsRaw(params); return EstimateUpdateSubscriptionForItemsResponse.fromJson( response.getBodyAsString(), response); } - /** - * upcomingInvoicesEstimateForCustomer a estimate (executes immediately) - returns raw Response. - */ - Response upcomingInvoicesEstimateForCustomerRaw(String customerId) throws Exception { + /** upcomingInvoicesEstimate a estimate (executes immediately) - returns raw Response. */ + Response upcomingInvoicesEstimateRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/upcoming_invoices_estimate", "customer-id", customerId); @@ -384,18 +391,14 @@ Response upcomingInvoicesEstimateForCustomerRaw(String customerId) throws Except return get(path, null); } - public UpcomingInvoicesEstimateForCustomerResponse upcomingInvoicesEstimateForCustomer( - String customerId) throws Exception { - Response response = upcomingInvoicesEstimateForCustomerRaw(customerId); - return UpcomingInvoicesEstimateForCustomerResponse.fromJson( - response.getBodyAsString(), response); + public UpcomingInvoicesEstimateResponse upcomingInvoicesEstimate(String customerId) + throws ChargebeeException { + Response response = upcomingInvoicesEstimateRaw(customerId); + return UpcomingInvoicesEstimateResponse.fromJson(response.getBodyAsString(), response); } - /** - * regenerateInvoiceEstimateForSubscription a estimate (executes immediately) - returns raw - * Response. - */ - Response regenerateInvoiceEstimateForSubscriptionRaw(String subscriptionId) throws Exception { + /** regenerateInvoiceEstimate a estimate (executes immediately) - returns raw Response. */ + Response regenerateInvoiceEstimateRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/regenerate_invoice_estimate", @@ -406,12 +409,11 @@ Response regenerateInvoiceEstimateForSubscriptionRaw(String subscriptionId) thro } /** - * regenerateInvoiceEstimateForSubscription a estimate using immutable params (executes - * immediately) - returns raw Response. + * regenerateInvoiceEstimate a estimate using immutable params (executes immediately) - returns + * raw Response. */ - Response regenerateInvoiceEstimateForSubscriptionRaw( - String subscriptionId, RegenerateInvoiceEstimateForSubscriptionParams params) - throws Exception { + Response regenerateInvoiceEstimateRaw( + String subscriptionId, RegenerateInvoiceEstimateParams params) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/regenerate_invoice_estimate", @@ -421,11 +423,11 @@ Response regenerateInvoiceEstimateForSubscriptionRaw( } /** - * regenerateInvoiceEstimateForSubscription a estimate using raw JSON payload (executes - * immediately) - returns raw Response. + * regenerateInvoiceEstimate a estimate using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response regenerateInvoiceEstimateForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response regenerateInvoiceEstimateRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/regenerate_invoice_estimate", @@ -434,19 +436,18 @@ Response regenerateInvoiceEstimateForSubscriptionRaw(String subscriptionId, Stri return postJson(path, jsonPayload); } - public RegenerateInvoiceEstimateForSubscriptionResponse regenerateInvoiceEstimateForSubscription( - String subscriptionId, RegenerateInvoiceEstimateForSubscriptionParams params) - throws Exception { - Response response = regenerateInvoiceEstimateForSubscriptionRaw(subscriptionId, params); - return RegenerateInvoiceEstimateForSubscriptionResponse.fromJson( - response.getBodyAsString(), response); + public RegenerateInvoiceEstimateResponse regenerateInvoiceEstimate( + String subscriptionId, RegenerateInvoiceEstimateParams params) throws ChargebeeException { + Response response = regenerateInvoiceEstimateRaw(subscriptionId, params); + return RegenerateInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response); } /** - * createSubscriptionForItemsEstimateForCustomer a estimate (executes immediately) - returns raw + * createSubscriptionItemForCustomerEstimate a estimate (executes immediately) - returns raw * Response. */ - Response createSubscriptionForItemsEstimateForCustomerRaw(String customerId) throws Exception { + Response createSubscriptionItemForCustomerEstimateRaw(String customerId) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_for_items_estimate", @@ -457,12 +458,12 @@ Response createSubscriptionForItemsEstimateForCustomerRaw(String customerId) thr } /** - * createSubscriptionForItemsEstimateForCustomer a estimate using immutable params (executes + * createSubscriptionItemForCustomerEstimate a estimate using immutable params (executes * immediately) - returns raw Response. */ - Response createSubscriptionForItemsEstimateForCustomerRaw( - String customerId, CreateSubscriptionForItemsEstimateForCustomerParams params) - throws Exception { + Response createSubscriptionItemForCustomerEstimateRaw( + String customerId, CreateSubscriptionItemForCustomerEstimateParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_for_items_estimate", @@ -472,11 +473,11 @@ Response createSubscriptionForItemsEstimateForCustomerRaw( } /** - * createSubscriptionForItemsEstimateForCustomer a estimate using raw JSON payload (executes + * createSubscriptionItemForCustomerEstimate a estimate using raw JSON payload (executes * immediately) - returns raw Response. */ - Response createSubscriptionForItemsEstimateForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response createSubscriptionItemForCustomerEstimateRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_for_items_estimate", @@ -485,19 +486,17 @@ Response createSubscriptionForItemsEstimateForCustomerRaw(String customerId, Str return postJson(path, jsonPayload); } - public CreateSubscriptionForItemsEstimateForCustomerResponse - createSubscriptionForItemsEstimateForCustomer( - String customerId, CreateSubscriptionForItemsEstimateForCustomerParams params) - throws Exception { - Response response = createSubscriptionForItemsEstimateForCustomerRaw(customerId, params); - return CreateSubscriptionForItemsEstimateForCustomerResponse.fromJson( + public CreateSubscriptionItemForCustomerEstimateResponse + createSubscriptionItemForCustomerEstimate( + String customerId, CreateSubscriptionItemForCustomerEstimateParams params) + throws ChargebeeException { + Response response = createSubscriptionItemForCustomerEstimateRaw(customerId, params); + return CreateSubscriptionItemForCustomerEstimateResponse.fromJson( response.getBodyAsString(), response); } - /** - * changeTermEndEstimateForSubscription a estimate (executes immediately) - returns raw Response. - */ - Response changeTermEndEstimateForSubscriptionRaw(String subscriptionId) throws Exception { + /** changeTermEnd a estimate (executes immediately) - returns raw Response. */ + Response changeTermEndRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/change_term_end_estimate", @@ -508,11 +507,10 @@ Response changeTermEndEstimateForSubscriptionRaw(String subscriptionId) throws E } /** - * changeTermEndEstimateForSubscription a estimate using immutable params (executes immediately) - - * returns raw Response. + * changeTermEnd a estimate using immutable params (executes immediately) - returns raw Response. */ - Response changeTermEndEstimateForSubscriptionRaw( - String subscriptionId, ChangeTermEndEstimateForSubscriptionParams params) throws Exception { + Response changeTermEndRaw(String subscriptionId, EstimateChangeTermEndParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/change_term_end_estimate", @@ -522,11 +520,9 @@ Response changeTermEndEstimateForSubscriptionRaw( } /** - * changeTermEndEstimateForSubscription a estimate using raw JSON payload (executes immediately) - - * returns raw Response. + * changeTermEnd a estimate using raw JSON payload (executes immediately) - returns raw Response. */ - Response changeTermEndEstimateForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response changeTermEndRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/change_term_end_estimate", @@ -535,18 +531,14 @@ Response changeTermEndEstimateForSubscriptionRaw(String subscriptionId, String j return postJson(path, jsonPayload); } - public ChangeTermEndEstimateForSubscriptionResponse changeTermEndEstimateForSubscription( - String subscriptionId, ChangeTermEndEstimateForSubscriptionParams params) throws Exception { - Response response = changeTermEndEstimateForSubscriptionRaw(subscriptionId, params); - return ChangeTermEndEstimateForSubscriptionResponse.fromJson( - response.getBodyAsString(), response); + public EstimateChangeTermEndResponse changeTermEnd( + String subscriptionId, EstimateChangeTermEndParams params) throws ChargebeeException { + Response response = changeTermEndRaw(subscriptionId, params); + return EstimateChangeTermEndResponse.fromJson(response.getBodyAsString(), response); } - /** - * pauseSubscriptionEstimateForSubscription a estimate (executes immediately) - returns raw - * Response. - */ - Response pauseSubscriptionEstimateForSubscriptionRaw(String subscriptionId) throws Exception { + /** pauseSubscription a estimate (executes immediately) - returns raw Response. */ + Response pauseSubscriptionRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/pause_subscription_estimate", @@ -557,12 +549,11 @@ Response pauseSubscriptionEstimateForSubscriptionRaw(String subscriptionId) thro } /** - * pauseSubscriptionEstimateForSubscription a estimate using immutable params (executes - * immediately) - returns raw Response. + * pauseSubscription a estimate using immutable params (executes immediately) - returns raw + * Response. */ - Response pauseSubscriptionEstimateForSubscriptionRaw( - String subscriptionId, PauseSubscriptionEstimateForSubscriptionParams params) - throws Exception { + Response pauseSubscriptionRaw(String subscriptionId, EstimatePauseSubscriptionParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/pause_subscription_estimate", @@ -572,11 +563,11 @@ Response pauseSubscriptionEstimateForSubscriptionRaw( } /** - * pauseSubscriptionEstimateForSubscription a estimate using raw JSON payload (executes - * immediately) - returns raw Response. + * pauseSubscription a estimate using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response pauseSubscriptionEstimateForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response pauseSubscriptionRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/pause_subscription_estimate", @@ -585,18 +576,14 @@ Response pauseSubscriptionEstimateForSubscriptionRaw(String subscriptionId, Stri return postJson(path, jsonPayload); } - public PauseSubscriptionEstimateForSubscriptionResponse pauseSubscriptionEstimateForSubscription( - String subscriptionId, PauseSubscriptionEstimateForSubscriptionParams params) - throws Exception { - Response response = pauseSubscriptionEstimateForSubscriptionRaw(subscriptionId, params); - return PauseSubscriptionEstimateForSubscriptionResponse.fromJson( - response.getBodyAsString(), response); + public EstimatePauseSubscriptionResponse pauseSubscription( + String subscriptionId, EstimatePauseSubscriptionParams params) throws ChargebeeException { + Response response = pauseSubscriptionRaw(subscriptionId, params); + return EstimatePauseSubscriptionResponse.fromJson(response.getBodyAsString(), response); } - /** - * advanceInvoiceEstimateForSubscription a estimate (executes immediately) - returns raw Response. - */ - Response advanceInvoiceEstimateForSubscriptionRaw(String subscriptionId) throws Exception { + /** advanceInvoiceEstimate a estimate (executes immediately) - returns raw Response. */ + Response advanceInvoiceEstimateRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/advance_invoice_estimate", @@ -607,11 +594,11 @@ Response advanceInvoiceEstimateForSubscriptionRaw(String subscriptionId) throws } /** - * advanceInvoiceEstimateForSubscription a estimate using immutable params (executes immediately) - * - returns raw Response. + * advanceInvoiceEstimate a estimate using immutable params (executes immediately) - returns raw + * Response. */ - Response advanceInvoiceEstimateForSubscriptionRaw( - String subscriptionId, AdvanceInvoiceEstimateForSubscriptionParams params) throws Exception { + Response advanceInvoiceEstimateRaw(String subscriptionId, AdvanceInvoiceEstimateParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/advance_invoice_estimate", @@ -621,11 +608,11 @@ Response advanceInvoiceEstimateForSubscriptionRaw( } /** - * advanceInvoiceEstimateForSubscription a estimate using raw JSON payload (executes immediately) - * - returns raw Response. + * advanceInvoiceEstimate a estimate using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response advanceInvoiceEstimateForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response advanceInvoiceEstimateRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/advance_invoice_estimate", @@ -634,18 +621,18 @@ Response advanceInvoiceEstimateForSubscriptionRaw(String subscriptionId, String return postJson(path, jsonPayload); } - public AdvanceInvoiceEstimateForSubscriptionResponse advanceInvoiceEstimateForSubscription( - String subscriptionId, AdvanceInvoiceEstimateForSubscriptionParams params) throws Exception { - Response response = advanceInvoiceEstimateForSubscriptionRaw(subscriptionId, params); - return AdvanceInvoiceEstimateForSubscriptionResponse.fromJson( - response.getBodyAsString(), response); + public AdvanceInvoiceEstimateResponse advanceInvoiceEstimate( + String subscriptionId, AdvanceInvoiceEstimateParams params) throws ChargebeeException { + Response response = advanceInvoiceEstimateRaw(subscriptionId, params); + return AdvanceInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response); } /** * updateSubscription a estimate using immutable params (executes immediately) - returns raw * Response. */ - Response updateSubscriptionRaw(EstimateUpdateSubscriptionParams params) throws Exception { + Response updateSubscriptionRaw(EstimateUpdateSubscriptionParams params) + throws ChargebeeException { return post("/estimates/update_subscription", params != null ? params.toFormData() : null); } @@ -654,13 +641,13 @@ Response updateSubscriptionRaw(EstimateUpdateSubscriptionParams params) throws E * updateSubscription a estimate using raw JSON payload (executes immediately) - returns raw * Response. */ - Response updateSubscriptionRaw(String jsonPayload) throws Exception { + Response updateSubscriptionRaw(String jsonPayload) throws ChargebeeException { return postJson("/estimates/update_subscription", jsonPayload); } public EstimateUpdateSubscriptionResponse updateSubscription( - EstimateUpdateSubscriptionParams params) throws Exception { + EstimateUpdateSubscriptionParams params) throws ChargebeeException { Response response = updateSubscriptionRaw(params); return EstimateUpdateSubscriptionResponse.fromJson(response.getBodyAsString(), response); @@ -670,7 +657,7 @@ public EstimateUpdateSubscriptionResponse updateSubscription( * giftSubscription a estimate using immutable params (executes immediately) - returns raw * Response. */ - Response giftSubscriptionRaw(EstimateGiftSubscriptionParams params) throws Exception { + Response giftSubscriptionRaw(EstimateGiftSubscriptionParams params) throws ChargebeeException { return post("/estimates/gift_subscription", params != null ? params.toFormData() : null); } @@ -679,22 +666,22 @@ Response giftSubscriptionRaw(EstimateGiftSubscriptionParams params) throws Excep * giftSubscription a estimate using raw JSON payload (executes immediately) - returns raw * Response. */ - Response giftSubscriptionRaw(String jsonPayload) throws Exception { + Response giftSubscriptionRaw(String jsonPayload) throws ChargebeeException { return postJson("/estimates/gift_subscription", jsonPayload); } public EstimateGiftSubscriptionResponse giftSubscription(EstimateGiftSubscriptionParams params) - throws Exception { + throws ChargebeeException { Response response = giftSubscriptionRaw(params); return EstimateGiftSubscriptionResponse.fromJson(response.getBodyAsString(), response); } /** - * createSubscriptionEstimateForCustomer a estimate (executes immediately) - returns raw Response. + * createSubscriptionForCustomerEstimate a estimate (executes immediately) - returns raw Response. */ - Response createSubscriptionEstimateForCustomerRaw(String customerId) throws Exception { + Response createSubscriptionForCustomerEstimateRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_estimate", "customer-id", customerId); @@ -702,10 +689,31 @@ Response createSubscriptionEstimateForCustomerRaw(String customerId) throws Exce return get(path, null); } - public CreateSubscriptionEstimateForCustomerResponse createSubscriptionEstimateForCustomer( - String customerId) throws Exception { - Response response = createSubscriptionEstimateForCustomerRaw(customerId); - return CreateSubscriptionEstimateForCustomerResponse.fromJson( + /** + * createSubscriptionForCustomerEstimate a estimate using immutable params (executes immediately) + * - returns raw Response. + */ + Response createSubscriptionForCustomerEstimateRaw( + String customerId, CreateSubscriptionForCustomerEstimateParams params) + throws ChargebeeException { + String path = + buildPathWithParams( + "/customers/{customer-id}/create_subscription_estimate", "customer-id", customerId); + return get(path, params != null ? params.toQueryParams() : null); + } + + public CreateSubscriptionForCustomerEstimateResponse createSubscriptionForCustomerEstimate( + String customerId, CreateSubscriptionForCustomerEstimateParams params) + throws ChargebeeException { + Response response = createSubscriptionForCustomerEstimateRaw(customerId, params); + return CreateSubscriptionForCustomerEstimateResponse.fromJson( + response.getBodyAsString(), response); + } + + public CreateSubscriptionForCustomerEstimateResponse createSubscriptionForCustomerEstimate( + String customerId) throws ChargebeeException { + Response response = createSubscriptionForCustomerEstimateRaw(customerId); + return CreateSubscriptionForCustomerEstimateResponse.fromJson( response.getBodyAsString(), response); } @@ -713,7 +721,8 @@ public CreateSubscriptionEstimateForCustomerResponse createSubscriptionEstimateF * createSubscription a estimate using immutable params (executes immediately) - returns raw * Response. */ - Response createSubscriptionRaw(EstimateCreateSubscriptionParams params) throws Exception { + Response createSubscriptionRaw(EstimateCreateSubscriptionParams params) + throws ChargebeeException { return post("/estimates/create_subscription", params != null ? params.toFormData() : null); } @@ -722,13 +731,13 @@ Response createSubscriptionRaw(EstimateCreateSubscriptionParams params) throws E * createSubscription a estimate using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createSubscriptionRaw(String jsonPayload) throws Exception { + Response createSubscriptionRaw(String jsonPayload) throws ChargebeeException { return postJson("/estimates/create_subscription", jsonPayload); } public EstimateCreateSubscriptionResponse createSubscription( - EstimateCreateSubscriptionParams params) throws Exception { + EstimateCreateSubscriptionParams params) throws ChargebeeException { Response response = createSubscriptionRaw(params); return EstimateCreateSubscriptionResponse.fromJson(response.getBodyAsString(), response); @@ -737,7 +746,7 @@ public EstimateCreateSubscriptionResponse createSubscription( /** * createInvoice a estimate using immutable params (executes immediately) - returns raw Response. */ - Response createInvoiceRaw(EstimateCreateInvoiceParams params) throws Exception { + Response createInvoiceRaw(EstimateCreateInvoiceParams params) throws ChargebeeException { return post("/estimates/create_invoice", params != null ? params.toFormData() : null); } @@ -745,23 +754,20 @@ Response createInvoiceRaw(EstimateCreateInvoiceParams params) throws Exception { /** * createInvoice a estimate using raw JSON payload (executes immediately) - returns raw Response. */ - Response createInvoiceRaw(String jsonPayload) throws Exception { + Response createInvoiceRaw(String jsonPayload) throws ChargebeeException { return postJson("/estimates/create_invoice", jsonPayload); } public EstimateCreateInvoiceResponse createInvoice(EstimateCreateInvoiceParams params) - throws Exception { + throws ChargebeeException { Response response = createInvoiceRaw(params); return EstimateCreateInvoiceResponse.fromJson(response.getBodyAsString(), response); } - /** - * cancelSubscriptionEstimateForSubscription a estimate (executes immediately) - returns raw - * Response. - */ - Response cancelSubscriptionEstimateForSubscriptionRaw(String subscriptionId) throws Exception { + /** cancelSubscription a estimate (executes immediately) - returns raw Response. */ + Response cancelSubscriptionRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_subscription_estimate", @@ -772,12 +778,11 @@ Response cancelSubscriptionEstimateForSubscriptionRaw(String subscriptionId) thr } /** - * cancelSubscriptionEstimateForSubscription a estimate using immutable params (executes - * immediately) - returns raw Response. + * cancelSubscription a estimate using immutable params (executes immediately) - returns raw + * Response. */ - Response cancelSubscriptionEstimateForSubscriptionRaw( - String subscriptionId, CancelSubscriptionEstimateForSubscriptionParams params) - throws Exception { + Response cancelSubscriptionRaw(String subscriptionId, EstimateCancelSubscriptionParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_subscription_estimate", @@ -787,11 +792,11 @@ Response cancelSubscriptionEstimateForSubscriptionRaw( } /** - * cancelSubscriptionEstimateForSubscription a estimate using raw JSON payload (executes - * immediately) - returns raw Response. + * cancelSubscription a estimate using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response cancelSubscriptionEstimateForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response cancelSubscriptionRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_subscription_estimate", @@ -800,12 +805,9 @@ Response cancelSubscriptionEstimateForSubscriptionRaw(String subscriptionId, Str return postJson(path, jsonPayload); } - public CancelSubscriptionEstimateForSubscriptionResponse - cancelSubscriptionEstimateForSubscription( - String subscriptionId, CancelSubscriptionEstimateForSubscriptionParams params) - throws Exception { - Response response = cancelSubscriptionEstimateForSubscriptionRaw(subscriptionId, params); - return CancelSubscriptionEstimateForSubscriptionResponse.fromJson( - response.getBodyAsString(), response); + public EstimateCancelSubscriptionResponse cancelSubscription( + String subscriptionId, EstimateCancelSubscriptionParams params) throws ChargebeeException { + Response response = cancelSubscriptionRaw(subscriptionId, params); + return EstimateCancelSubscriptionResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/EventService.java b/src/main/java/com/chargebee/v4/services/EventService.java index a8b8dd81..e8617dcc 100644 --- a/src/main/java/com/chargebee/v4/services/EventService.java +++ b/src/main/java/com/chargebee/v4/services/EventService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.event.params.EventListParams; @@ -52,42 +53,42 @@ public EventService withOptions(RequestOptions options) { // === Operations === /** list a event using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(EventListParams params) throws Exception { + Response listRaw(EventListParams params) throws ChargebeeException { return get("/events", params != null ? params.toQueryParams() : null); } /** list a event without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/events", null); } /** list a event using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public EventListResponse list(EventListParams params) throws Exception { + public EventListResponse list(EventListParams params) throws ChargebeeException { Response response = listRaw(params); return EventListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public EventListResponse list() throws Exception { + public EventListResponse list() throws ChargebeeException { Response response = listRaw(); return EventListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** retrieve a event (executes immediately) - returns raw Response. */ - Response retrieveRaw(String eventId) throws Exception { + Response retrieveRaw(String eventId) throws ChargebeeException { String path = buildPathWithParams("/events/{event-id}", "event-id", eventId); return get(path, null); } - public EventRetrieveResponse retrieve(String eventId) throws Exception { + public EventRetrieveResponse retrieve(String eventId) throws ChargebeeException { Response response = retrieveRaw(eventId); return EventRetrieveResponse.fromJson(response.getBodyAsString(), response); } diff --git a/src/main/java/com/chargebee/v4/services/ExportService.java b/src/main/java/com/chargebee/v4/services/ExportService.java index 3175e0f7..0d981839 100644 --- a/src/main/java/com/chargebee/v4/services/ExportService.java +++ b/src/main/java/com/chargebee/v4/services/ExportService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.export.params.ExportCustomersParams; @@ -116,18 +117,18 @@ public ExportService withOptions(RequestOptions options) { // === Operations === /** customers a export using immutable params (executes immediately) - returns raw Response. */ - Response customersRaw(ExportCustomersParams params) throws Exception { + Response customersRaw(ExportCustomersParams params) throws ChargebeeException { return post("/exports/customers", params != null ? params.toFormData() : null); } /** customers a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response customersRaw(String jsonPayload) throws Exception { + Response customersRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/customers", jsonPayload); } - public ExportCustomersResponse customers(ExportCustomersParams params) throws Exception { + public ExportCustomersResponse customers(ExportCustomersParams params) throws ChargebeeException { Response response = customersRaw(params); return ExportCustomersResponse.fromJson(response.getBodyAsString(), response); @@ -136,7 +137,7 @@ public ExportCustomersResponse customers(ExportCustomersParams params) throws Ex /** * attachedItems a export using immutable params (executes immediately) - returns raw Response. */ - Response attachedItemsRaw(ExportAttachedItemsParams params) throws Exception { + Response attachedItemsRaw(ExportAttachedItemsParams params) throws ChargebeeException { return post("/exports/attached_items", params != null ? params.toFormData() : null); } @@ -144,31 +145,32 @@ Response attachedItemsRaw(ExportAttachedItemsParams params) throws Exception { /** * attachedItems a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response attachedItemsRaw(String jsonPayload) throws Exception { + Response attachedItemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/attached_items", jsonPayload); } public ExportAttachedItemsResponse attachedItems(ExportAttachedItemsParams params) - throws Exception { + throws ChargebeeException { Response response = attachedItemsRaw(params); return ExportAttachedItemsResponse.fromJson(response.getBodyAsString(), response); } /** transactions a export using immutable params (executes immediately) - returns raw Response. */ - Response transactionsRaw(ExportTransactionsParams params) throws Exception { + Response transactionsRaw(ExportTransactionsParams params) throws ChargebeeException { return post("/exports/transactions", params != null ? params.toFormData() : null); } /** transactions a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response transactionsRaw(String jsonPayload) throws Exception { + Response transactionsRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/transactions", jsonPayload); } - public ExportTransactionsResponse transactions(ExportTransactionsParams params) throws Exception { + public ExportTransactionsResponse transactions(ExportTransactionsParams params) + throws ChargebeeException { Response response = transactionsRaw(params); return ExportTransactionsResponse.fromJson(response.getBodyAsString(), response); @@ -178,7 +180,7 @@ public ExportTransactionsResponse transactions(ExportTransactionsParams params) * differentialPrices a export using immutable params (executes immediately) - returns raw * Response. */ - Response differentialPricesRaw(ExportDifferentialPricesParams params) throws Exception { + Response differentialPricesRaw(ExportDifferentialPricesParams params) throws ChargebeeException { return post("/exports/differential_prices", params != null ? params.toFormData() : null); } @@ -187,62 +189,63 @@ Response differentialPricesRaw(ExportDifferentialPricesParams params) throws Exc * differentialPrices a export using raw JSON payload (executes immediately) - returns raw * Response. */ - Response differentialPricesRaw(String jsonPayload) throws Exception { + Response differentialPricesRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/differential_prices", jsonPayload); } public ExportDifferentialPricesResponse differentialPrices(ExportDifferentialPricesParams params) - throws Exception { + throws ChargebeeException { Response response = differentialPricesRaw(params); return ExportDifferentialPricesResponse.fromJson(response.getBodyAsString(), response); } /** itemFamilies a export using immutable params (executes immediately) - returns raw Response. */ - Response itemFamiliesRaw(ExportItemFamiliesParams params) throws Exception { + Response itemFamiliesRaw(ExportItemFamiliesParams params) throws ChargebeeException { return post("/exports/item_families", params != null ? params.toFormData() : null); } /** itemFamilies a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response itemFamiliesRaw(String jsonPayload) throws Exception { + Response itemFamiliesRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/item_families", jsonPayload); } - public ExportItemFamiliesResponse itemFamilies(ExportItemFamiliesParams params) throws Exception { + public ExportItemFamiliesResponse itemFamilies(ExportItemFamiliesParams params) + throws ChargebeeException { Response response = itemFamiliesRaw(params); return ExportItemFamiliesResponse.fromJson(response.getBodyAsString(), response); } /** invoices a export using immutable params (executes immediately) - returns raw Response. */ - Response invoicesRaw(ExportInvoicesParams params) throws Exception { + Response invoicesRaw(ExportInvoicesParams params) throws ChargebeeException { return post("/exports/invoices", params != null ? params.toFormData() : null); } /** invoices a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response invoicesRaw(String jsonPayload) throws Exception { + Response invoicesRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/invoices", jsonPayload); } - public ExportInvoicesResponse invoices(ExportInvoicesParams params) throws Exception { + public ExportInvoicesResponse invoices(ExportInvoicesParams params) throws ChargebeeException { Response response = invoicesRaw(params); return ExportInvoicesResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a export (executes immediately) - returns raw Response. */ - Response retrieveRaw(String exportId) throws Exception { + Response retrieveRaw(String exportId) throws ChargebeeException { String path = buildPathWithParams("/exports/{export-id}", "export-id", exportId); return get(path, null); } - public ExportRetrieveResponse retrieve(String exportId) throws Exception { + public ExportRetrieveResponse retrieve(String exportId) throws ChargebeeException { Response response = retrieveRaw(exportId); return ExportRetrieveResponse.fromJson(response.getBodyAsString(), response); } @@ -250,7 +253,7 @@ public ExportRetrieveResponse retrieve(String exportId) throws Exception { /** * priceVariants a export using immutable params (executes immediately) - returns raw Response. */ - Response priceVariantsRaw(ExportPriceVariantsParams params) throws Exception { + Response priceVariantsRaw(ExportPriceVariantsParams params) throws ChargebeeException { return post("/exports/price_variants", params != null ? params.toFormData() : null); } @@ -258,31 +261,31 @@ Response priceVariantsRaw(ExportPriceVariantsParams params) throws Exception { /** * priceVariants a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response priceVariantsRaw(String jsonPayload) throws Exception { + Response priceVariantsRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/price_variants", jsonPayload); } public ExportPriceVariantsResponse priceVariants(ExportPriceVariantsParams params) - throws Exception { + throws ChargebeeException { Response response = priceVariantsRaw(params); return ExportPriceVariantsResponse.fromJson(response.getBodyAsString(), response); } /** items a export using immutable params (executes immediately) - returns raw Response. */ - Response itemsRaw(ExportItemsParams params) throws Exception { + Response itemsRaw(ExportItemsParams params) throws ChargebeeException { return post("/exports/items", params != null ? params.toFormData() : null); } /** items a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response itemsRaw(String jsonPayload) throws Exception { + Response itemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/items", jsonPayload); } - public ExportItemsResponse items(ExportItemsParams params) throws Exception { + public ExportItemsResponse items(ExportItemsParams params) throws ChargebeeException { Response response = itemsRaw(params); return ExportItemsResponse.fromJson(response.getBodyAsString(), response); @@ -291,7 +294,7 @@ public ExportItemsResponse items(ExportItemsParams params) throws Exception { /** * deferredRevenue a export using immutable params (executes immediately) - returns raw Response. */ - Response deferredRevenueRaw(ExportDeferredRevenueParams params) throws Exception { + Response deferredRevenueRaw(ExportDeferredRevenueParams params) throws ChargebeeException { return post("/exports/deferred_revenue", params != null ? params.toFormData() : null); } @@ -299,13 +302,13 @@ Response deferredRevenueRaw(ExportDeferredRevenueParams params) throws Exception /** * deferredRevenue a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response deferredRevenueRaw(String jsonPayload) throws Exception { + Response deferredRevenueRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/deferred_revenue", jsonPayload); } public ExportDeferredRevenueResponse deferredRevenue(ExportDeferredRevenueParams params) - throws Exception { + throws ChargebeeException { Response response = deferredRevenueRaw(params); return ExportDeferredRevenueResponse.fromJson(response.getBodyAsString(), response); @@ -315,7 +318,7 @@ public ExportDeferredRevenueResponse deferredRevenue(ExportDeferredRevenueParams * revenueRecognition a export using immutable params (executes immediately) - returns raw * Response. */ - Response revenueRecognitionRaw(ExportRevenueRecognitionParams params) throws Exception { + Response revenueRecognitionRaw(ExportRevenueRecognitionParams params) throws ChargebeeException { return post("/exports/revenue_recognition", params != null ? params.toFormData() : null); } @@ -324,85 +327,87 @@ Response revenueRecognitionRaw(ExportRevenueRecognitionParams params) throws Exc * revenueRecognition a export using raw JSON payload (executes immediately) - returns raw * Response. */ - Response revenueRecognitionRaw(String jsonPayload) throws Exception { + Response revenueRecognitionRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/revenue_recognition", jsonPayload); } public ExportRevenueRecognitionResponse revenueRecognition(ExportRevenueRecognitionParams params) - throws Exception { + throws ChargebeeException { Response response = revenueRecognitionRaw(params); return ExportRevenueRecognitionResponse.fromJson(response.getBodyAsString(), response); } /** creditNotes a export using immutable params (executes immediately) - returns raw Response. */ - Response creditNotesRaw(ExportCreditNotesParams params) throws Exception { + Response creditNotesRaw(ExportCreditNotesParams params) throws ChargebeeException { return post("/exports/credit_notes", params != null ? params.toFormData() : null); } /** creditNotes a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response creditNotesRaw(String jsonPayload) throws Exception { + Response creditNotesRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/credit_notes", jsonPayload); } - public ExportCreditNotesResponse creditNotes(ExportCreditNotesParams params) throws Exception { + public ExportCreditNotesResponse creditNotes(ExportCreditNotesParams params) + throws ChargebeeException { Response response = creditNotesRaw(params); return ExportCreditNotesResponse.fromJson(response.getBodyAsString(), response); } /** coupons a export using immutable params (executes immediately) - returns raw Response. */ - Response couponsRaw(ExportCouponsParams params) throws Exception { + Response couponsRaw(ExportCouponsParams params) throws ChargebeeException { return post("/exports/coupons", params != null ? params.toFormData() : null); } /** coupons a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response couponsRaw(String jsonPayload) throws Exception { + Response couponsRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/coupons", jsonPayload); } - public ExportCouponsResponse coupons(ExportCouponsParams params) throws Exception { + public ExportCouponsResponse coupons(ExportCouponsParams params) throws ChargebeeException { Response response = couponsRaw(params); return ExportCouponsResponse.fromJson(response.getBodyAsString(), response); } /** orders a export using immutable params (executes immediately) - returns raw Response. */ - Response ordersRaw(ExportOrdersParams params) throws Exception { + Response ordersRaw(ExportOrdersParams params) throws ChargebeeException { return post("/exports/orders", params != null ? params.toFormData() : null); } /** orders a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response ordersRaw(String jsonPayload) throws Exception { + Response ordersRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/orders", jsonPayload); } - public ExportOrdersResponse orders(ExportOrdersParams params) throws Exception { + public ExportOrdersResponse orders(ExportOrdersParams params) throws ChargebeeException { Response response = ordersRaw(params); return ExportOrdersResponse.fromJson(response.getBodyAsString(), response); } /** itemPrices a export using immutable params (executes immediately) - returns raw Response. */ - Response itemPricesRaw(ExportItemPricesParams params) throws Exception { + Response itemPricesRaw(ExportItemPricesParams params) throws ChargebeeException { return post("/exports/item_prices", params != null ? params.toFormData() : null); } /** itemPrices a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response itemPricesRaw(String jsonPayload) throws Exception { + Response itemPricesRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/item_prices", jsonPayload); } - public ExportItemPricesResponse itemPrices(ExportItemPricesParams params) throws Exception { + public ExportItemPricesResponse itemPrices(ExportItemPricesParams params) + throws ChargebeeException { Response response = itemPricesRaw(params); return ExportItemPricesResponse.fromJson(response.getBodyAsString(), response); @@ -411,7 +416,7 @@ public ExportItemPricesResponse itemPrices(ExportItemPricesParams params) throws /** * subscriptions a export using immutable params (executes immediately) - returns raw Response. */ - Response subscriptionsRaw(ExportSubscriptionsParams params) throws Exception { + Response subscriptionsRaw(ExportSubscriptionsParams params) throws ChargebeeException { return post("/exports/subscriptions", params != null ? params.toFormData() : null); } @@ -419,49 +424,49 @@ Response subscriptionsRaw(ExportSubscriptionsParams params) throws Exception { /** * subscriptions a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response subscriptionsRaw(String jsonPayload) throws Exception { + Response subscriptionsRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/subscriptions", jsonPayload); } public ExportSubscriptionsResponse subscriptions(ExportSubscriptionsParams params) - throws Exception { + throws ChargebeeException { Response response = subscriptionsRaw(params); return ExportSubscriptionsResponse.fromJson(response.getBodyAsString(), response); } /** addons a export using immutable params (executes immediately) - returns raw Response. */ - Response addonsRaw(ExportAddonsParams params) throws Exception { + Response addonsRaw(ExportAddonsParams params) throws ChargebeeException { return post("/exports/addons", params != null ? params.toFormData() : null); } /** addons a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response addonsRaw(String jsonPayload) throws Exception { + Response addonsRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/addons", jsonPayload); } - public ExportAddonsResponse addons(ExportAddonsParams params) throws Exception { + public ExportAddonsResponse addons(ExportAddonsParams params) throws ChargebeeException { Response response = addonsRaw(params); return ExportAddonsResponse.fromJson(response.getBodyAsString(), response); } /** plans a export using immutable params (executes immediately) - returns raw Response. */ - Response plansRaw(ExportPlansParams params) throws Exception { + Response plansRaw(ExportPlansParams params) throws ChargebeeException { return post("/exports/plans", params != null ? params.toFormData() : null); } /** plans a export using raw JSON payload (executes immediately) - returns raw Response. */ - Response plansRaw(String jsonPayload) throws Exception { + Response plansRaw(String jsonPayload) throws ChargebeeException { return postJson("/exports/plans", jsonPayload); } - public ExportPlansResponse plans(ExportPlansParams params) throws Exception { + public ExportPlansResponse plans(ExportPlansParams params) throws ChargebeeException { Response response = plansRaw(params); return ExportPlansResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/FeatureService.java b/src/main/java/com/chargebee/v4/services/FeatureService.java index 0c4d884e..3f3856f4 100644 --- a/src/main/java/com/chargebee/v4/services/FeatureService.java +++ b/src/main/java/com/chargebee/v4/services/FeatureService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.feature.params.FeatureListParams; @@ -21,17 +22,17 @@ import com.chargebee.v4.models.feature.responses.FeatureCreateResponse; -import com.chargebee.v4.models.feature.responses.DeleteFeatureResponse; +import com.chargebee.v4.models.feature.responses.FeatureDeleteResponse; import com.chargebee.v4.models.feature.responses.FeatureRetrieveResponse; import com.chargebee.v4.models.feature.responses.FeatureUpdateResponse; -import com.chargebee.v4.models.feature.responses.ArchiveCommandForFeatureResponse; +import com.chargebee.v4.models.feature.responses.FeatureArchiveResponse; -import com.chargebee.v4.models.feature.responses.ActivateCommandForFeatureResponse; +import com.chargebee.v4.models.feature.responses.FeatureActivateResponse; -import com.chargebee.v4.models.feature.responses.ReactivateCommandForFeatureResponse; +import com.chargebee.v4.models.feature.responses.FeatureReactivateResponse; public final class FeatureService extends BaseService { @@ -68,140 +69,137 @@ public FeatureService withOptions(RequestOptions options) { // === Operations === /** list a feature using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(FeatureListParams params) throws Exception { + Response listRaw(FeatureListParams params) throws ChargebeeException { return get("/features", params != null ? params.toQueryParams() : null); } /** list a feature without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/features", null); } /** list a feature using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public FeatureListResponse list(FeatureListParams params) throws Exception { + public FeatureListResponse list(FeatureListParams params) throws ChargebeeException { Response response = listRaw(params); return FeatureListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public FeatureListResponse list() throws Exception { + public FeatureListResponse list() throws ChargebeeException { Response response = listRaw(); return FeatureListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a feature using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(FeatureCreateParams params) throws Exception { + Response createRaw(FeatureCreateParams params) throws ChargebeeException { return post("/features", params != null ? params.toFormData() : null); } /** create a feature using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/features", jsonPayload); } - public FeatureCreateResponse create(FeatureCreateParams params) throws Exception { + public FeatureCreateResponse create(FeatureCreateParams params) throws ChargebeeException { Response response = createRaw(params); return FeatureCreateResponse.fromJson(response.getBodyAsString(), response); } - /** deleteFeature a feature (executes immediately) - returns raw Response. */ - Response deleteFeatureRaw(String featureId) throws Exception { + /** delete a feature (executes immediately) - returns raw Response. */ + Response deleteRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/delete", "feature-id", featureId); return post(path, null); } - public DeleteFeatureResponse deleteFeature(String featureId) throws Exception { - Response response = deleteFeatureRaw(featureId); - return DeleteFeatureResponse.fromJson(response.getBodyAsString(), response); + public FeatureDeleteResponse delete(String featureId) throws ChargebeeException { + Response response = deleteRaw(featureId); + return FeatureDeleteResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a feature (executes immediately) - returns raw Response. */ - Response retrieveRaw(String featureId) throws Exception { + Response retrieveRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); return get(path, null); } - public FeatureRetrieveResponse retrieve(String featureId) throws Exception { + public FeatureRetrieveResponse retrieve(String featureId) throws ChargebeeException { Response response = retrieveRaw(featureId); return FeatureRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a feature (executes immediately) - returns raw Response. */ - Response updateRaw(String featureId) throws Exception { + Response updateRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); return post(path, null); } /** update a feature using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String featureId, FeatureUpdateParams params) throws Exception { + Response updateRaw(String featureId, FeatureUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); return post(path, params.toFormData()); } /** update a feature using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String featureId, String jsonPayload) throws Exception { + Response updateRaw(String featureId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); return postJson(path, jsonPayload); } public FeatureUpdateResponse update(String featureId, FeatureUpdateParams params) - throws Exception { + throws ChargebeeException { Response response = updateRaw(featureId, params); return FeatureUpdateResponse.fromJson(response.getBodyAsString(), response); } - /** archiveCommandForFeature a feature (executes immediately) - returns raw Response. */ - Response archiveCommandForFeatureRaw(String featureId) throws Exception { + /** archive a feature (executes immediately) - returns raw Response. */ + Response archiveRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/archive_command", "feature-id", featureId); return post(path, null); } - public ArchiveCommandForFeatureResponse archiveCommandForFeature(String featureId) - throws Exception { - Response response = archiveCommandForFeatureRaw(featureId); - return ArchiveCommandForFeatureResponse.fromJson(response.getBodyAsString(), response); + public FeatureArchiveResponse archive(String featureId) throws ChargebeeException { + Response response = archiveRaw(featureId); + return FeatureArchiveResponse.fromJson(response.getBodyAsString(), response); } - /** activateCommandForFeature a feature (executes immediately) - returns raw Response. */ - Response activateCommandForFeatureRaw(String featureId) throws Exception { + /** activate a feature (executes immediately) - returns raw Response. */ + Response activateRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/activate_command", "feature-id", featureId); return post(path, null); } - public ActivateCommandForFeatureResponse activateCommandForFeature(String featureId) - throws Exception { - Response response = activateCommandForFeatureRaw(featureId); - return ActivateCommandForFeatureResponse.fromJson(response.getBodyAsString(), response); + public FeatureActivateResponse activate(String featureId) throws ChargebeeException { + Response response = activateRaw(featureId); + return FeatureActivateResponse.fromJson(response.getBodyAsString(), response); } - /** reactivateCommandForFeature a feature (executes immediately) - returns raw Response. */ - Response reactivateCommandForFeatureRaw(String featureId) throws Exception { + /** reactivate a feature (executes immediately) - returns raw Response. */ + Response reactivateRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/reactivate_command", "feature-id", featureId); return post(path, null); } - public ReactivateCommandForFeatureResponse reactivateCommandForFeature(String featureId) - throws Exception { - Response response = reactivateCommandForFeatureRaw(featureId); - return ReactivateCommandForFeatureResponse.fromJson(response.getBodyAsString(), response); + public FeatureReactivateResponse reactivate(String featureId) throws ChargebeeException { + Response response = reactivateRaw(featureId); + return FeatureReactivateResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/FullExportService.java b/src/main/java/com/chargebee/v4/services/FullExportService.java index 85061c13..9ec7159f 100644 --- a/src/main/java/com/chargebee/v4/services/FullExportService.java +++ b/src/main/java/com/chargebee/v4/services/FullExportService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.fullExport.params.FullExportStatusParams; @@ -50,18 +51,18 @@ public FullExportService withOptions(RequestOptions options) { // === Operations === /** status a fullExport using immutable params (executes immediately) - returns raw Response. */ - Response statusRaw(FullExportStatusParams params) throws Exception { + Response statusRaw(FullExportStatusParams params) throws ChargebeeException { return get("/full_exports/status", params != null ? params.toQueryParams() : null); } /** status a fullExport using raw JSON payload (executes immediately) - returns raw Response. */ - Response statusRaw(String jsonPayload) throws Exception { + Response statusRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public FullExportStatusResponse status(FullExportStatusParams params) throws Exception { + public FullExportStatusResponse status(FullExportStatusParams params) throws ChargebeeException { Response response = statusRaw(params); return FullExportStatusResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/GiftService.java b/src/main/java/com/chargebee/v4/services/GiftService.java index 1a082992..17fec704 100644 --- a/src/main/java/com/chargebee/v4/services/GiftService.java +++ b/src/main/java/com/chargebee/v4/services/GiftService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.gift.params.GiftCreateForItemsParams; -import com.chargebee.v4.models.gift.params.UpdateGiftForGiftParams; +import com.chargebee.v4.models.gift.params.UpdateGiftParams; import com.chargebee.v4.models.gift.params.GiftListParams; @@ -21,9 +22,9 @@ import com.chargebee.v4.models.gift.responses.GiftCreateForItemsResponse; -import com.chargebee.v4.models.gift.responses.CancelForGiftResponse; +import com.chargebee.v4.models.gift.responses.GiftCancelResponse; -import com.chargebee.v4.models.gift.responses.UpdateGiftForGiftResponse; +import com.chargebee.v4.models.gift.responses.UpdateGiftResponse; import com.chargebee.v4.models.gift.responses.GiftListResponse; @@ -31,7 +32,7 @@ import com.chargebee.v4.models.gift.responses.GiftRetrieveResponse; -import com.chargebee.v4.models.gift.responses.ClaimForGiftResponse; +import com.chargebee.v4.models.gift.responses.GiftClaimResponse; public final class GiftService extends BaseService { @@ -68,133 +69,129 @@ public GiftService withOptions(RequestOptions options) { // === Operations === /** createForItems a gift using immutable params (executes immediately) - returns raw Response. */ - Response createForItemsRaw(GiftCreateForItemsParams params) throws Exception { + Response createForItemsRaw(GiftCreateForItemsParams params) throws ChargebeeException { return post("/gifts/create_for_items", params != null ? params.toFormData() : null); } /** createForItems a gift using raw JSON payload (executes immediately) - returns raw Response. */ - Response createForItemsRaw(String jsonPayload) throws Exception { + Response createForItemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/gifts/create_for_items", jsonPayload); } public GiftCreateForItemsResponse createForItems(GiftCreateForItemsParams params) - throws Exception { + throws ChargebeeException { Response response = createForItemsRaw(params); return GiftCreateForItemsResponse.fromJson(response.getBodyAsString(), response); } - /** cancelForGift a gift (executes immediately) - returns raw Response. */ - Response cancelForGiftRaw(String giftId) throws Exception { + /** cancel a gift (executes immediately) - returns raw Response. */ + Response cancelRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}/cancel", "gift-id", giftId); return post(path, null); } - public CancelForGiftResponse cancelForGift(String giftId) throws Exception { - Response response = cancelForGiftRaw(giftId); - return CancelForGiftResponse.fromJson(response.getBodyAsString(), response); + public GiftCancelResponse cancel(String giftId) throws ChargebeeException { + Response response = cancelRaw(giftId); + return GiftCancelResponse.fromJson(response.getBodyAsString(), response); } - /** updateGiftForGift a gift (executes immediately) - returns raw Response. */ - Response updateGiftForGiftRaw(String giftId) throws Exception { + /** updateGift a gift (executes immediately) - returns raw Response. */ + Response updateGiftRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}/update_gift", "gift-id", giftId); return post(path, null); } - /** - * updateGiftForGift a gift using immutable params (executes immediately) - returns raw Response. - */ - Response updateGiftForGiftRaw(String giftId, UpdateGiftForGiftParams params) throws Exception { + /** updateGift a gift using immutable params (executes immediately) - returns raw Response. */ + Response updateGiftRaw(String giftId, UpdateGiftParams params) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}/update_gift", "gift-id", giftId); return post(path, params.toFormData()); } - /** - * updateGiftForGift a gift using raw JSON payload (executes immediately) - returns raw Response. - */ - Response updateGiftForGiftRaw(String giftId, String jsonPayload) throws Exception { + /** updateGift a gift using raw JSON payload (executes immediately) - returns raw Response. */ + Response updateGiftRaw(String giftId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}/update_gift", "gift-id", giftId); return postJson(path, jsonPayload); } - public UpdateGiftForGiftResponse updateGiftForGift(String giftId, UpdateGiftForGiftParams params) - throws Exception { - Response response = updateGiftForGiftRaw(giftId, params); - return UpdateGiftForGiftResponse.fromJson(response.getBodyAsString(), response); + public UpdateGiftResponse updateGift(String giftId, UpdateGiftParams params) + throws ChargebeeException { + Response response = updateGiftRaw(giftId, params); + return UpdateGiftResponse.fromJson(response.getBodyAsString(), response); } /** list a gift using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(GiftListParams params) throws Exception { + Response listRaw(GiftListParams params) throws ChargebeeException { return get("/gifts", params != null ? params.toQueryParams() : null); } /** list a gift without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/gifts", null); } /** list a gift using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public GiftListResponse list(GiftListParams params) throws Exception { + public GiftListResponse list(GiftListParams params) throws ChargebeeException { Response response = listRaw(params); return GiftListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public GiftListResponse list() throws Exception { + public GiftListResponse list() throws ChargebeeException { Response response = listRaw(); return GiftListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a gift using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(GiftCreateParams params) throws Exception { + Response createRaw(GiftCreateParams params) throws ChargebeeException { return post("/gifts", params != null ? params.toFormData() : null); } /** create a gift using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/gifts", jsonPayload); } - public GiftCreateResponse create(GiftCreateParams params) throws Exception { + public GiftCreateResponse create(GiftCreateParams params) throws ChargebeeException { Response response = createRaw(params); return GiftCreateResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a gift (executes immediately) - returns raw Response. */ - Response retrieveRaw(String giftId) throws Exception { + Response retrieveRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}", "gift-id", giftId); return get(path, null); } - public GiftRetrieveResponse retrieve(String giftId) throws Exception { + public GiftRetrieveResponse retrieve(String giftId) throws ChargebeeException { Response response = retrieveRaw(giftId); return GiftRetrieveResponse.fromJson(response.getBodyAsString(), response); } - /** claimForGift a gift (executes immediately) - returns raw Response. */ - Response claimForGiftRaw(String giftId) throws Exception { + /** claim a gift (executes immediately) - returns raw Response. */ + Response claimRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}/claim", "gift-id", giftId); return post(path, null); } - public ClaimForGiftResponse claimForGift(String giftId) throws Exception { - Response response = claimForGiftRaw(giftId); - return ClaimForGiftResponse.fromJson(response.getBodyAsString(), response); + public GiftClaimResponse claim(String giftId) throws ChargebeeException { + Response response = claimRaw(giftId); + return GiftClaimResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/HostedPageService.java b/src/main/java/com/chargebee/v4/services/HostedPageService.java index 13a136fa..dec4970c 100644 --- a/src/main/java/com/chargebee/v4/services/HostedPageService.java +++ b/src/main/java/com/chargebee/v4/services/HostedPageService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.hostedPage.params.HostedPageCheckoutOneTimeForItemsParams; @@ -79,7 +80,7 @@ import com.chargebee.v4.models.hostedPage.responses.HostedPagePreCancelResponse; -import com.chargebee.v4.models.hostedPage.responses.AcknowledgeForHostedPageResponse; +import com.chargebee.v4.models.hostedPage.responses.HostedPageAcknowledgeResponse; import com.chargebee.v4.models.hostedPage.responses.HostedPageRetrieveAgreementPdfResponse; @@ -134,7 +135,7 @@ public HostedPageService withOptions(RequestOptions options) { * raw Response. */ Response checkoutOneTimeForItemsRaw(HostedPageCheckoutOneTimeForItemsParams params) - throws Exception { + throws ChargebeeException { return post( "/hosted_pages/checkout_one_time_for_items", params != null ? params.toFormData() : null); @@ -144,13 +145,13 @@ Response checkoutOneTimeForItemsRaw(HostedPageCheckoutOneTimeForItemsParams para * checkoutOneTimeForItems a hostedPage using raw JSON payload (executes immediately) - returns * raw Response. */ - Response checkoutOneTimeForItemsRaw(String jsonPayload) throws Exception { + Response checkoutOneTimeForItemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/checkout_one_time_for_items", jsonPayload); } public HostedPageCheckoutOneTimeForItemsResponse checkoutOneTimeForItems( - HostedPageCheckoutOneTimeForItemsParams params) throws Exception { + HostedPageCheckoutOneTimeForItemsParams params) throws ChargebeeException { Response response = checkoutOneTimeForItemsRaw(params); return HostedPageCheckoutOneTimeForItemsResponse.fromJson(response.getBodyAsString(), response); @@ -160,7 +161,8 @@ public HostedPageCheckoutOneTimeForItemsResponse checkoutOneTimeForItems( * updatePaymentMethod a hostedPage using immutable params (executes immediately) - returns raw * Response. */ - Response updatePaymentMethodRaw(HostedPageUpdatePaymentMethodParams params) throws Exception { + Response updatePaymentMethodRaw(HostedPageUpdatePaymentMethodParams params) + throws ChargebeeException { return post("/hosted_pages/update_payment_method", params != null ? params.toFormData() : null); } @@ -169,13 +171,13 @@ Response updatePaymentMethodRaw(HostedPageUpdatePaymentMethodParams params) thro * updatePaymentMethod a hostedPage using raw JSON payload (executes immediately) - returns raw * Response. */ - Response updatePaymentMethodRaw(String jsonPayload) throws Exception { + Response updatePaymentMethodRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/update_payment_method", jsonPayload); } public HostedPageUpdatePaymentMethodResponse updatePaymentMethod( - HostedPageUpdatePaymentMethodParams params) throws Exception { + HostedPageUpdatePaymentMethodParams params) throws ChargebeeException { Response response = updatePaymentMethodRaw(params); return HostedPageUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response); @@ -184,7 +186,7 @@ public HostedPageUpdatePaymentMethodResponse updatePaymentMethod( /** * updateCard a hostedPage using immutable params (executes immediately) - returns raw Response. */ - Response updateCardRaw(HostedPageUpdateCardParams params) throws Exception { + Response updateCardRaw(HostedPageUpdateCardParams params) throws ChargebeeException { return post("/hosted_pages/update_card", params != null ? params.toFormData() : null); } @@ -192,13 +194,13 @@ Response updateCardRaw(HostedPageUpdateCardParams params) throws Exception { /** * updateCard a hostedPage using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateCardRaw(String jsonPayload) throws Exception { + Response updateCardRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/update_card", jsonPayload); } public HostedPageUpdateCardResponse updateCard(HostedPageUpdateCardParams params) - throws Exception { + throws ChargebeeException { Response response = updateCardRaw(params); return HostedPageUpdateCardResponse.fromJson(response.getBodyAsString(), response); @@ -208,7 +210,8 @@ public HostedPageUpdateCardResponse updateCard(HostedPageUpdateCardParams params * extendSubscription a hostedPage using immutable params (executes immediately) - returns raw * Response. */ - Response extendSubscriptionRaw(HostedPageExtendSubscriptionParams params) throws Exception { + Response extendSubscriptionRaw(HostedPageExtendSubscriptionParams params) + throws ChargebeeException { return post("/hosted_pages/extend_subscription", params != null ? params.toFormData() : null); } @@ -217,31 +220,31 @@ Response extendSubscriptionRaw(HostedPageExtendSubscriptionParams params) throws * extendSubscription a hostedPage using raw JSON payload (executes immediately) - returns raw * Response. */ - Response extendSubscriptionRaw(String jsonPayload) throws Exception { + Response extendSubscriptionRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/extend_subscription", jsonPayload); } public HostedPageExtendSubscriptionResponse extendSubscription( - HostedPageExtendSubscriptionParams params) throws Exception { + HostedPageExtendSubscriptionParams params) throws ChargebeeException { Response response = extendSubscriptionRaw(params); return HostedPageExtendSubscriptionResponse.fromJson(response.getBodyAsString(), response); } /** events a hostedPage using immutable params (executes immediately) - returns raw Response. */ - Response eventsRaw(HostedPageEventsParams params) throws Exception { + Response eventsRaw(HostedPageEventsParams params) throws ChargebeeException { return post("/hosted_pages/events", params != null ? params.toFormData() : null); } /** events a hostedPage using raw JSON payload (executes immediately) - returns raw Response. */ - Response eventsRaw(String jsonPayload) throws Exception { + Response eventsRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/events", jsonPayload); } - public HostedPageEventsResponse events(HostedPageEventsParams params) throws Exception { + public HostedPageEventsResponse events(HostedPageEventsParams params) throws ChargebeeException { Response response = eventsRaw(params); return HostedPageEventsResponse.fromJson(response.getBodyAsString(), response); @@ -251,7 +254,8 @@ public HostedPageEventsResponse events(HostedPageEventsParams params) throws Exc * checkoutGiftForItems a hostedPage using immutable params (executes immediately) - returns raw * Response. */ - Response checkoutGiftForItemsRaw(HostedPageCheckoutGiftForItemsParams params) throws Exception { + Response checkoutGiftForItemsRaw(HostedPageCheckoutGiftForItemsParams params) + throws ChargebeeException { return post( "/hosted_pages/checkout_gift_for_items", params != null ? params.toFormData() : null); @@ -261,43 +265,43 @@ Response checkoutGiftForItemsRaw(HostedPageCheckoutGiftForItemsParams params) th * checkoutGiftForItems a hostedPage using raw JSON payload (executes immediately) - returns raw * Response. */ - Response checkoutGiftForItemsRaw(String jsonPayload) throws Exception { + Response checkoutGiftForItemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/checkout_gift_for_items", jsonPayload); } public HostedPageCheckoutGiftForItemsResponse checkoutGiftForItems( - HostedPageCheckoutGiftForItemsParams params) throws Exception { + HostedPageCheckoutGiftForItemsParams params) throws ChargebeeException { Response response = checkoutGiftForItemsRaw(params); return HostedPageCheckoutGiftForItemsResponse.fromJson(response.getBodyAsString(), response); } /** list a hostedPage using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(HostedPageListParams params) throws Exception { + Response listRaw(HostedPageListParams params) throws ChargebeeException { return get("/hosted_pages", params != null ? params.toQueryParams() : null); } /** list a hostedPage without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/hosted_pages", null); } /** list a hostedPage using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public HostedPageListResponse list(HostedPageListParams params) throws Exception { + public HostedPageListResponse list(HostedPageListParams params) throws ChargebeeException { Response response = listRaw(params); return HostedPageListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public HostedPageListResponse list() throws Exception { + public HostedPageListResponse list() throws ChargebeeException { Response response = listRaw(); return HostedPageListResponse.fromJson(response.getBodyAsString(), this, null, response); } @@ -305,7 +309,7 @@ public HostedPageListResponse list() throws Exception { /** * viewVoucher a hostedPage using immutable params (executes immediately) - returns raw Response. */ - Response viewVoucherRaw(HostedPageViewVoucherParams params) throws Exception { + Response viewVoucherRaw(HostedPageViewVoucherParams params) throws ChargebeeException { return post("/hosted_pages/view_voucher", params != null ? params.toFormData() : null); } @@ -313,13 +317,13 @@ Response viewVoucherRaw(HostedPageViewVoucherParams params) throws Exception { /** * viewVoucher a hostedPage using raw JSON payload (executes immediately) - returns raw Response. */ - Response viewVoucherRaw(String jsonPayload) throws Exception { + Response viewVoucherRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/view_voucher", jsonPayload); } public HostedPageViewVoucherResponse viewVoucher(HostedPageViewVoucherParams params) - throws Exception { + throws ChargebeeException { Response response = viewVoucherRaw(params); return HostedPageViewVoucherResponse.fromJson(response.getBodyAsString(), response); @@ -328,7 +332,7 @@ public HostedPageViewVoucherResponse viewVoucher(HostedPageViewVoucherParams par /** * collectNow a hostedPage using immutable params (executes immediately) - returns raw Response. */ - Response collectNowRaw(HostedPageCollectNowParams params) throws Exception { + Response collectNowRaw(HostedPageCollectNowParams params) throws ChargebeeException { return post("/hosted_pages/collect_now", params != null ? params.toFormData() : null); } @@ -336,13 +340,13 @@ Response collectNowRaw(HostedPageCollectNowParams params) throws Exception { /** * collectNow a hostedPage using raw JSON payload (executes immediately) - returns raw Response. */ - Response collectNowRaw(String jsonPayload) throws Exception { + Response collectNowRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/collect_now", jsonPayload); } public HostedPageCollectNowResponse collectNow(HostedPageCollectNowParams params) - throws Exception { + throws ChargebeeException { Response response = collectNowRaw(params); return HostedPageCollectNowResponse.fromJson(response.getBodyAsString(), response); @@ -351,7 +355,7 @@ public HostedPageCollectNowResponse collectNow(HostedPageCollectNowParams params /** * acceptQuote a hostedPage using immutable params (executes immediately) - returns raw Response. */ - Response acceptQuoteRaw(HostedPageAcceptQuoteParams params) throws Exception { + Response acceptQuoteRaw(HostedPageAcceptQuoteParams params) throws ChargebeeException { return post("/hosted_pages/accept_quote", params != null ? params.toFormData() : null); } @@ -359,13 +363,13 @@ Response acceptQuoteRaw(HostedPageAcceptQuoteParams params) throws Exception { /** * acceptQuote a hostedPage using raw JSON payload (executes immediately) - returns raw Response. */ - Response acceptQuoteRaw(String jsonPayload) throws Exception { + Response acceptQuoteRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/accept_quote", jsonPayload); } public HostedPageAcceptQuoteResponse acceptQuote(HostedPageAcceptQuoteParams params) - throws Exception { + throws ChargebeeException { Response response = acceptQuoteRaw(params); return HostedPageAcceptQuoteResponse.fromJson(response.getBodyAsString(), response); @@ -375,7 +379,8 @@ public HostedPageAcceptQuoteResponse acceptQuote(HostedPageAcceptQuoteParams par * checkoutNewForItems a hostedPage using immutable params (executes immediately) - returns raw * Response. */ - Response checkoutNewForItemsRaw(HostedPageCheckoutNewForItemsParams params) throws Exception { + Response checkoutNewForItemsRaw(HostedPageCheckoutNewForItemsParams params) + throws ChargebeeException { return post( "/hosted_pages/checkout_new_for_items", params != null ? params.toFormData() : null); @@ -385,13 +390,13 @@ Response checkoutNewForItemsRaw(HostedPageCheckoutNewForItemsParams params) thro * checkoutNewForItems a hostedPage using raw JSON payload (executes immediately) - returns raw * Response. */ - Response checkoutNewForItemsRaw(String jsonPayload) throws Exception { + Response checkoutNewForItemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/checkout_new_for_items", jsonPayload); } public HostedPageCheckoutNewForItemsResponse checkoutNewForItems( - HostedPageCheckoutNewForItemsParams params) throws Exception { + HostedPageCheckoutNewForItemsParams params) throws ChargebeeException { Response response = checkoutNewForItemsRaw(params); return HostedPageCheckoutNewForItemsResponse.fromJson(response.getBodyAsString(), response); @@ -400,7 +405,7 @@ public HostedPageCheckoutNewForItemsResponse checkoutNewForItems( /** * claimGift a hostedPage using immutable params (executes immediately) - returns raw Response. */ - Response claimGiftRaw(HostedPageClaimGiftParams params) throws Exception { + Response claimGiftRaw(HostedPageClaimGiftParams params) throws ChargebeeException { return post("/hosted_pages/claim_gift", params != null ? params.toFormData() : null); } @@ -408,12 +413,13 @@ Response claimGiftRaw(HostedPageClaimGiftParams params) throws Exception { /** * claimGift a hostedPage using raw JSON payload (executes immediately) - returns raw Response. */ - Response claimGiftRaw(String jsonPayload) throws Exception { + Response claimGiftRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/claim_gift", jsonPayload); } - public HostedPageClaimGiftResponse claimGift(HostedPageClaimGiftParams params) throws Exception { + public HostedPageClaimGiftResponse claimGift(HostedPageClaimGiftParams params) + throws ChargebeeException { Response response = claimGiftRaw(params); return HostedPageClaimGiftResponse.fromJson(response.getBodyAsString(), response); @@ -424,7 +430,7 @@ public HostedPageClaimGiftResponse claimGift(HostedPageClaimGiftParams params) t * raw Response. */ Response checkoutExistingForItemsRaw(HostedPageCheckoutExistingForItemsParams params) - throws Exception { + throws ChargebeeException { return post( "/hosted_pages/checkout_existing_for_items", params != null ? params.toFormData() : null); @@ -434,13 +440,13 @@ Response checkoutExistingForItemsRaw(HostedPageCheckoutExistingForItemsParams pa * checkoutExistingForItems a hostedPage using raw JSON payload (executes immediately) - returns * raw Response. */ - Response checkoutExistingForItemsRaw(String jsonPayload) throws Exception { + Response checkoutExistingForItemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/checkout_existing_for_items", jsonPayload); } public HostedPageCheckoutExistingForItemsResponse checkoutExistingForItems( - HostedPageCheckoutExistingForItemsParams params) throws Exception { + HostedPageCheckoutExistingForItemsParams params) throws ChargebeeException { Response response = checkoutExistingForItemsRaw(params); return HostedPageCheckoutExistingForItemsResponse.fromJson( @@ -450,7 +456,7 @@ public HostedPageCheckoutExistingForItemsResponse checkoutExistingForItems( /** * preCancel a hostedPage using immutable params (executes immediately) - returns raw Response. */ - Response preCancelRaw(HostedPagePreCancelParams params) throws Exception { + Response preCancelRaw(HostedPagePreCancelParams params) throws ChargebeeException { return post("/hosted_pages/pre_cancel", params != null ? params.toFormData() : null); } @@ -458,19 +464,20 @@ Response preCancelRaw(HostedPagePreCancelParams params) throws Exception { /** * preCancel a hostedPage using raw JSON payload (executes immediately) - returns raw Response. */ - Response preCancelRaw(String jsonPayload) throws Exception { + Response preCancelRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/pre_cancel", jsonPayload); } - public HostedPagePreCancelResponse preCancel(HostedPagePreCancelParams params) throws Exception { + public HostedPagePreCancelResponse preCancel(HostedPagePreCancelParams params) + throws ChargebeeException { Response response = preCancelRaw(params); return HostedPagePreCancelResponse.fromJson(response.getBodyAsString(), response); } - /** acknowledgeForHostedPage a hostedPage (executes immediately) - returns raw Response. */ - Response acknowledgeForHostedPageRaw(String hostedPageId) throws Exception { + /** acknowledge a hostedPage (executes immediately) - returns raw Response. */ + Response acknowledgeRaw(String hostedPageId) throws ChargebeeException { String path = buildPathWithParams( "/hosted_pages/{hosted-page-id}/acknowledge", "hosted-page-id", hostedPageId); @@ -478,17 +485,17 @@ Response acknowledgeForHostedPageRaw(String hostedPageId) throws Exception { return post(path, null); } - public AcknowledgeForHostedPageResponse acknowledgeForHostedPage(String hostedPageId) - throws Exception { - Response response = acknowledgeForHostedPageRaw(hostedPageId); - return AcknowledgeForHostedPageResponse.fromJson(response.getBodyAsString(), response); + public HostedPageAcknowledgeResponse acknowledge(String hostedPageId) throws ChargebeeException { + Response response = acknowledgeRaw(hostedPageId); + return HostedPageAcknowledgeResponse.fromJson(response.getBodyAsString(), response); } /** * retrieveAgreementPdf a hostedPage using immutable params (executes immediately) - returns raw * Response. */ - Response retrieveAgreementPdfRaw(HostedPageRetrieveAgreementPdfParams params) throws Exception { + Response retrieveAgreementPdfRaw(HostedPageRetrieveAgreementPdfParams params) + throws ChargebeeException { return post( "/hosted_pages/retrieve_agreement_pdf", params != null ? params.toFormData() : null); @@ -498,27 +505,27 @@ Response retrieveAgreementPdfRaw(HostedPageRetrieveAgreementPdfParams params) th * retrieveAgreementPdf a hostedPage using raw JSON payload (executes immediately) - returns raw * Response. */ - Response retrieveAgreementPdfRaw(String jsonPayload) throws Exception { + Response retrieveAgreementPdfRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/retrieve_agreement_pdf", jsonPayload); } public HostedPageRetrieveAgreementPdfResponse retrieveAgreementPdf( - HostedPageRetrieveAgreementPdfParams params) throws Exception { + HostedPageRetrieveAgreementPdfParams params) throws ChargebeeException { Response response = retrieveAgreementPdfRaw(params); return HostedPageRetrieveAgreementPdfResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a hostedPage (executes immediately) - returns raw Response. */ - Response retrieveRaw(String hostedPageId) throws Exception { + Response retrieveRaw(String hostedPageId) throws ChargebeeException { String path = buildPathWithParams("/hosted_pages/{hosted-page-id}", "hosted-page-id", hostedPageId); return get(path, null); } - public HostedPageRetrieveResponse retrieve(String hostedPageId) throws Exception { + public HostedPageRetrieveResponse retrieve(String hostedPageId) throws ChargebeeException { Response response = retrieveRaw(hostedPageId); return HostedPageRetrieveResponse.fromJson(response.getBodyAsString(), response); } @@ -527,7 +534,8 @@ public HostedPageRetrieveResponse retrieve(String hostedPageId) throws Exception * managePaymentSources a hostedPage using immutable params (executes immediately) - returns raw * Response. */ - Response managePaymentSourcesRaw(HostedPageManagePaymentSourcesParams params) throws Exception { + Response managePaymentSourcesRaw(HostedPageManagePaymentSourcesParams params) + throws ChargebeeException { return post( "/hosted_pages/manage_payment_sources", params != null ? params.toFormData() : null); @@ -537,13 +545,13 @@ Response managePaymentSourcesRaw(HostedPageManagePaymentSourcesParams params) th * managePaymentSources a hostedPage using raw JSON payload (executes immediately) - returns raw * Response. */ - Response managePaymentSourcesRaw(String jsonPayload) throws Exception { + Response managePaymentSourcesRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/manage_payment_sources", jsonPayload); } public HostedPageManagePaymentSourcesResponse managePaymentSources( - HostedPageManagePaymentSourcesParams params) throws Exception { + HostedPageManagePaymentSourcesParams params) throws ChargebeeException { Response response = managePaymentSourcesRaw(params); return HostedPageManagePaymentSourcesResponse.fromJson(response.getBodyAsString(), response); @@ -553,7 +561,7 @@ public HostedPageManagePaymentSourcesResponse managePaymentSources( * checkoutOneTime a hostedPage using immutable params (executes immediately) - returns raw * Response. */ - Response checkoutOneTimeRaw(HostedPageCheckoutOneTimeParams params) throws Exception { + Response checkoutOneTimeRaw(HostedPageCheckoutOneTimeParams params) throws ChargebeeException { return post("/hosted_pages/checkout_one_time", params != null ? params.toFormData() : null); } @@ -562,13 +570,13 @@ Response checkoutOneTimeRaw(HostedPageCheckoutOneTimeParams params) throws Excep * checkoutOneTime a hostedPage using raw JSON payload (executes immediately) - returns raw * Response. */ - Response checkoutOneTimeRaw(String jsonPayload) throws Exception { + Response checkoutOneTimeRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/checkout_one_time", jsonPayload); } public HostedPageCheckoutOneTimeResponse checkoutOneTime(HostedPageCheckoutOneTimeParams params) - throws Exception { + throws ChargebeeException { Response response = checkoutOneTimeRaw(params); return HostedPageCheckoutOneTimeResponse.fromJson(response.getBodyAsString(), response); @@ -577,7 +585,7 @@ public HostedPageCheckoutOneTimeResponse checkoutOneTime(HostedPageCheckoutOneTi /** * checkoutNew a hostedPage using immutable params (executes immediately) - returns raw Response. */ - Response checkoutNewRaw(HostedPageCheckoutNewParams params) throws Exception { + Response checkoutNewRaw(HostedPageCheckoutNewParams params) throws ChargebeeException { return post("/hosted_pages/checkout_new", params != null ? params.toFormData() : null); } @@ -585,13 +593,13 @@ Response checkoutNewRaw(HostedPageCheckoutNewParams params) throws Exception { /** * checkoutNew a hostedPage using raw JSON payload (executes immediately) - returns raw Response. */ - Response checkoutNewRaw(String jsonPayload) throws Exception { + Response checkoutNewRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/checkout_new", jsonPayload); } public HostedPageCheckoutNewResponse checkoutNew(HostedPageCheckoutNewParams params) - throws Exception { + throws ChargebeeException { Response response = checkoutNewRaw(params); return HostedPageCheckoutNewResponse.fromJson(response.getBodyAsString(), response); @@ -600,7 +608,7 @@ public HostedPageCheckoutNewResponse checkoutNew(HostedPageCheckoutNewParams par /** * checkoutGift a hostedPage using immutable params (executes immediately) - returns raw Response. */ - Response checkoutGiftRaw(HostedPageCheckoutGiftParams params) throws Exception { + Response checkoutGiftRaw(HostedPageCheckoutGiftParams params) throws ChargebeeException { return post("/hosted_pages/checkout_gift", params != null ? params.toFormData() : null); } @@ -608,13 +616,13 @@ Response checkoutGiftRaw(HostedPageCheckoutGiftParams params) throws Exception { /** * checkoutGift a hostedPage using raw JSON payload (executes immediately) - returns raw Response. */ - Response checkoutGiftRaw(String jsonPayload) throws Exception { + Response checkoutGiftRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/checkout_gift", jsonPayload); } public HostedPageCheckoutGiftResponse checkoutGift(HostedPageCheckoutGiftParams params) - throws Exception { + throws ChargebeeException { Response response = checkoutGiftRaw(params); return HostedPageCheckoutGiftResponse.fromJson(response.getBodyAsString(), response); @@ -624,7 +632,7 @@ public HostedPageCheckoutGiftResponse checkoutGift(HostedPageCheckoutGiftParams * checkoutExisting a hostedPage using immutable params (executes immediately) - returns raw * Response. */ - Response checkoutExistingRaw(HostedPageCheckoutExistingParams params) throws Exception { + Response checkoutExistingRaw(HostedPageCheckoutExistingParams params) throws ChargebeeException { return post("/hosted_pages/checkout_existing", params != null ? params.toFormData() : null); } @@ -633,13 +641,13 @@ Response checkoutExistingRaw(HostedPageCheckoutExistingParams params) throws Exc * checkoutExisting a hostedPage using raw JSON payload (executes immediately) - returns raw * Response. */ - Response checkoutExistingRaw(String jsonPayload) throws Exception { + Response checkoutExistingRaw(String jsonPayload) throws ChargebeeException { return postJson("/hosted_pages/checkout_existing", jsonPayload); } public HostedPageCheckoutExistingResponse checkoutExisting( - HostedPageCheckoutExistingParams params) throws Exception { + HostedPageCheckoutExistingParams params) throws ChargebeeException { Response response = checkoutExistingRaw(params); return HostedPageCheckoutExistingResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java b/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java index 8493cc91..874e0c33 100644 --- a/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java @@ -9,23 +9,24 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.inAppSubscription.params.RetrieveInAppSubscriptionParams; +import com.chargebee.v4.models.inAppSubscription.params.InAppSubscriptionRetrieveStoreSubscriptionsParams; -import com.chargebee.v4.models.inAppSubscription.params.ImportReceiptForInAppSubscriptionParams; +import com.chargebee.v4.models.inAppSubscription.params.InAppSubscriptionImportReceiptParams; -import com.chargebee.v4.models.inAppSubscription.params.ImportSubscriptionForInAppSubscriptionParams; +import com.chargebee.v4.models.inAppSubscription.params.InAppSubscriptionImportSubscriptionParams; -import com.chargebee.v4.models.inAppSubscription.params.ProcessPurchaseCommandForInAppSubscriptionParams; +import com.chargebee.v4.models.inAppSubscription.params.InAppSubscriptionProcessReceiptParams; -import com.chargebee.v4.models.inAppSubscription.responses.RetrieveInAppSubscriptionResponse; +import com.chargebee.v4.models.inAppSubscription.responses.InAppSubscriptionRetrieveStoreSubscriptionsResponse; -import com.chargebee.v4.models.inAppSubscription.responses.ImportReceiptForInAppSubscriptionResponse; +import com.chargebee.v4.models.inAppSubscription.responses.InAppSubscriptionImportReceiptResponse; -import com.chargebee.v4.models.inAppSubscription.responses.ImportSubscriptionForInAppSubscriptionResponse; +import com.chargebee.v4.models.inAppSubscription.responses.InAppSubscriptionImportSubscriptionResponse; -import com.chargebee.v4.models.inAppSubscription.responses.ProcessPurchaseCommandForInAppSubscriptionResponse; +import com.chargebee.v4.models.inAppSubscription.responses.InAppSubscriptionProcessReceiptResponse; public final class InAppSubscriptionService extends BaseService { @@ -63,9 +64,9 @@ public InAppSubscriptionService withOptions(RequestOptions options) { // === Operations === /** - * retrieveInAppSubscription a inAppSubscription (executes immediately) - returns raw Response. + * retrieveStoreSubscriptions a inAppSubscription (executes immediately) - returns raw Response. */ - Response retrieveInAppSubscriptionRaw(String inAppSubscriptionAppId) throws Exception { + Response retrieveStoreSubscriptionsRaw(String inAppSubscriptionAppId) throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/retrieve", @@ -76,11 +77,12 @@ Response retrieveInAppSubscriptionRaw(String inAppSubscriptionAppId) throws Exce } /** - * retrieveInAppSubscription a inAppSubscription using immutable params (executes immediately) - + * retrieveStoreSubscriptions a inAppSubscription using immutable params (executes immediately) - * returns raw Response. */ - Response retrieveInAppSubscriptionRaw( - String inAppSubscriptionAppId, RetrieveInAppSubscriptionParams params) throws Exception { + Response retrieveStoreSubscriptionsRaw( + String inAppSubscriptionAppId, InAppSubscriptionRetrieveStoreSubscriptionsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/retrieve", @@ -90,11 +92,11 @@ Response retrieveInAppSubscriptionRaw( } /** - * retrieveInAppSubscription a inAppSubscription using raw JSON payload (executes immediately) - + * retrieveStoreSubscriptions a inAppSubscription using raw JSON payload (executes immediately) - * returns raw Response. */ - Response retrieveInAppSubscriptionRaw(String inAppSubscriptionAppId, String jsonPayload) - throws Exception { + Response retrieveStoreSubscriptionsRaw(String inAppSubscriptionAppId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/retrieve", @@ -103,17 +105,16 @@ Response retrieveInAppSubscriptionRaw(String inAppSubscriptionAppId, String json return postJson(path, jsonPayload); } - public RetrieveInAppSubscriptionResponse retrieveInAppSubscription( - String inAppSubscriptionAppId, RetrieveInAppSubscriptionParams params) throws Exception { - Response response = retrieveInAppSubscriptionRaw(inAppSubscriptionAppId, params); - return RetrieveInAppSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public InAppSubscriptionRetrieveStoreSubscriptionsResponse retrieveStoreSubscriptions( + String inAppSubscriptionAppId, InAppSubscriptionRetrieveStoreSubscriptionsParams params) + throws ChargebeeException { + Response response = retrieveStoreSubscriptionsRaw(inAppSubscriptionAppId, params); + return InAppSubscriptionRetrieveStoreSubscriptionsResponse.fromJson( + response.getBodyAsString(), response); } - /** - * importReceiptForInAppSubscription a inAppSubscription (executes immediately) - returns raw - * Response. - */ - Response importReceiptForInAppSubscriptionRaw(String inAppSubscriptionAppId) throws Exception { + /** importReceipt a inAppSubscription (executes immediately) - returns raw Response. */ + Response importReceiptRaw(String inAppSubscriptionAppId) throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/import_receipt", @@ -124,12 +125,12 @@ Response importReceiptForInAppSubscriptionRaw(String inAppSubscriptionAppId) thr } /** - * importReceiptForInAppSubscription a inAppSubscription using immutable params (executes - * immediately) - returns raw Response. + * importReceipt a inAppSubscription using immutable params (executes immediately) - returns raw + * Response. */ - Response importReceiptForInAppSubscriptionRaw( - String inAppSubscriptionAppId, ImportReceiptForInAppSubscriptionParams params) - throws Exception { + Response importReceiptRaw( + String inAppSubscriptionAppId, InAppSubscriptionImportReceiptParams params) + throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/import_receipt", @@ -139,11 +140,11 @@ Response importReceiptForInAppSubscriptionRaw( } /** - * importReceiptForInAppSubscription a inAppSubscription using raw JSON payload (executes - * immediately) - returns raw Response. + * importReceipt a inAppSubscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response importReceiptForInAppSubscriptionRaw(String inAppSubscriptionAppId, String jsonPayload) - throws Exception { + Response importReceiptRaw(String inAppSubscriptionAppId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/import_receipt", @@ -152,19 +153,15 @@ Response importReceiptForInAppSubscriptionRaw(String inAppSubscriptionAppId, Str return postJson(path, jsonPayload); } - public ImportReceiptForInAppSubscriptionResponse importReceiptForInAppSubscription( - String inAppSubscriptionAppId, ImportReceiptForInAppSubscriptionParams params) - throws Exception { - Response response = importReceiptForInAppSubscriptionRaw(inAppSubscriptionAppId, params); - return ImportReceiptForInAppSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public InAppSubscriptionImportReceiptResponse importReceipt( + String inAppSubscriptionAppId, InAppSubscriptionImportReceiptParams params) + throws ChargebeeException { + Response response = importReceiptRaw(inAppSubscriptionAppId, params); + return InAppSubscriptionImportReceiptResponse.fromJson(response.getBodyAsString(), response); } - /** - * importSubscriptionForInAppSubscription a inAppSubscription (executes immediately) - returns raw - * Response. - */ - Response importSubscriptionForInAppSubscriptionRaw(String inAppSubscriptionAppId) - throws Exception { + /** importSubscription a inAppSubscription (executes immediately) - returns raw Response. */ + Response importSubscriptionRaw(String inAppSubscriptionAppId) throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/import_subscription", @@ -175,12 +172,12 @@ Response importSubscriptionForInAppSubscriptionRaw(String inAppSubscriptionAppId } /** - * importSubscriptionForInAppSubscription a inAppSubscription using immutable params (executes - * immediately) - returns raw Response. + * importSubscription a inAppSubscription using immutable params (executes immediately) - returns + * raw Response. */ - Response importSubscriptionForInAppSubscriptionRaw( - String inAppSubscriptionAppId, ImportSubscriptionForInAppSubscriptionParams params) - throws Exception { + Response importSubscriptionRaw( + String inAppSubscriptionAppId, InAppSubscriptionImportSubscriptionParams params) + throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/import_subscription", @@ -190,11 +187,11 @@ Response importSubscriptionForInAppSubscriptionRaw( } /** - * importSubscriptionForInAppSubscription a inAppSubscription using raw JSON payload (executes - * immediately) - returns raw Response. + * importSubscription a inAppSubscription using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response importSubscriptionForInAppSubscriptionRaw( - String inAppSubscriptionAppId, String jsonPayload) throws Exception { + Response importSubscriptionRaw(String inAppSubscriptionAppId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/import_subscription", @@ -203,20 +200,16 @@ Response importSubscriptionForInAppSubscriptionRaw( return postJson(path, jsonPayload); } - public ImportSubscriptionForInAppSubscriptionResponse importSubscriptionForInAppSubscription( - String inAppSubscriptionAppId, ImportSubscriptionForInAppSubscriptionParams params) - throws Exception { - Response response = importSubscriptionForInAppSubscriptionRaw(inAppSubscriptionAppId, params); - return ImportSubscriptionForInAppSubscriptionResponse.fromJson( + public InAppSubscriptionImportSubscriptionResponse importSubscription( + String inAppSubscriptionAppId, InAppSubscriptionImportSubscriptionParams params) + throws ChargebeeException { + Response response = importSubscriptionRaw(inAppSubscriptionAppId, params); + return InAppSubscriptionImportSubscriptionResponse.fromJson( response.getBodyAsString(), response); } - /** - * processPurchaseCommandForInAppSubscription a inAppSubscription (executes immediately) - returns - * raw Response. - */ - Response processPurchaseCommandForInAppSubscriptionRaw(String inAppSubscriptionAppId) - throws Exception { + /** processReceipt a inAppSubscription (executes immediately) - returns raw Response. */ + Response processReceiptRaw(String inAppSubscriptionAppId) throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/process_purchase_command", @@ -227,12 +220,12 @@ Response processPurchaseCommandForInAppSubscriptionRaw(String inAppSubscriptionA } /** - * processPurchaseCommandForInAppSubscription a inAppSubscription using immutable params (executes - * immediately) - returns raw Response. + * processReceipt a inAppSubscription using immutable params (executes immediately) - returns raw + * Response. */ - Response processPurchaseCommandForInAppSubscriptionRaw( - String inAppSubscriptionAppId, ProcessPurchaseCommandForInAppSubscriptionParams params) - throws Exception { + Response processReceiptRaw( + String inAppSubscriptionAppId, InAppSubscriptionProcessReceiptParams params) + throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/process_purchase_command", @@ -242,11 +235,11 @@ Response processPurchaseCommandForInAppSubscriptionRaw( } /** - * processPurchaseCommandForInAppSubscription a inAppSubscription using raw JSON payload (executes - * immediately) - returns raw Response. + * processReceipt a inAppSubscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response processPurchaseCommandForInAppSubscriptionRaw( - String inAppSubscriptionAppId, String jsonPayload) throws Exception { + Response processReceiptRaw(String inAppSubscriptionAppId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/in_app_subscriptions/{in-app-subscription-app-id}/process_purchase_command", @@ -255,13 +248,10 @@ Response processPurchaseCommandForInAppSubscriptionRaw( return postJson(path, jsonPayload); } - public ProcessPurchaseCommandForInAppSubscriptionResponse - processPurchaseCommandForInAppSubscription( - String inAppSubscriptionAppId, ProcessPurchaseCommandForInAppSubscriptionParams params) - throws Exception { - Response response = - processPurchaseCommandForInAppSubscriptionRaw(inAppSubscriptionAppId, params); - return ProcessPurchaseCommandForInAppSubscriptionResponse.fromJson( - response.getBodyAsString(), response); + public InAppSubscriptionProcessReceiptResponse processReceipt( + String inAppSubscriptionAppId, InAppSubscriptionProcessReceiptParams params) + throws ChargebeeException { + Response response = processReceiptRaw(inAppSubscriptionAppId, params); + return InAppSubscriptionProcessReceiptResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/InvoiceService.java b/src/main/java/com/chargebee/v4/services/InvoiceService.java index 44c9f784..ad4d2284 100644 --- a/src/main/java/com/chargebee/v4/services/InvoiceService.java +++ b/src/main/java/com/chargebee/v4/services/InvoiceService.java @@ -9,111 +9,114 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.invoice.params.DeleteLineItemsForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceDeleteLineItemsParams; -import com.chargebee.v4.models.invoice.params.RemoveCreditNoteForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceRemoveCreditNoteParams; -import com.chargebee.v4.models.invoice.params.RemovePaymentForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceRemovePaymentParams; -import com.chargebee.v4.models.invoice.params.StopDunningForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceStopDunningParams; -import com.chargebee.v4.models.invoice.params.ApplyPaymentsForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceApplyPaymentsParams; -import com.chargebee.v4.models.invoice.params.ApplyPaymentScheduleSchemeForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceApplyPaymentScheduleSchemeParams; import com.chargebee.v4.models.invoice.params.VoidInvoiceParams; -import com.chargebee.v4.models.invoice.params.AddChargeForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceAddChargeParams; -import com.chargebee.v4.models.invoice.params.WriteOffForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceWriteOffParams; -import com.chargebee.v4.models.invoice.params.AddChargeItemForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceAddChargeItemParams; -import com.chargebee.v4.models.invoice.params.PauseDunningForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoicePauseDunningParams; import com.chargebee.v4.models.invoice.params.InvoiceListParams; import com.chargebee.v4.models.invoice.params.InvoiceCreateParams; -import com.chargebee.v4.models.invoice.params.CloseForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceCloseParams; -import com.chargebee.v4.models.invoice.params.ApplyCreditsForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceApplyCreditsParams; + +import com.chargebee.v4.models.invoice.params.InvoiceRetrieveParams; import com.chargebee.v4.models.invoice.params.InvoiceCreateForChargeItemParams; import com.chargebee.v4.models.invoice.params.InvoiceCreateForChargeItemsAndChargesParams; -import com.chargebee.v4.models.invoice.params.DeleteImportedForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceDeleteImportedParams; -import com.chargebee.v4.models.invoice.params.UpdateDetailsForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceUpdateDetailsParams; import com.chargebee.v4.models.invoice.params.InvoicesForCustomerParams; -import com.chargebee.v4.models.invoice.params.RecordPaymentForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceRecordPaymentParams; -import com.chargebee.v4.models.invoice.params.DeleteInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceDeleteParams; import com.chargebee.v4.models.invoice.params.ImportInvoiceParams; -import com.chargebee.v4.models.invoice.params.ResumeDunningForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceResumeDunningParams; -import com.chargebee.v4.models.invoice.params.RecordTaxWithheldForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceRecordTaxWithheldParams; -import com.chargebee.v4.models.invoice.params.RemoveTaxWithheldForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceRemoveTaxWithheldParams; import com.chargebee.v4.models.invoice.params.InvoiceListPaymentReferenceNumbersParams; -import com.chargebee.v4.models.invoice.params.CollectPaymentForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceCollectPaymentParams; -import com.chargebee.v4.models.invoice.params.RefundForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceRefundParams; -import com.chargebee.v4.models.invoice.params.RecordRefundForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceRecordRefundParams; -import com.chargebee.v4.models.invoice.params.PdfForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoicePdfParams; import com.chargebee.v4.models.invoice.params.InvoicesForSubscriptionParams; import com.chargebee.v4.models.invoice.params.InvoiceChargeAddonParams; -import com.chargebee.v4.models.invoice.params.AddAddonChargeForInvoiceParams; +import com.chargebee.v4.models.invoice.params.InvoiceAddAddonChargeParams; import com.chargebee.v4.models.invoice.params.InvoiceChargeParams; -import com.chargebee.v4.models.invoice.responses.DeleteLineItemsForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceDeleteLineItemsResponse; -import com.chargebee.v4.models.invoice.responses.RemoveCreditNoteForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceRemoveCreditNoteResponse; -import com.chargebee.v4.models.invoice.responses.RemovePaymentForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceRemovePaymentResponse; -import com.chargebee.v4.models.invoice.responses.StopDunningForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceStopDunningResponse; -import com.chargebee.v4.models.invoice.responses.ApplyPaymentsForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceApplyPaymentsResponse; -import com.chargebee.v4.models.invoice.responses.ApplyPaymentScheduleSchemeForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceApplyPaymentScheduleSchemeResponse; import com.chargebee.v4.models.invoice.responses.VoidInvoiceResponse; -import com.chargebee.v4.models.invoice.responses.AddChargeForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceAddChargeResponse; -import com.chargebee.v4.models.invoice.responses.SendEinvoiceForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.SendEinvoiceResponse; -import com.chargebee.v4.models.invoice.responses.PaymentSchedulesForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoicePaymentSchedulesResponse; -import com.chargebee.v4.models.invoice.responses.WriteOffForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceWriteOffResponse; -import com.chargebee.v4.models.invoice.responses.AddChargeItemForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceAddChargeItemResponse; -import com.chargebee.v4.models.invoice.responses.PauseDunningForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoicePauseDunningResponse; import com.chargebee.v4.models.invoice.responses.InvoiceListResponse; import com.chargebee.v4.models.invoice.responses.InvoiceCreateResponse; -import com.chargebee.v4.models.invoice.responses.CloseForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceCloseResponse; -import com.chargebee.v4.models.invoice.responses.ApplyCreditsForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceApplyCreditsResponse; import com.chargebee.v4.models.invoice.responses.InvoiceRetrieveResponse; @@ -121,45 +124,45 @@ import com.chargebee.v4.models.invoice.responses.InvoiceCreateForChargeItemsAndChargesResponse; -import com.chargebee.v4.models.invoice.responses.DeleteImportedForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceDeleteImportedResponse; -import com.chargebee.v4.models.invoice.responses.UpdateDetailsForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceUpdateDetailsResponse; import com.chargebee.v4.models.invoice.responses.InvoicesForCustomerResponse; -import com.chargebee.v4.models.invoice.responses.RecordPaymentForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceRecordPaymentResponse; -import com.chargebee.v4.models.invoice.responses.DeleteInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceDeleteResponse; import com.chargebee.v4.models.invoice.responses.ImportInvoiceResponse; -import com.chargebee.v4.models.invoice.responses.ResumeDunningForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceResumeDunningResponse; -import com.chargebee.v4.models.invoice.responses.RecordTaxWithheldForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceRecordTaxWithheldResponse; -import com.chargebee.v4.models.invoice.responses.ResendEinvoiceForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.ResendEinvoiceResponse; -import com.chargebee.v4.models.invoice.responses.RemoveTaxWithheldForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceRemoveTaxWithheldResponse; import com.chargebee.v4.models.invoice.responses.InvoiceListPaymentReferenceNumbersResponse; -import com.chargebee.v4.models.invoice.responses.CollectPaymentForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceCollectPaymentResponse; -import com.chargebee.v4.models.invoice.responses.SyncUsagesForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceSyncUsagesResponse; -import com.chargebee.v4.models.invoice.responses.RefundForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceRefundResponse; -import com.chargebee.v4.models.invoice.responses.RecordRefundForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceRecordRefundResponse; -import com.chargebee.v4.models.invoice.responses.PdfForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoicePdfResponse; import com.chargebee.v4.models.invoice.responses.InvoicesForSubscriptionResponse; -import com.chargebee.v4.models.invoice.responses.DownloadEinvoiceForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.DownloadEinvoiceResponse; import com.chargebee.v4.models.invoice.responses.InvoiceChargeAddonResponse; -import com.chargebee.v4.models.invoice.responses.AddAddonChargeForInvoiceResponse; +import com.chargebee.v4.models.invoice.responses.InvoiceAddAddonChargeResponse; import com.chargebee.v4.models.invoice.responses.InvoiceChargeResponse; @@ -197,8 +200,8 @@ public InvoiceService withOptions(RequestOptions options) { // === Operations === - /** deleteLineItemsForInvoice a invoice (executes immediately) - returns raw Response. */ - Response deleteLineItemsForInvoiceRaw(String invoiceId) throws Exception { + /** deleteLineItems a invoice (executes immediately) - returns raw Response. */ + Response deleteLineItemsRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_line_items", "invoice-id", invoiceId); @@ -206,34 +209,32 @@ Response deleteLineItemsForInvoiceRaw(String invoiceId) throws Exception { } /** - * deleteLineItemsForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * deleteLineItems a invoice using immutable params (executes immediately) - returns raw Response. */ - Response deleteLineItemsForInvoiceRaw(String invoiceId, DeleteLineItemsForInvoiceParams params) - throws Exception { + Response deleteLineItemsRaw(String invoiceId, InvoiceDeleteLineItemsParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_line_items", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * deleteLineItemsForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * deleteLineItems a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response deleteLineItemsForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response deleteLineItemsRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_line_items", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public DeleteLineItemsForInvoiceResponse deleteLineItemsForInvoice( - String invoiceId, DeleteLineItemsForInvoiceParams params) throws Exception { - Response response = deleteLineItemsForInvoiceRaw(invoiceId, params); - return DeleteLineItemsForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceDeleteLineItemsResponse deleteLineItems( + String invoiceId, InvoiceDeleteLineItemsParams params) throws ChargebeeException { + Response response = deleteLineItemsRaw(invoiceId, params); + return InvoiceDeleteLineItemsResponse.fromJson(response.getBodyAsString(), response); } - /** removeCreditNoteForInvoice a invoice (executes immediately) - returns raw Response. */ - Response removeCreditNoteForInvoiceRaw(String invoiceId) throws Exception { + /** removeCreditNote a invoice (executes immediately) - returns raw Response. */ + Response removeCreditNoteRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_credit_note", "invoice-id", invoiceId); @@ -241,34 +242,34 @@ Response removeCreditNoteForInvoiceRaw(String invoiceId) throws Exception { } /** - * removeCreditNoteForInvoice a invoice using immutable params (executes immediately) - returns - * raw Response. + * removeCreditNote a invoice using immutable params (executes immediately) - returns raw + * Response. */ - Response removeCreditNoteForInvoiceRaw(String invoiceId, RemoveCreditNoteForInvoiceParams params) - throws Exception { + Response removeCreditNoteRaw(String invoiceId, InvoiceRemoveCreditNoteParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_credit_note", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * removeCreditNoteForInvoice a invoice using raw JSON payload (executes immediately) - returns - * raw Response. + * removeCreditNote a invoice using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response removeCreditNoteForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response removeCreditNoteRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_credit_note", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public RemoveCreditNoteForInvoiceResponse removeCreditNoteForInvoice( - String invoiceId, RemoveCreditNoteForInvoiceParams params) throws Exception { - Response response = removeCreditNoteForInvoiceRaw(invoiceId, params); - return RemoveCreditNoteForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceRemoveCreditNoteResponse removeCreditNote( + String invoiceId, InvoiceRemoveCreditNoteParams params) throws ChargebeeException { + Response response = removeCreditNoteRaw(invoiceId, params); + return InvoiceRemoveCreditNoteResponse.fromJson(response.getBodyAsString(), response); } - /** removePaymentForInvoice a invoice (executes immediately) - returns raw Response. */ - Response removePaymentForInvoiceRaw(String invoiceId) throws Exception { + /** removePayment a invoice (executes immediately) - returns raw Response. */ + Response removePaymentRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_payment", "invoice-id", invoiceId); @@ -276,69 +277,61 @@ Response removePaymentForInvoiceRaw(String invoiceId) throws Exception { } /** - * removePaymentForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * removePayment a invoice using immutable params (executes immediately) - returns raw Response. */ - Response removePaymentForInvoiceRaw(String invoiceId, RemovePaymentForInvoiceParams params) - throws Exception { + Response removePaymentRaw(String invoiceId, InvoiceRemovePaymentParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_payment", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * removePaymentForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * removePayment a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response removePaymentForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response removePaymentRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_payment", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public RemovePaymentForInvoiceResponse removePaymentForInvoice( - String invoiceId, RemovePaymentForInvoiceParams params) throws Exception { - Response response = removePaymentForInvoiceRaw(invoiceId, params); - return RemovePaymentForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceRemovePaymentResponse removePayment( + String invoiceId, InvoiceRemovePaymentParams params) throws ChargebeeException { + Response response = removePaymentRaw(invoiceId, params); + return InvoiceRemovePaymentResponse.fromJson(response.getBodyAsString(), response); } - /** stopDunningForInvoice a invoice (executes immediately) - returns raw Response. */ - Response stopDunningForInvoiceRaw(String invoiceId) throws Exception { + /** stopDunning a invoice (executes immediately) - returns raw Response. */ + Response stopDunningRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/stop_dunning", "invoice-id", invoiceId); return post(path, null); } - /** - * stopDunningForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. - */ - Response stopDunningForInvoiceRaw(String invoiceId, StopDunningForInvoiceParams params) - throws Exception { + /** stopDunning a invoice using immutable params (executes immediately) - returns raw Response. */ + Response stopDunningRaw(String invoiceId, InvoiceStopDunningParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/stop_dunning", "invoice-id", invoiceId); return post(path, params.toFormData()); } - /** - * stopDunningForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response stopDunningForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + /** stopDunning a invoice using raw JSON payload (executes immediately) - returns raw Response. */ + Response stopDunningRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/stop_dunning", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public StopDunningForInvoiceResponse stopDunningForInvoice( - String invoiceId, StopDunningForInvoiceParams params) throws Exception { - Response response = stopDunningForInvoiceRaw(invoiceId, params); - return StopDunningForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceStopDunningResponse stopDunning(String invoiceId, InvoiceStopDunningParams params) + throws ChargebeeException { + Response response = stopDunningRaw(invoiceId, params); + return InvoiceStopDunningResponse.fromJson(response.getBodyAsString(), response); } - /** applyPaymentsForInvoice a invoice (executes immediately) - returns raw Response. */ - Response applyPaymentsForInvoiceRaw(String invoiceId) throws Exception { + /** applyPayments a invoice (executes immediately) - returns raw Response. */ + Response applyPaymentsRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_payments", "invoice-id", invoiceId); @@ -346,36 +339,32 @@ Response applyPaymentsForInvoiceRaw(String invoiceId) throws Exception { } /** - * applyPaymentsForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * applyPayments a invoice using immutable params (executes immediately) - returns raw Response. */ - Response applyPaymentsForInvoiceRaw(String invoiceId, ApplyPaymentsForInvoiceParams params) - throws Exception { + Response applyPaymentsRaw(String invoiceId, InvoiceApplyPaymentsParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_payments", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * applyPaymentsForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * applyPayments a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response applyPaymentsForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response applyPaymentsRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_payments", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public ApplyPaymentsForInvoiceResponse applyPaymentsForInvoice( - String invoiceId, ApplyPaymentsForInvoiceParams params) throws Exception { - Response response = applyPaymentsForInvoiceRaw(invoiceId, params); - return ApplyPaymentsForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceApplyPaymentsResponse applyPayments( + String invoiceId, InvoiceApplyPaymentsParams params) throws ChargebeeException { + Response response = applyPaymentsRaw(invoiceId, params); + return InvoiceApplyPaymentsResponse.fromJson(response.getBodyAsString(), response); } - /** - * applyPaymentScheduleSchemeForInvoice a invoice (executes immediately) - returns raw Response. - */ - Response applyPaymentScheduleSchemeForInvoiceRaw(String invoiceId) throws Exception { + /** applyPaymentScheduleScheme a invoice (executes immediately) - returns raw Response. */ + Response applyPaymentScheduleSchemeRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams( "/invoices/{invoice-id}/apply_payment_schedule_scheme", "invoice-id", invoiceId); @@ -384,11 +373,11 @@ Response applyPaymentScheduleSchemeForInvoiceRaw(String invoiceId) throws Except } /** - * applyPaymentScheduleSchemeForInvoice a invoice using immutable params (executes immediately) - - * returns raw Response. + * applyPaymentScheduleScheme a invoice using immutable params (executes immediately) - returns + * raw Response. */ - Response applyPaymentScheduleSchemeForInvoiceRaw( - String invoiceId, ApplyPaymentScheduleSchemeForInvoiceParams params) throws Exception { + Response applyPaymentScheduleSchemeRaw( + String invoiceId, InvoiceApplyPaymentScheduleSchemeParams params) throws ChargebeeException { String path = buildPathWithParams( "/invoices/{invoice-id}/apply_payment_schedule_scheme", "invoice-id", invoiceId); @@ -396,142 +385,127 @@ Response applyPaymentScheduleSchemeForInvoiceRaw( } /** - * applyPaymentScheduleSchemeForInvoice a invoice using raw JSON payload (executes immediately) - - * returns raw Response. + * applyPaymentScheduleScheme a invoice using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response applyPaymentScheduleSchemeForInvoiceRaw(String invoiceId, String jsonPayload) - throws Exception { + Response applyPaymentScheduleSchemeRaw(String invoiceId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/invoices/{invoice-id}/apply_payment_schedule_scheme", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public ApplyPaymentScheduleSchemeForInvoiceResponse applyPaymentScheduleSchemeForInvoice( - String invoiceId, ApplyPaymentScheduleSchemeForInvoiceParams params) throws Exception { - Response response = applyPaymentScheduleSchemeForInvoiceRaw(invoiceId, params); - return ApplyPaymentScheduleSchemeForInvoiceResponse.fromJson( - response.getBodyAsString(), response); + public InvoiceApplyPaymentScheduleSchemeResponse applyPaymentScheduleScheme( + String invoiceId, InvoiceApplyPaymentScheduleSchemeParams params) throws ChargebeeException { + Response response = applyPaymentScheduleSchemeRaw(invoiceId, params); + return InvoiceApplyPaymentScheduleSchemeResponse.fromJson(response.getBodyAsString(), response); } /** voidInvoice a invoice (executes immediately) - returns raw Response. */ - Response voidInvoiceRaw(String invoiceId) throws Exception { + Response voidInvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); return post(path, null); } /** voidInvoice a invoice using immutable params (executes immediately) - returns raw Response. */ - Response voidInvoiceRaw(String invoiceId, VoidInvoiceParams params) throws Exception { + Response voidInvoiceRaw(String invoiceId, VoidInvoiceParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** voidInvoice a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response voidInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response voidInvoiceRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); return postJson(path, jsonPayload); } public VoidInvoiceResponse voidInvoice(String invoiceId, VoidInvoiceParams params) - throws Exception { + throws ChargebeeException { Response response = voidInvoiceRaw(invoiceId, params); return VoidInvoiceResponse.fromJson(response.getBodyAsString(), response); } - /** addChargeForInvoice a invoice (executes immediately) - returns raw Response. */ - Response addChargeForInvoiceRaw(String invoiceId) throws Exception { + /** addCharge a invoice (executes immediately) - returns raw Response. */ + Response addChargeRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge", "invoice-id", invoiceId); return post(path, null); } - /** - * addChargeForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. - */ - Response addChargeForInvoiceRaw(String invoiceId, AddChargeForInvoiceParams params) - throws Exception { + /** addCharge a invoice using immutable params (executes immediately) - returns raw Response. */ + Response addChargeRaw(String invoiceId, InvoiceAddChargeParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge", "invoice-id", invoiceId); return post(path, params.toFormData()); } - /** - * addChargeForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response addChargeForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + /** addCharge a invoice using raw JSON payload (executes immediately) - returns raw Response. */ + Response addChargeRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public AddChargeForInvoiceResponse addChargeForInvoice( - String invoiceId, AddChargeForInvoiceParams params) throws Exception { - Response response = addChargeForInvoiceRaw(invoiceId, params); - return AddChargeForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceAddChargeResponse addCharge(String invoiceId, InvoiceAddChargeParams params) + throws ChargebeeException { + Response response = addChargeRaw(invoiceId, params); + return InvoiceAddChargeResponse.fromJson(response.getBodyAsString(), response); } - /** sendEinvoiceForInvoice a invoice (executes immediately) - returns raw Response. */ - Response sendEinvoiceForInvoiceRaw(String invoiceId) throws Exception { + /** sendEinvoice a invoice (executes immediately) - returns raw Response. */ + Response sendEinvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/send_einvoice", "invoice-id", invoiceId); return post(path, null); } - public SendEinvoiceForInvoiceResponse sendEinvoiceForInvoice(String invoiceId) throws Exception { - Response response = sendEinvoiceForInvoiceRaw(invoiceId); - return SendEinvoiceForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public SendEinvoiceResponse sendEinvoice(String invoiceId) throws ChargebeeException { + Response response = sendEinvoiceRaw(invoiceId); + return SendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } - /** paymentSchedulesForInvoice a invoice (executes immediately) - returns raw Response. */ - Response paymentSchedulesForInvoiceRaw(String invoiceId) throws Exception { + /** paymentSchedules a invoice (executes immediately) - returns raw Response. */ + Response paymentSchedulesRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payment_schedules", "invoice-id", invoiceId); return get(path, null); } - public PaymentSchedulesForInvoiceResponse paymentSchedulesForInvoice(String invoiceId) - throws Exception { - Response response = paymentSchedulesForInvoiceRaw(invoiceId); - return PaymentSchedulesForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoicePaymentSchedulesResponse paymentSchedules(String invoiceId) + throws ChargebeeException { + Response response = paymentSchedulesRaw(invoiceId); + return InvoicePaymentSchedulesResponse.fromJson(response.getBodyAsString(), response); } - /** writeOffForInvoice a invoice (executes immediately) - returns raw Response. */ - Response writeOffForInvoiceRaw(String invoiceId) throws Exception { + /** writeOff a invoice (executes immediately) - returns raw Response. */ + Response writeOffRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/write_off", "invoice-id", invoiceId); return post(path, null); } - /** - * writeOffForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. - */ - Response writeOffForInvoiceRaw(String invoiceId, WriteOffForInvoiceParams params) - throws Exception { + /** writeOff a invoice using immutable params (executes immediately) - returns raw Response. */ + Response writeOffRaw(String invoiceId, InvoiceWriteOffParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/write_off", "invoice-id", invoiceId); return post(path, params.toFormData()); } - /** - * writeOffForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response writeOffForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + /** writeOff a invoice using raw JSON payload (executes immediately) - returns raw Response. */ + Response writeOffRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/write_off", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public WriteOffForInvoiceResponse writeOffForInvoice( - String invoiceId, WriteOffForInvoiceParams params) throws Exception { - Response response = writeOffForInvoiceRaw(invoiceId, params); - return WriteOffForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceWriteOffResponse writeOff(String invoiceId, InvoiceWriteOffParams params) + throws ChargebeeException { + Response response = writeOffRaw(invoiceId, params); + return InvoiceWriteOffResponse.fromJson(response.getBodyAsString(), response); } - /** addChargeItemForInvoice a invoice (executes immediately) - returns raw Response. */ - Response addChargeItemForInvoiceRaw(String invoiceId) throws Exception { + /** addChargeItem a invoice (executes immediately) - returns raw Response. */ + Response addChargeItemRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge_item", "invoice-id", invoiceId); @@ -539,34 +513,32 @@ Response addChargeItemForInvoiceRaw(String invoiceId) throws Exception { } /** - * addChargeItemForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * addChargeItem a invoice using immutable params (executes immediately) - returns raw Response. */ - Response addChargeItemForInvoiceRaw(String invoiceId, AddChargeItemForInvoiceParams params) - throws Exception { + Response addChargeItemRaw(String invoiceId, InvoiceAddChargeItemParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge_item", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * addChargeItemForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * addChargeItem a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response addChargeItemForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response addChargeItemRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge_item", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public AddChargeItemForInvoiceResponse addChargeItemForInvoice( - String invoiceId, AddChargeItemForInvoiceParams params) throws Exception { - Response response = addChargeItemForInvoiceRaw(invoiceId, params); - return AddChargeItemForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceAddChargeItemResponse addChargeItem( + String invoiceId, InvoiceAddChargeItemParams params) throws ChargebeeException { + Response response = addChargeItemRaw(invoiceId, params); + return InvoiceAddChargeItemResponse.fromJson(response.getBodyAsString(), response); } - /** pauseDunningForInvoice a invoice (executes immediately) - returns raw Response. */ - Response pauseDunningForInvoiceRaw(String invoiceId) throws Exception { + /** pauseDunning a invoice (executes immediately) - returns raw Response. */ + Response pauseDunningRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/pause_dunning", "invoice-id", invoiceId); @@ -574,110 +546,104 @@ Response pauseDunningForInvoiceRaw(String invoiceId) throws Exception { } /** - * pauseDunningForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * pauseDunning a invoice using immutable params (executes immediately) - returns raw Response. */ - Response pauseDunningForInvoiceRaw(String invoiceId, PauseDunningForInvoiceParams params) - throws Exception { + Response pauseDunningRaw(String invoiceId, InvoicePauseDunningParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/pause_dunning", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * pauseDunningForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * pauseDunning a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response pauseDunningForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response pauseDunningRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/pause_dunning", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public PauseDunningForInvoiceResponse pauseDunningForInvoice( - String invoiceId, PauseDunningForInvoiceParams params) throws Exception { - Response response = pauseDunningForInvoiceRaw(invoiceId, params); - return PauseDunningForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoicePauseDunningResponse pauseDunning( + String invoiceId, InvoicePauseDunningParams params) throws ChargebeeException { + Response response = pauseDunningRaw(invoiceId, params); + return InvoicePauseDunningResponse.fromJson(response.getBodyAsString(), response); } /** list a invoice using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(InvoiceListParams params) throws Exception { + Response listRaw(InvoiceListParams params) throws ChargebeeException { return get("/invoices", params != null ? params.toQueryParams() : null); } /** list a invoice without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/invoices", null); } /** list a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public InvoiceListResponse list(InvoiceListParams params) throws Exception { + public InvoiceListResponse list(InvoiceListParams params) throws ChargebeeException { Response response = listRaw(params); return InvoiceListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public InvoiceListResponse list() throws Exception { + public InvoiceListResponse list() throws ChargebeeException { Response response = listRaw(); return InvoiceListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a invoice using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(InvoiceCreateParams params) throws Exception { + Response createRaw(InvoiceCreateParams params) throws ChargebeeException { return post("/invoices", params != null ? params.toFormData() : null); } /** create a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/invoices", jsonPayload); } - public InvoiceCreateResponse create(InvoiceCreateParams params) throws Exception { + public InvoiceCreateResponse create(InvoiceCreateParams params) throws ChargebeeException { Response response = createRaw(params); return InvoiceCreateResponse.fromJson(response.getBodyAsString(), response); } - /** closeForInvoice a invoice (executes immediately) - returns raw Response. */ - Response closeForInvoiceRaw(String invoiceId) throws Exception { + /** close a invoice (executes immediately) - returns raw Response. */ + Response closeRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/close", "invoice-id", invoiceId); return post(path, null); } - /** - * closeForInvoice a invoice using immutable params (executes immediately) - returns raw Response. - */ - Response closeForInvoiceRaw(String invoiceId, CloseForInvoiceParams params) throws Exception { + /** close a invoice using immutable params (executes immediately) - returns raw Response. */ + Response closeRaw(String invoiceId, InvoiceCloseParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/close", "invoice-id", invoiceId); return post(path, params.toFormData()); } - /** - * closeForInvoice a invoice using raw JSON payload (executes immediately) - returns raw Response. - */ - Response closeForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + /** close a invoice using raw JSON payload (executes immediately) - returns raw Response. */ + Response closeRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/close", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public CloseForInvoiceResponse closeForInvoice(String invoiceId, CloseForInvoiceParams params) - throws Exception { - Response response = closeForInvoiceRaw(invoiceId, params); - return CloseForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceCloseResponse close(String invoiceId, InvoiceCloseParams params) + throws ChargebeeException { + Response response = closeRaw(invoiceId, params); + return InvoiceCloseResponse.fromJson(response.getBodyAsString(), response); } - /** applyCreditsForInvoice a invoice (executes immediately) - returns raw Response. */ - Response applyCreditsForInvoiceRaw(String invoiceId) throws Exception { + /** applyCredits a invoice (executes immediately) - returns raw Response. */ + Response applyCreditsRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_credits", "invoice-id", invoiceId); @@ -685,40 +651,50 @@ Response applyCreditsForInvoiceRaw(String invoiceId) throws Exception { } /** - * applyCreditsForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * applyCredits a invoice using immutable params (executes immediately) - returns raw Response. */ - Response applyCreditsForInvoiceRaw(String invoiceId, ApplyCreditsForInvoiceParams params) - throws Exception { + Response applyCreditsRaw(String invoiceId, InvoiceApplyCreditsParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_credits", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * applyCreditsForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * applyCredits a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response applyCreditsForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response applyCreditsRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_credits", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public ApplyCreditsForInvoiceResponse applyCreditsForInvoice( - String invoiceId, ApplyCreditsForInvoiceParams params) throws Exception { - Response response = applyCreditsForInvoiceRaw(invoiceId, params); - return ApplyCreditsForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceApplyCreditsResponse applyCredits( + String invoiceId, InvoiceApplyCreditsParams params) throws ChargebeeException { + Response response = applyCreditsRaw(invoiceId, params); + return InvoiceApplyCreditsResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a invoice (executes immediately) - returns raw Response. */ - Response retrieveRaw(String invoiceId) throws Exception { + Response retrieveRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}", "invoice-id", invoiceId); return get(path, null); } - public InvoiceRetrieveResponse retrieve(String invoiceId) throws Exception { + /** retrieve a invoice using immutable params (executes immediately) - returns raw Response. */ + Response retrieveRaw(String invoiceId, InvoiceRetrieveParams params) throws ChargebeeException { + String path = buildPathWithParams("/invoices/{invoice-id}", "invoice-id", invoiceId); + return get(path, params != null ? params.toQueryParams() : null); + } + + public InvoiceRetrieveResponse retrieve(String invoiceId, InvoiceRetrieveParams params) + throws ChargebeeException { + Response response = retrieveRaw(invoiceId, params); + return InvoiceRetrieveResponse.fromJson(response.getBodyAsString(), response); + } + + public InvoiceRetrieveResponse retrieve(String invoiceId) throws ChargebeeException { Response response = retrieveRaw(invoiceId); return InvoiceRetrieveResponse.fromJson(response.getBodyAsString(), response); } @@ -727,7 +703,8 @@ public InvoiceRetrieveResponse retrieve(String invoiceId) throws Exception { * createForChargeItem a invoice using immutable params (executes immediately) - returns raw * Response. */ - Response createForChargeItemRaw(InvoiceCreateForChargeItemParams params) throws Exception { + Response createForChargeItemRaw(InvoiceCreateForChargeItemParams params) + throws ChargebeeException { return post("/invoices/create_for_charge_item", params != null ? params.toFormData() : null); } @@ -736,13 +713,13 @@ Response createForChargeItemRaw(InvoiceCreateForChargeItemParams params) throws * createForChargeItem a invoice using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createForChargeItemRaw(String jsonPayload) throws Exception { + Response createForChargeItemRaw(String jsonPayload) throws ChargebeeException { return postJson("/invoices/create_for_charge_item", jsonPayload); } public InvoiceCreateForChargeItemResponse createForChargeItem( - InvoiceCreateForChargeItemParams params) throws Exception { + InvoiceCreateForChargeItemParams params) throws ChargebeeException { Response response = createForChargeItemRaw(params); return InvoiceCreateForChargeItemResponse.fromJson(response.getBodyAsString(), response); @@ -753,7 +730,7 @@ public InvoiceCreateForChargeItemResponse createForChargeItem( * returns raw Response. */ Response createForChargeItemsAndChargesRaw(InvoiceCreateForChargeItemsAndChargesParams params) - throws Exception { + throws ChargebeeException { return post( "/invoices/create_for_charge_items_and_charges", @@ -764,21 +741,21 @@ Response createForChargeItemsAndChargesRaw(InvoiceCreateForChargeItemsAndCharges * createForChargeItemsAndCharges a invoice using raw JSON payload (executes immediately) - * returns raw Response. */ - Response createForChargeItemsAndChargesRaw(String jsonPayload) throws Exception { + Response createForChargeItemsAndChargesRaw(String jsonPayload) throws ChargebeeException { return postJson("/invoices/create_for_charge_items_and_charges", jsonPayload); } public InvoiceCreateForChargeItemsAndChargesResponse createForChargeItemsAndCharges( - InvoiceCreateForChargeItemsAndChargesParams params) throws Exception { + InvoiceCreateForChargeItemsAndChargesParams params) throws ChargebeeException { Response response = createForChargeItemsAndChargesRaw(params); return InvoiceCreateForChargeItemsAndChargesResponse.fromJson( response.getBodyAsString(), response); } - /** deleteImportedForInvoice a invoice (executes immediately) - returns raw Response. */ - Response deleteImportedForInvoiceRaw(String invoiceId) throws Exception { + /** deleteImported a invoice (executes immediately) - returns raw Response. */ + Response deleteImportedRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_imported", "invoice-id", invoiceId); @@ -786,34 +763,32 @@ Response deleteImportedForInvoiceRaw(String invoiceId) throws Exception { } /** - * deleteImportedForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * deleteImported a invoice using immutable params (executes immediately) - returns raw Response. */ - Response deleteImportedForInvoiceRaw(String invoiceId, DeleteImportedForInvoiceParams params) - throws Exception { + Response deleteImportedRaw(String invoiceId, InvoiceDeleteImportedParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_imported", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * deleteImportedForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * deleteImported a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response deleteImportedForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response deleteImportedRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_imported", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public DeleteImportedForInvoiceResponse deleteImportedForInvoice( - String invoiceId, DeleteImportedForInvoiceParams params) throws Exception { - Response response = deleteImportedForInvoiceRaw(invoiceId, params); - return DeleteImportedForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceDeleteImportedResponse deleteImported( + String invoiceId, InvoiceDeleteImportedParams params) throws ChargebeeException { + Response response = deleteImportedRaw(invoiceId, params); + return InvoiceDeleteImportedResponse.fromJson(response.getBodyAsString(), response); } - /** updateDetailsForInvoice a invoice (executes immediately) - returns raw Response. */ - Response updateDetailsForInvoiceRaw(String invoiceId) throws Exception { + /** updateDetails a invoice (executes immediately) - returns raw Response. */ + Response updateDetailsRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/update_details", "invoice-id", invoiceId); @@ -821,30 +796,28 @@ Response updateDetailsForInvoiceRaw(String invoiceId) throws Exception { } /** - * updateDetailsForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * updateDetails a invoice using immutable params (executes immediately) - returns raw Response. */ - Response updateDetailsForInvoiceRaw(String invoiceId, UpdateDetailsForInvoiceParams params) - throws Exception { + Response updateDetailsRaw(String invoiceId, InvoiceUpdateDetailsParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/update_details", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * updateDetailsForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * updateDetails a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateDetailsForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response updateDetailsRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/update_details", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public UpdateDetailsForInvoiceResponse updateDetailsForInvoice( - String invoiceId, UpdateDetailsForInvoiceParams params) throws Exception { - Response response = updateDetailsForInvoiceRaw(invoiceId, params); - return UpdateDetailsForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceUpdateDetailsResponse updateDetails( + String invoiceId, InvoiceUpdateDetailsParams params) throws ChargebeeException { + Response response = updateDetailsRaw(invoiceId, params); + return InvoiceUpdateDetailsResponse.fromJson(response.getBodyAsString(), response); } /** @@ -852,14 +825,14 @@ public UpdateDetailsForInvoiceResponse updateDetailsForInvoice( * Response. */ Response invoicesForCustomerRaw(String customerId, InvoicesForCustomerParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/invoices", "customer-id", customerId); return get(path, params != null ? params.toQueryParams() : null); } /** invoicesForCustomer a invoice without params (executes immediately) - returns raw Response. */ - Response invoicesForCustomerRaw(String customerId) throws Exception { + Response invoicesForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/invoices", "customer-id", customerId); return get(path, null); @@ -869,27 +842,28 @@ Response invoicesForCustomerRaw(String customerId) throws Exception { * invoicesForCustomer a invoice using raw JSON payload (executes immediately) - returns raw * Response. */ - Response invoicesForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response invoicesForCustomerRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/invoices", "customer-id", customerId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public InvoicesForCustomerResponse invoicesForCustomer( - String customerId, InvoicesForCustomerParams params) throws Exception { + String customerId, InvoicesForCustomerParams params) throws ChargebeeException { Response response = invoicesForCustomerRaw(customerId, params); return InvoicesForCustomerResponse.fromJson( response.getBodyAsString(), this, params, customerId, response); } - public InvoicesForCustomerResponse invoicesForCustomer(String customerId) throws Exception { + public InvoicesForCustomerResponse invoicesForCustomer(String customerId) + throws ChargebeeException { Response response = invoicesForCustomerRaw(customerId); return InvoicesForCustomerResponse.fromJson( response.getBodyAsString(), this, null, customerId, response); } - /** recordPaymentForInvoice a invoice (executes immediately) - returns raw Response. */ - Response recordPaymentForInvoiceRaw(String invoiceId) throws Exception { + /** recordPayment a invoice (executes immediately) - returns raw Response. */ + Response recordPaymentRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_payment", "invoice-id", invoiceId); @@ -897,65 +871,59 @@ Response recordPaymentForInvoiceRaw(String invoiceId) throws Exception { } /** - * recordPaymentForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * recordPayment a invoice using immutable params (executes immediately) - returns raw Response. */ - Response recordPaymentForInvoiceRaw(String invoiceId, RecordPaymentForInvoiceParams params) - throws Exception { + Response recordPaymentRaw(String invoiceId, InvoiceRecordPaymentParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_payment", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * recordPaymentForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * recordPayment a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response recordPaymentForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response recordPaymentRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_payment", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public RecordPaymentForInvoiceResponse recordPaymentForInvoice( - String invoiceId, RecordPaymentForInvoiceParams params) throws Exception { - Response response = recordPaymentForInvoiceRaw(invoiceId, params); - return RecordPaymentForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceRecordPaymentResponse recordPayment( + String invoiceId, InvoiceRecordPaymentParams params) throws ChargebeeException { + Response response = recordPaymentRaw(invoiceId, params); + return InvoiceRecordPaymentResponse.fromJson(response.getBodyAsString(), response); } - /** deleteInvoice a invoice (executes immediately) - returns raw Response. */ - Response deleteInvoiceRaw(String invoiceId) throws Exception { + /** delete a invoice (executes immediately) - returns raw Response. */ + Response deleteRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete", "invoice-id", invoiceId); return post(path, null); } - /** - * deleteInvoice a invoice using immutable params (executes immediately) - returns raw Response. - */ - Response deleteInvoiceRaw(String invoiceId, DeleteInvoiceParams params) throws Exception { + /** delete a invoice using immutable params (executes immediately) - returns raw Response. */ + Response deleteRaw(String invoiceId, InvoiceDeleteParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete", "invoice-id", invoiceId); return post(path, params.toFormData()); } - /** - * deleteInvoice a invoice using raw JSON payload (executes immediately) - returns raw Response. - */ - Response deleteInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + /** delete a invoice using raw JSON payload (executes immediately) - returns raw Response. */ + Response deleteRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public DeleteInvoiceResponse deleteInvoice(String invoiceId, DeleteInvoiceParams params) - throws Exception { - Response response = deleteInvoiceRaw(invoiceId, params); - return DeleteInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceDeleteResponse delete(String invoiceId, InvoiceDeleteParams params) + throws ChargebeeException { + Response response = deleteRaw(invoiceId, params); + return InvoiceDeleteResponse.fromJson(response.getBodyAsString(), response); } /** * importInvoice a invoice using immutable params (executes immediately) - returns raw Response. */ - Response importInvoiceRaw(ImportInvoiceParams params) throws Exception { + Response importInvoiceRaw(ImportInvoiceParams params) throws ChargebeeException { return post("/invoices/import_invoice", params != null ? params.toFormData() : null); } @@ -963,19 +931,19 @@ Response importInvoiceRaw(ImportInvoiceParams params) throws Exception { /** * importInvoice a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response importInvoiceRaw(String jsonPayload) throws Exception { + Response importInvoiceRaw(String jsonPayload) throws ChargebeeException { return postJson("/invoices/import_invoice", jsonPayload); } - public ImportInvoiceResponse importInvoice(ImportInvoiceParams params) throws Exception { + public ImportInvoiceResponse importInvoice(ImportInvoiceParams params) throws ChargebeeException { Response response = importInvoiceRaw(params); return ImportInvoiceResponse.fromJson(response.getBodyAsString(), response); } - /** resumeDunningForInvoice a invoice (executes immediately) - returns raw Response. */ - Response resumeDunningForInvoiceRaw(String invoiceId) throws Exception { + /** resumeDunning a invoice (executes immediately) - returns raw Response. */ + Response resumeDunningRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/resume_dunning", "invoice-id", invoiceId); @@ -983,34 +951,32 @@ Response resumeDunningForInvoiceRaw(String invoiceId) throws Exception { } /** - * resumeDunningForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * resumeDunning a invoice using immutable params (executes immediately) - returns raw Response. */ - Response resumeDunningForInvoiceRaw(String invoiceId, ResumeDunningForInvoiceParams params) - throws Exception { + Response resumeDunningRaw(String invoiceId, InvoiceResumeDunningParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/resume_dunning", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * resumeDunningForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * resumeDunning a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response resumeDunningForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response resumeDunningRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/resume_dunning", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public ResumeDunningForInvoiceResponse resumeDunningForInvoice( - String invoiceId, ResumeDunningForInvoiceParams params) throws Exception { - Response response = resumeDunningForInvoiceRaw(invoiceId, params); - return ResumeDunningForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceResumeDunningResponse resumeDunning( + String invoiceId, InvoiceResumeDunningParams params) throws ChargebeeException { + Response response = resumeDunningRaw(invoiceId, params); + return InvoiceResumeDunningResponse.fromJson(response.getBodyAsString(), response); } - /** recordTaxWithheldForInvoice a invoice (executes immediately) - returns raw Response. */ - Response recordTaxWithheldForInvoiceRaw(String invoiceId) throws Exception { + /** recordTaxWithheld a invoice (executes immediately) - returns raw Response. */ + Response recordTaxWithheldRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_tax_withheld", "invoice-id", invoiceId); @@ -1018,48 +984,47 @@ Response recordTaxWithheldForInvoiceRaw(String invoiceId) throws Exception { } /** - * recordTaxWithheldForInvoice a invoice using immutable params (executes immediately) - returns - * raw Response. + * recordTaxWithheld a invoice using immutable params (executes immediately) - returns raw + * Response. */ - Response recordTaxWithheldForInvoiceRaw( - String invoiceId, RecordTaxWithheldForInvoiceParams params) throws Exception { + Response recordTaxWithheldRaw(String invoiceId, InvoiceRecordTaxWithheldParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_tax_withheld", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * recordTaxWithheldForInvoice a invoice using raw JSON payload (executes immediately) - returns - * raw Response. + * recordTaxWithheld a invoice using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response recordTaxWithheldForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response recordTaxWithheldRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_tax_withheld", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public RecordTaxWithheldForInvoiceResponse recordTaxWithheldForInvoice( - String invoiceId, RecordTaxWithheldForInvoiceParams params) throws Exception { - Response response = recordTaxWithheldForInvoiceRaw(invoiceId, params); - return RecordTaxWithheldForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceRecordTaxWithheldResponse recordTaxWithheld( + String invoiceId, InvoiceRecordTaxWithheldParams params) throws ChargebeeException { + Response response = recordTaxWithheldRaw(invoiceId, params); + return InvoiceRecordTaxWithheldResponse.fromJson(response.getBodyAsString(), response); } - /** resendEinvoiceForInvoice a invoice (executes immediately) - returns raw Response. */ - Response resendEinvoiceForInvoiceRaw(String invoiceId) throws Exception { + /** resendEinvoice a invoice (executes immediately) - returns raw Response. */ + Response resendEinvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/resend_einvoice", "invoice-id", invoiceId); return post(path, null); } - public ResendEinvoiceForInvoiceResponse resendEinvoiceForInvoice(String invoiceId) - throws Exception { - Response response = resendEinvoiceForInvoiceRaw(invoiceId); - return ResendEinvoiceForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public ResendEinvoiceResponse resendEinvoice(String invoiceId) throws ChargebeeException { + Response response = resendEinvoiceRaw(invoiceId); + return ResendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } - /** removeTaxWithheldForInvoice a invoice (executes immediately) - returns raw Response. */ - Response removeTaxWithheldForInvoiceRaw(String invoiceId) throws Exception { + /** removeTaxWithheld a invoice (executes immediately) - returns raw Response. */ + Response removeTaxWithheldRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_tax_withheld", "invoice-id", invoiceId); @@ -1067,30 +1032,30 @@ Response removeTaxWithheldForInvoiceRaw(String invoiceId) throws Exception { } /** - * removeTaxWithheldForInvoice a invoice using immutable params (executes immediately) - returns - * raw Response. + * removeTaxWithheld a invoice using immutable params (executes immediately) - returns raw + * Response. */ - Response removeTaxWithheldForInvoiceRaw( - String invoiceId, RemoveTaxWithheldForInvoiceParams params) throws Exception { + Response removeTaxWithheldRaw(String invoiceId, InvoiceRemoveTaxWithheldParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_tax_withheld", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * removeTaxWithheldForInvoice a invoice using raw JSON payload (executes immediately) - returns - * raw Response. + * removeTaxWithheld a invoice using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response removeTaxWithheldForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response removeTaxWithheldRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_tax_withheld", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public RemoveTaxWithheldForInvoiceResponse removeTaxWithheldForInvoice( - String invoiceId, RemoveTaxWithheldForInvoiceParams params) throws Exception { - Response response = removeTaxWithheldForInvoiceRaw(invoiceId, params); - return RemoveTaxWithheldForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceRemoveTaxWithheldResponse removeTaxWithheld( + String invoiceId, InvoiceRemoveTaxWithheldParams params) throws ChargebeeException { + Response response = removeTaxWithheldRaw(invoiceId, params); + return InvoiceRemoveTaxWithheldResponse.fromJson(response.getBodyAsString(), response); } /** @@ -1098,7 +1063,7 @@ public RemoveTaxWithheldForInvoiceResponse removeTaxWithheldForInvoice( * raw Response. */ Response listPaymentReferenceNumbersRaw(InvoiceListPaymentReferenceNumbersParams params) - throws Exception { + throws ChargebeeException { return get( "/invoices/payment_reference_numbers", params != null ? params.toQueryParams() : null); @@ -1108,7 +1073,7 @@ Response listPaymentReferenceNumbersRaw(InvoiceListPaymentReferenceNumbersParams * listPaymentReferenceNumbers a invoice without params (executes immediately) - returns raw * Response. */ - Response listPaymentReferenceNumbersRaw() throws Exception { + Response listPaymentReferenceNumbersRaw() throws ChargebeeException { return get("/invoices/payment_reference_numbers", null); } @@ -1117,27 +1082,28 @@ Response listPaymentReferenceNumbersRaw() throws Exception { * listPaymentReferenceNumbers a invoice using raw JSON payload (executes immediately) - returns * raw Response. */ - Response listPaymentReferenceNumbersRaw(String jsonPayload) throws Exception { + Response listPaymentReferenceNumbersRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public InvoiceListPaymentReferenceNumbersResponse listPaymentReferenceNumbers( - InvoiceListPaymentReferenceNumbersParams params) throws Exception { + InvoiceListPaymentReferenceNumbersParams params) throws ChargebeeException { Response response = listPaymentReferenceNumbersRaw(params); return InvoiceListPaymentReferenceNumbersResponse.fromJson( response.getBodyAsString(), this, params, response); } - public InvoiceListPaymentReferenceNumbersResponse listPaymentReferenceNumbers() throws Exception { + public InvoiceListPaymentReferenceNumbersResponse listPaymentReferenceNumbers() + throws ChargebeeException { Response response = listPaymentReferenceNumbersRaw(); return InvoiceListPaymentReferenceNumbersResponse.fromJson( response.getBodyAsString(), this, null, response); } - /** collectPaymentForInvoice a invoice (executes immediately) - returns raw Response. */ - Response collectPaymentForInvoiceRaw(String invoiceId) throws Exception { + /** collectPayment a invoice (executes immediately) - returns raw Response. */ + Response collectPaymentRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/collect_payment", "invoice-id", invoiceId); @@ -1145,78 +1111,70 @@ Response collectPaymentForInvoiceRaw(String invoiceId) throws Exception { } /** - * collectPaymentForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * collectPayment a invoice using immutable params (executes immediately) - returns raw Response. */ - Response collectPaymentForInvoiceRaw(String invoiceId, CollectPaymentForInvoiceParams params) - throws Exception { + Response collectPaymentRaw(String invoiceId, InvoiceCollectPaymentParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/collect_payment", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * collectPaymentForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * collectPayment a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response collectPaymentForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response collectPaymentRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/collect_payment", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public CollectPaymentForInvoiceResponse collectPaymentForInvoice( - String invoiceId, CollectPaymentForInvoiceParams params) throws Exception { - Response response = collectPaymentForInvoiceRaw(invoiceId, params); - return CollectPaymentForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceCollectPaymentResponse collectPayment( + String invoiceId, InvoiceCollectPaymentParams params) throws ChargebeeException { + Response response = collectPaymentRaw(invoiceId, params); + return InvoiceCollectPaymentResponse.fromJson(response.getBodyAsString(), response); } - /** syncUsagesForInvoice a invoice (executes immediately) - returns raw Response. */ - Response syncUsagesForInvoiceRaw(String invoiceId) throws Exception { + /** syncUsages a invoice (executes immediately) - returns raw Response. */ + Response syncUsagesRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/sync_usages", "invoice-id", invoiceId); return post(path, null); } - public SyncUsagesForInvoiceResponse syncUsagesForInvoice(String invoiceId) throws Exception { - Response response = syncUsagesForInvoiceRaw(invoiceId); - return SyncUsagesForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceSyncUsagesResponse syncUsages(String invoiceId) throws ChargebeeException { + Response response = syncUsagesRaw(invoiceId); + return InvoiceSyncUsagesResponse.fromJson(response.getBodyAsString(), response); } - /** refundForInvoice a invoice (executes immediately) - returns raw Response. */ - Response refundForInvoiceRaw(String invoiceId) throws Exception { + /** refund a invoice (executes immediately) - returns raw Response. */ + Response refundRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/refund", "invoice-id", invoiceId); return post(path, null); } - /** - * refundForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. - */ - Response refundForInvoiceRaw(String invoiceId, RefundForInvoiceParams params) throws Exception { + /** refund a invoice using immutable params (executes immediately) - returns raw Response. */ + Response refundRaw(String invoiceId, InvoiceRefundParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/refund", "invoice-id", invoiceId); return post(path, params.toFormData()); } - /** - * refundForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response refundForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + /** refund a invoice using raw JSON payload (executes immediately) - returns raw Response. */ + Response refundRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/refund", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public RefundForInvoiceResponse refundForInvoice(String invoiceId, RefundForInvoiceParams params) - throws Exception { - Response response = refundForInvoiceRaw(invoiceId, params); - return RefundForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceRefundResponse refund(String invoiceId, InvoiceRefundParams params) + throws ChargebeeException { + Response response = refundRaw(invoiceId, params); + return InvoiceRefundResponse.fromJson(response.getBodyAsString(), response); } - /** recordRefundForInvoice a invoice (executes immediately) - returns raw Response. */ - Response recordRefundForInvoiceRaw(String invoiceId) throws Exception { + /** recordRefund a invoice (executes immediately) - returns raw Response. */ + Response recordRefundRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_refund", "invoice-id", invoiceId); @@ -1224,59 +1182,53 @@ Response recordRefundForInvoiceRaw(String invoiceId) throws Exception { } /** - * recordRefundForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * recordRefund a invoice using immutable params (executes immediately) - returns raw Response. */ - Response recordRefundForInvoiceRaw(String invoiceId, RecordRefundForInvoiceParams params) - throws Exception { + Response recordRefundRaw(String invoiceId, InvoiceRecordRefundParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_refund", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * recordRefundForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * recordRefund a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response recordRefundForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response recordRefundRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_refund", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public RecordRefundForInvoiceResponse recordRefundForInvoice( - String invoiceId, RecordRefundForInvoiceParams params) throws Exception { - Response response = recordRefundForInvoiceRaw(invoiceId, params); - return RecordRefundForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceRecordRefundResponse recordRefund( + String invoiceId, InvoiceRecordRefundParams params) throws ChargebeeException { + Response response = recordRefundRaw(invoiceId, params); + return InvoiceRecordRefundResponse.fromJson(response.getBodyAsString(), response); } - /** pdfForInvoice a invoice (executes immediately) - returns raw Response. */ - Response pdfForInvoiceRaw(String invoiceId) throws Exception { + /** pdf a invoice (executes immediately) - returns raw Response. */ + Response pdfRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/pdf", "invoice-id", invoiceId); return post(path, null); } - /** - * pdfForInvoice a invoice using immutable params (executes immediately) - returns raw Response. - */ - Response pdfForInvoiceRaw(String invoiceId, PdfForInvoiceParams params) throws Exception { + /** pdf a invoice using immutable params (executes immediately) - returns raw Response. */ + Response pdfRaw(String invoiceId, InvoicePdfParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/pdf", "invoice-id", invoiceId); return post(path, params.toFormData()); } - /** - * pdfForInvoice a invoice using raw JSON payload (executes immediately) - returns raw Response. - */ - Response pdfForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + /** pdf a invoice using raw JSON payload (executes immediately) - returns raw Response. */ + Response pdfRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/pdf", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public PdfForInvoiceResponse pdfForInvoice(String invoiceId, PdfForInvoiceParams params) - throws Exception { - Response response = pdfForInvoiceRaw(invoiceId, params); - return PdfForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoicePdfResponse pdf(String invoiceId, InvoicePdfParams params) + throws ChargebeeException { + Response response = pdfRaw(invoiceId, params); + return InvoicePdfResponse.fromJson(response.getBodyAsString(), response); } /** @@ -1284,7 +1236,7 @@ public PdfForInvoiceResponse pdfForInvoice(String invoiceId, PdfForInvoiceParams * Response. */ Response invoicesForSubscriptionRaw(String subscriptionId, InvoicesForSubscriptionParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/invoices", "subscription-id", subscriptionId); @@ -1294,7 +1246,7 @@ Response invoicesForSubscriptionRaw(String subscriptionId, InvoicesForSubscripti /** * invoicesForSubscription a invoice without params (executes immediately) - returns raw Response. */ - Response invoicesForSubscriptionRaw(String subscriptionId) throws Exception { + Response invoicesForSubscriptionRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/invoices", "subscription-id", subscriptionId); @@ -1305,7 +1257,8 @@ Response invoicesForSubscriptionRaw(String subscriptionId) throws Exception { * invoicesForSubscription a invoice using raw JSON payload (executes immediately) - returns raw * Response. */ - Response invoicesForSubscriptionRaw(String subscriptionId, String jsonPayload) throws Exception { + Response invoicesForSubscriptionRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/invoices", "subscription-id", subscriptionId); @@ -1313,53 +1266,53 @@ Response invoicesForSubscriptionRaw(String subscriptionId, String jsonPayload) t } public InvoicesForSubscriptionResponse invoicesForSubscription( - String subscriptionId, InvoicesForSubscriptionParams params) throws Exception { + String subscriptionId, InvoicesForSubscriptionParams params) throws ChargebeeException { Response response = invoicesForSubscriptionRaw(subscriptionId, params); return InvoicesForSubscriptionResponse.fromJson( response.getBodyAsString(), this, params, subscriptionId, response); } public InvoicesForSubscriptionResponse invoicesForSubscription(String subscriptionId) - throws Exception { + throws ChargebeeException { Response response = invoicesForSubscriptionRaw(subscriptionId); return InvoicesForSubscriptionResponse.fromJson( response.getBodyAsString(), this, null, subscriptionId, response); } - /** downloadEinvoiceForInvoice a invoice (executes immediately) - returns raw Response. */ - Response downloadEinvoiceForInvoiceRaw(String invoiceId) throws Exception { + /** downloadEinvoice a invoice (executes immediately) - returns raw Response. */ + Response downloadEinvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/download_einvoice", "invoice-id", invoiceId); return get(path, null); } - public DownloadEinvoiceForInvoiceResponse downloadEinvoiceForInvoice(String invoiceId) - throws Exception { - Response response = downloadEinvoiceForInvoiceRaw(invoiceId); - return DownloadEinvoiceForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public DownloadEinvoiceResponse downloadEinvoice(String invoiceId) throws ChargebeeException { + Response response = downloadEinvoiceRaw(invoiceId); + return DownloadEinvoiceResponse.fromJson(response.getBodyAsString(), response); } /** chargeAddon a invoice using immutable params (executes immediately) - returns raw Response. */ - Response chargeAddonRaw(InvoiceChargeAddonParams params) throws Exception { + Response chargeAddonRaw(InvoiceChargeAddonParams params) throws ChargebeeException { return post("/invoices/charge_addon", params != null ? params.toFormData() : null); } /** chargeAddon a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response chargeAddonRaw(String jsonPayload) throws Exception { + Response chargeAddonRaw(String jsonPayload) throws ChargebeeException { return postJson("/invoices/charge_addon", jsonPayload); } - public InvoiceChargeAddonResponse chargeAddon(InvoiceChargeAddonParams params) throws Exception { + public InvoiceChargeAddonResponse chargeAddon(InvoiceChargeAddonParams params) + throws ChargebeeException { Response response = chargeAddonRaw(params); return InvoiceChargeAddonResponse.fromJson(response.getBodyAsString(), response); } - /** addAddonChargeForInvoice a invoice (executes immediately) - returns raw Response. */ - Response addAddonChargeForInvoiceRaw(String invoiceId) throws Exception { + /** addAddonCharge a invoice (executes immediately) - returns raw Response. */ + Response addAddonChargeRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_addon_charge", "invoice-id", invoiceId); @@ -1367,45 +1320,43 @@ Response addAddonChargeForInvoiceRaw(String invoiceId) throws Exception { } /** - * addAddonChargeForInvoice a invoice using immutable params (executes immediately) - returns raw - * Response. + * addAddonCharge a invoice using immutable params (executes immediately) - returns raw Response. */ - Response addAddonChargeForInvoiceRaw(String invoiceId, AddAddonChargeForInvoiceParams params) - throws Exception { + Response addAddonChargeRaw(String invoiceId, InvoiceAddAddonChargeParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_addon_charge", "invoice-id", invoiceId); return post(path, params.toFormData()); } /** - * addAddonChargeForInvoice a invoice using raw JSON payload (executes immediately) - returns raw - * Response. + * addAddonCharge a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response addAddonChargeForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response addAddonChargeRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_addon_charge", "invoice-id", invoiceId); return postJson(path, jsonPayload); } - public AddAddonChargeForInvoiceResponse addAddonChargeForInvoice( - String invoiceId, AddAddonChargeForInvoiceParams params) throws Exception { - Response response = addAddonChargeForInvoiceRaw(invoiceId, params); - return AddAddonChargeForInvoiceResponse.fromJson(response.getBodyAsString(), response); + public InvoiceAddAddonChargeResponse addAddonCharge( + String invoiceId, InvoiceAddAddonChargeParams params) throws ChargebeeException { + Response response = addAddonChargeRaw(invoiceId, params); + return InvoiceAddAddonChargeResponse.fromJson(response.getBodyAsString(), response); } /** charge a invoice using immutable params (executes immediately) - returns raw Response. */ - Response chargeRaw(InvoiceChargeParams params) throws Exception { + Response chargeRaw(InvoiceChargeParams params) throws ChargebeeException { return post("/invoices/charge", params != null ? params.toFormData() : null); } /** charge a invoice using raw JSON payload (executes immediately) - returns raw Response. */ - Response chargeRaw(String jsonPayload) throws Exception { + Response chargeRaw(String jsonPayload) throws ChargebeeException { return postJson("/invoices/charge", jsonPayload); } - public InvoiceChargeResponse charge(InvoiceChargeParams params) throws Exception { + public InvoiceChargeResponse charge(InvoiceChargeParams params) throws ChargebeeException { Response response = chargeRaw(params); return InvoiceChargeResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java b/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java index cb9b2d8d..c832d093 100644 --- a/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java @@ -9,23 +9,24 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.itemEntitlement.params.ItemEntitlementsForFeatureParams; -import com.chargebee.v4.models.itemEntitlement.params.AddItemEntitlementForFeatureParams; +import com.chargebee.v4.models.itemEntitlement.params.AddItemEntitlementsParams; import com.chargebee.v4.models.itemEntitlement.params.ItemEntitlementsForItemParams; -import com.chargebee.v4.models.itemEntitlement.params.AddItemEntitlementForItemParams; +import com.chargebee.v4.models.itemEntitlement.params.UpsertOrRemoveItemEntitlementsForItemParams; import com.chargebee.v4.models.itemEntitlement.responses.ItemEntitlementsForFeatureResponse; -import com.chargebee.v4.models.itemEntitlement.responses.AddItemEntitlementForFeatureResponse; +import com.chargebee.v4.models.itemEntitlement.responses.AddItemEntitlementsResponse; import com.chargebee.v4.models.itemEntitlement.responses.ItemEntitlementsForItemResponse; -import com.chargebee.v4.models.itemEntitlement.responses.AddItemEntitlementForItemResponse; +import com.chargebee.v4.models.itemEntitlement.responses.UpsertOrRemoveItemEntitlementsForItemResponse; public final class ItemEntitlementService extends BaseService { @@ -67,7 +68,7 @@ public ItemEntitlementService withOptions(RequestOptions options) { * returns raw Response. */ Response itemEntitlementsForFeatureRaw(String featureId, ItemEntitlementsForFeatureParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); return get(path, params != null ? params.toQueryParams() : null); @@ -77,7 +78,7 @@ Response itemEntitlementsForFeatureRaw(String featureId, ItemEntitlementsForFeat * itemEntitlementsForFeature a itemEntitlement without params (executes immediately) - returns * raw Response. */ - Response itemEntitlementsForFeatureRaw(String featureId) throws Exception { + Response itemEntitlementsForFeatureRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); return get(path, null); @@ -87,30 +88,29 @@ Response itemEntitlementsForFeatureRaw(String featureId) throws Exception { * itemEntitlementsForFeature a itemEntitlement using raw JSON payload (executes immediately) - * returns raw Response. */ - Response itemEntitlementsForFeatureRaw(String featureId, String jsonPayload) throws Exception { + Response itemEntitlementsForFeatureRaw(String featureId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public ItemEntitlementsForFeatureResponse itemEntitlementsForFeature( - String featureId, ItemEntitlementsForFeatureParams params) throws Exception { + String featureId, ItemEntitlementsForFeatureParams params) throws ChargebeeException { Response response = itemEntitlementsForFeatureRaw(featureId, params); return ItemEntitlementsForFeatureResponse.fromJson( response.getBodyAsString(), this, params, featureId, response); } public ItemEntitlementsForFeatureResponse itemEntitlementsForFeature(String featureId) - throws Exception { + throws ChargebeeException { Response response = itemEntitlementsForFeatureRaw(featureId); return ItemEntitlementsForFeatureResponse.fromJson( response.getBodyAsString(), this, null, featureId, response); } - /** - * addItemEntitlementForFeature a itemEntitlement (executes immediately) - returns raw Response. - */ - Response addItemEntitlementForFeatureRaw(String featureId) throws Exception { + /** addItemEntitlements a itemEntitlement (executes immediately) - returns raw Response. */ + Response addItemEntitlementsRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); @@ -118,30 +118,30 @@ Response addItemEntitlementForFeatureRaw(String featureId) throws Exception { } /** - * addItemEntitlementForFeature a itemEntitlement using immutable params (executes immediately) - - * returns raw Response. + * addItemEntitlements a itemEntitlement using immutable params (executes immediately) - returns + * raw Response. */ - Response addItemEntitlementForFeatureRaw( - String featureId, AddItemEntitlementForFeatureParams params) throws Exception { + Response addItemEntitlementsRaw(String featureId, AddItemEntitlementsParams params) + throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); return post(path, params.toFormData()); } /** - * addItemEntitlementForFeature a itemEntitlement using raw JSON payload (executes immediately) - - * returns raw Response. + * addItemEntitlements a itemEntitlement using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response addItemEntitlementForFeatureRaw(String featureId, String jsonPayload) throws Exception { + Response addItemEntitlementsRaw(String featureId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); return postJson(path, jsonPayload); } - public AddItemEntitlementForFeatureResponse addItemEntitlementForFeature( - String featureId, AddItemEntitlementForFeatureParams params) throws Exception { - Response response = addItemEntitlementForFeatureRaw(featureId, params); - return AddItemEntitlementForFeatureResponse.fromJson(response.getBodyAsString(), response); + public AddItemEntitlementsResponse addItemEntitlements( + String featureId, AddItemEntitlementsParams params) throws ChargebeeException { + Response response = addItemEntitlementsRaw(featureId, params); + return AddItemEntitlementsResponse.fromJson(response.getBodyAsString(), response); } /** @@ -149,7 +149,7 @@ public AddItemEntitlementForFeatureResponse addItemEntitlementForFeature( * returns raw Response. */ Response itemEntitlementsForItemRaw(String itemId, ItemEntitlementsForItemParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); return get(path, params != null ? params.toQueryParams() : null); } @@ -158,7 +158,7 @@ Response itemEntitlementsForItemRaw(String itemId, ItemEntitlementsForItemParams * itemEntitlementsForItem a itemEntitlement without params (executes immediately) - returns raw * Response. */ - Response itemEntitlementsForItemRaw(String itemId) throws Exception { + Response itemEntitlementsForItemRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); return get(path, null); } @@ -167,53 +167,59 @@ Response itemEntitlementsForItemRaw(String itemId) throws Exception { * itemEntitlementsForItem a itemEntitlement using raw JSON payload (executes immediately) - * returns raw Response. */ - Response itemEntitlementsForItemRaw(String itemId, String jsonPayload) throws Exception { + Response itemEntitlementsForItemRaw(String itemId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public ItemEntitlementsForItemResponse itemEntitlementsForItem( - String itemId, ItemEntitlementsForItemParams params) throws Exception { + String itemId, ItemEntitlementsForItemParams params) throws ChargebeeException { Response response = itemEntitlementsForItemRaw(itemId, params); return ItemEntitlementsForItemResponse.fromJson( response.getBodyAsString(), this, params, itemId, response); } - public ItemEntitlementsForItemResponse itemEntitlementsForItem(String itemId) throws Exception { + public ItemEntitlementsForItemResponse itemEntitlementsForItem(String itemId) + throws ChargebeeException { Response response = itemEntitlementsForItemRaw(itemId); return ItemEntitlementsForItemResponse.fromJson( response.getBodyAsString(), this, null, itemId, response); } - /** addItemEntitlementForItem a itemEntitlement (executes immediately) - returns raw Response. */ - Response addItemEntitlementForItemRaw(String itemId) throws Exception { + /** + * upsertOrRemoveItemEntitlementsForItem a itemEntitlement (executes immediately) - returns raw + * Response. + */ + Response upsertOrRemoveItemEntitlementsForItemRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); return post(path, null); } /** - * addItemEntitlementForItem a itemEntitlement using immutable params (executes immediately) - - * returns raw Response. + * upsertOrRemoveItemEntitlementsForItem a itemEntitlement using immutable params (executes + * immediately) - returns raw Response. */ - Response addItemEntitlementForItemRaw(String itemId, AddItemEntitlementForItemParams params) - throws Exception { + Response upsertOrRemoveItemEntitlementsForItemRaw( + String itemId, UpsertOrRemoveItemEntitlementsForItemParams params) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); return post(path, params.toFormData()); } /** - * addItemEntitlementForItem a itemEntitlement using raw JSON payload (executes immediately) - - * returns raw Response. + * upsertOrRemoveItemEntitlementsForItem a itemEntitlement using raw JSON payload (executes + * immediately) - returns raw Response. */ - Response addItemEntitlementForItemRaw(String itemId, String jsonPayload) throws Exception { + Response upsertOrRemoveItemEntitlementsForItemRaw(String itemId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); return postJson(path, jsonPayload); } - public AddItemEntitlementForItemResponse addItemEntitlementForItem( - String itemId, AddItemEntitlementForItemParams params) throws Exception { - Response response = addItemEntitlementForItemRaw(itemId, params); - return AddItemEntitlementForItemResponse.fromJson(response.getBodyAsString(), response); + public UpsertOrRemoveItemEntitlementsForItemResponse upsertOrRemoveItemEntitlementsForItem( + String itemId, UpsertOrRemoveItemEntitlementsForItemParams params) throws ChargebeeException { + Response response = upsertOrRemoveItemEntitlementsForItemRaw(itemId, params); + return UpsertOrRemoveItemEntitlementsForItemResponse.fromJson( + response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/ItemFamilyService.java b/src/main/java/com/chargebee/v4/services/ItemFamilyService.java index cd1d96bd..2cce05e9 100644 --- a/src/main/java/com/chargebee/v4/services/ItemFamilyService.java +++ b/src/main/java/com/chargebee/v4/services/ItemFamilyService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.itemFamily.params.ItemFamilyListParams; @@ -17,7 +18,7 @@ import com.chargebee.v4.models.itemFamily.params.ItemFamilyUpdateParams; -import com.chargebee.v4.models.itemFamily.responses.DeleteItemFamilyResponse; +import com.chargebee.v4.models.itemFamily.responses.ItemFamilyDeleteResponse; import com.chargebee.v4.models.itemFamily.responses.ItemFamilyListResponse; @@ -61,8 +62,8 @@ public ItemFamilyService withOptions(RequestOptions options) { // === Operations === - /** deleteItemFamily a itemFamily (executes immediately) - returns raw Response. */ - Response deleteItemFamilyRaw(String itemFamilyId) throws Exception { + /** delete a itemFamily (executes immediately) - returns raw Response. */ + Response deleteRaw(String itemFamilyId) throws ChargebeeException { String path = buildPathWithParams( "/item_families/{item-family-id}/delete", "item-family-id", itemFamilyId); @@ -70,73 +71,73 @@ Response deleteItemFamilyRaw(String itemFamilyId) throws Exception { return post(path, null); } - public DeleteItemFamilyResponse deleteItemFamily(String itemFamilyId) throws Exception { - Response response = deleteItemFamilyRaw(itemFamilyId); - return DeleteItemFamilyResponse.fromJson(response.getBodyAsString(), response); + public ItemFamilyDeleteResponse delete(String itemFamilyId) throws ChargebeeException { + Response response = deleteRaw(itemFamilyId); + return ItemFamilyDeleteResponse.fromJson(response.getBodyAsString(), response); } /** list a itemFamily using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(ItemFamilyListParams params) throws Exception { + Response listRaw(ItemFamilyListParams params) throws ChargebeeException { return get("/item_families", params != null ? params.toQueryParams() : null); } /** list a itemFamily without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/item_families", null); } /** list a itemFamily using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public ItemFamilyListResponse list(ItemFamilyListParams params) throws Exception { + public ItemFamilyListResponse list(ItemFamilyListParams params) throws ChargebeeException { Response response = listRaw(params); return ItemFamilyListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public ItemFamilyListResponse list() throws Exception { + public ItemFamilyListResponse list() throws ChargebeeException { Response response = listRaw(); return ItemFamilyListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a itemFamily using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(ItemFamilyCreateParams params) throws Exception { + Response createRaw(ItemFamilyCreateParams params) throws ChargebeeException { return post("/item_families", params != null ? params.toFormData() : null); } /** create a itemFamily using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/item_families", jsonPayload); } - public ItemFamilyCreateResponse create(ItemFamilyCreateParams params) throws Exception { + public ItemFamilyCreateResponse create(ItemFamilyCreateParams params) throws ChargebeeException { Response response = createRaw(params); return ItemFamilyCreateResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a itemFamily (executes immediately) - returns raw Response. */ - Response retrieveRaw(String itemFamilyId) throws Exception { + Response retrieveRaw(String itemFamilyId) throws ChargebeeException { String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); return get(path, null); } - public ItemFamilyRetrieveResponse retrieve(String itemFamilyId) throws Exception { + public ItemFamilyRetrieveResponse retrieve(String itemFamilyId) throws ChargebeeException { Response response = retrieveRaw(itemFamilyId); return ItemFamilyRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a itemFamily (executes immediately) - returns raw Response. */ - Response updateRaw(String itemFamilyId) throws Exception { + Response updateRaw(String itemFamilyId) throws ChargebeeException { String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); @@ -144,21 +145,21 @@ Response updateRaw(String itemFamilyId) throws Exception { } /** update a itemFamily using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String itemFamilyId, ItemFamilyUpdateParams params) throws Exception { + Response updateRaw(String itemFamilyId, ItemFamilyUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); return post(path, params.toFormData()); } /** update a itemFamily using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String itemFamilyId, String jsonPayload) throws Exception { + Response updateRaw(String itemFamilyId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); return postJson(path, jsonPayload); } public ItemFamilyUpdateResponse update(String itemFamilyId, ItemFamilyUpdateParams params) - throws Exception { + throws ChargebeeException { Response response = updateRaw(itemFamilyId, params); return ItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response); } diff --git a/src/main/java/com/chargebee/v4/services/ItemPriceService.java b/src/main/java/com/chargebee/v4/services/ItemPriceService.java index bfc5703a..079b59a0 100644 --- a/src/main/java/com/chargebee/v4/services/ItemPriceService.java +++ b/src/main/java/com/chargebee/v4/services/ItemPriceService.java @@ -9,31 +9,32 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.itemPrice.params.ApplicableItemsForItemPriceParams; +import com.chargebee.v4.models.itemPrice.params.ItemPriceFindApplicableItemsParams; -import com.chargebee.v4.models.itemPrice.params.MoveForItemPriceParams; +import com.chargebee.v4.models.itemPrice.params.MoveItemPriceParams; import com.chargebee.v4.models.itemPrice.params.ItemPriceUpdateParams; -import com.chargebee.v4.models.itemPrice.params.ApplicableItemPricesForItemPriceParams; +import com.chargebee.v4.models.itemPrice.params.FindApplicableItemPricesParams; import com.chargebee.v4.models.itemPrice.params.ItemPriceListParams; import com.chargebee.v4.models.itemPrice.params.ItemPriceCreateParams; -import com.chargebee.v4.models.itemPrice.responses.ApplicableItemsForItemPriceResponse; +import com.chargebee.v4.models.itemPrice.responses.ItemPriceFindApplicableItemsResponse; -import com.chargebee.v4.models.itemPrice.responses.MoveForItemPriceResponse; +import com.chargebee.v4.models.itemPrice.responses.MoveItemPriceResponse; import com.chargebee.v4.models.itemPrice.responses.ItemPriceRetrieveResponse; import com.chargebee.v4.models.itemPrice.responses.ItemPriceUpdateResponse; -import com.chargebee.v4.models.itemPrice.responses.DeleteItemPriceResponse; +import com.chargebee.v4.models.itemPrice.responses.ItemPriceDeleteResponse; -import com.chargebee.v4.models.itemPrice.responses.ApplicableItemPricesForItemPriceResponse; +import com.chargebee.v4.models.itemPrice.responses.FindApplicableItemPricesResponse; import com.chargebee.v4.models.itemPrice.responses.ItemPriceListResponse; @@ -74,11 +75,11 @@ public ItemPriceService withOptions(RequestOptions options) { // === Operations === /** - * applicableItemsForItemPrice a itemPrice using immutable params (executes immediately) - returns - * raw Response. + * findApplicableItems a itemPrice using immutable params (executes immediately) - returns raw + * Response. */ - Response applicableItemsForItemPriceRaw( - String itemPriceId, ApplicableItemsForItemPriceParams params) throws Exception { + Response findApplicableItemsRaw(String itemPriceId, ItemPriceFindApplicableItemsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_items", "item-price-id", itemPriceId); @@ -86,10 +87,9 @@ Response applicableItemsForItemPriceRaw( } /** - * applicableItemsForItemPrice a itemPrice without params (executes immediately) - returns raw - * Response. + * findApplicableItems a itemPrice without params (executes immediately) - returns raw Response. */ - Response applicableItemsForItemPriceRaw(String itemPriceId) throws Exception { + Response findApplicableItemsRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_items", "item-price-id", itemPriceId); @@ -97,32 +97,33 @@ Response applicableItemsForItemPriceRaw(String itemPriceId) throws Exception { } /** - * applicableItemsForItemPrice a itemPrice using raw JSON payload (executes immediately) - returns - * raw Response. + * findApplicableItems a itemPrice using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response applicableItemsForItemPriceRaw(String itemPriceId, String jsonPayload) throws Exception { + Response findApplicableItemsRaw(String itemPriceId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_items", "item-price-id", itemPriceId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public ApplicableItemsForItemPriceResponse applicableItemsForItemPrice( - String itemPriceId, ApplicableItemsForItemPriceParams params) throws Exception { - Response response = applicableItemsForItemPriceRaw(itemPriceId, params); - return ApplicableItemsForItemPriceResponse.fromJson( + public ItemPriceFindApplicableItemsResponse findApplicableItems( + String itemPriceId, ItemPriceFindApplicableItemsParams params) throws ChargebeeException { + Response response = findApplicableItemsRaw(itemPriceId, params); + return ItemPriceFindApplicableItemsResponse.fromJson( response.getBodyAsString(), this, params, itemPriceId, response); } - public ApplicableItemsForItemPriceResponse applicableItemsForItemPrice(String itemPriceId) - throws Exception { - Response response = applicableItemsForItemPriceRaw(itemPriceId); - return ApplicableItemsForItemPriceResponse.fromJson( + public ItemPriceFindApplicableItemsResponse findApplicableItems(String itemPriceId) + throws ChargebeeException { + Response response = findApplicableItemsRaw(itemPriceId); + return ItemPriceFindApplicableItemsResponse.fromJson( response.getBodyAsString(), this, null, itemPriceId, response); } - /** moveForItemPrice a itemPrice (executes immediately) - returns raw Response. */ - Response moveForItemPriceRaw(String itemPriceId) throws Exception { + /** moveItemPrice a itemPrice (executes immediately) - returns raw Response. */ + Response moveItemPriceRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}/move", "item-price-id", itemPriceId); @@ -130,87 +131,86 @@ Response moveForItemPriceRaw(String itemPriceId) throws Exception { } /** - * moveForItemPrice a itemPrice using immutable params (executes immediately) - returns raw - * Response. + * moveItemPrice a itemPrice using immutable params (executes immediately) - returns raw Response. */ - Response moveForItemPriceRaw(String itemPriceId, MoveForItemPriceParams params) throws Exception { + Response moveItemPriceRaw(String itemPriceId, MoveItemPriceParams params) + throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}/move", "item-price-id", itemPriceId); return post(path, params.toFormData()); } /** - * moveForItemPrice a itemPrice using raw JSON payload (executes immediately) - returns raw - * Response. + * moveItemPrice a itemPrice using raw JSON payload (executes immediately) - returns raw Response. */ - Response moveForItemPriceRaw(String itemPriceId, String jsonPayload) throws Exception { + Response moveItemPriceRaw(String itemPriceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}/move", "item-price-id", itemPriceId); return postJson(path, jsonPayload); } - public MoveForItemPriceResponse moveForItemPrice( - String itemPriceId, MoveForItemPriceParams params) throws Exception { - Response response = moveForItemPriceRaw(itemPriceId, params); - return MoveForItemPriceResponse.fromJson(response.getBodyAsString(), response); + public MoveItemPriceResponse moveItemPrice(String itemPriceId, MoveItemPriceParams params) + throws ChargebeeException { + Response response = moveItemPriceRaw(itemPriceId, params); + return MoveItemPriceResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a itemPrice (executes immediately) - returns raw Response. */ - Response retrieveRaw(String itemPriceId) throws Exception { + Response retrieveRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); return get(path, null); } - public ItemPriceRetrieveResponse retrieve(String itemPriceId) throws Exception { + public ItemPriceRetrieveResponse retrieve(String itemPriceId) throws ChargebeeException { Response response = retrieveRaw(itemPriceId); return ItemPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a itemPrice (executes immediately) - returns raw Response. */ - Response updateRaw(String itemPriceId) throws Exception { + Response updateRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); return post(path, null); } /** update a itemPrice using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String itemPriceId, ItemPriceUpdateParams params) throws Exception { + Response updateRaw(String itemPriceId, ItemPriceUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); return post(path, params.toFormData()); } /** update a itemPrice using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String itemPriceId, String jsonPayload) throws Exception { + Response updateRaw(String itemPriceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); return postJson(path, jsonPayload); } public ItemPriceUpdateResponse update(String itemPriceId, ItemPriceUpdateParams params) - throws Exception { + throws ChargebeeException { Response response = updateRaw(itemPriceId, params); return ItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } - /** deleteItemPrice a itemPrice (executes immediately) - returns raw Response. */ - Response deleteItemPriceRaw(String itemPriceId) throws Exception { + /** delete a itemPrice (executes immediately) - returns raw Response. */ + Response deleteRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}/delete", "item-price-id", itemPriceId); return post(path, null); } - public DeleteItemPriceResponse deleteItemPrice(String itemPriceId) throws Exception { - Response response = deleteItemPriceRaw(itemPriceId); - return DeleteItemPriceResponse.fromJson(response.getBodyAsString(), response); + public ItemPriceDeleteResponse delete(String itemPriceId) throws ChargebeeException { + Response response = deleteRaw(itemPriceId); + return ItemPriceDeleteResponse.fromJson(response.getBodyAsString(), response); } /** - * applicableItemPricesForItemPrice a itemPrice using immutable params (executes immediately) - - * returns raw Response. + * findApplicableItemPrices a itemPrice using immutable params (executes immediately) - returns + * raw Response. */ - Response applicableItemPricesForItemPriceRaw( - String itemPriceId, ApplicableItemPricesForItemPriceParams params) throws Exception { + Response findApplicableItemPricesRaw(String itemPriceId, FindApplicableItemPricesParams params) + throws ChargebeeException { String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_item_prices", "item-price-id", itemPriceId); @@ -218,10 +218,10 @@ Response applicableItemPricesForItemPriceRaw( } /** - * applicableItemPricesForItemPrice a itemPrice without params (executes immediately) - returns - * raw Response. + * findApplicableItemPrices a itemPrice without params (executes immediately) - returns raw + * Response. */ - Response applicableItemPricesForItemPriceRaw(String itemPriceId) throws Exception { + Response findApplicableItemPricesRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_item_prices", "item-price-id", itemPriceId); @@ -229,73 +229,73 @@ Response applicableItemPricesForItemPriceRaw(String itemPriceId) throws Exceptio } /** - * applicableItemPricesForItemPrice a itemPrice using raw JSON payload (executes immediately) - - * returns raw Response. + * findApplicableItemPrices a itemPrice using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response applicableItemPricesForItemPriceRaw(String itemPriceId, String jsonPayload) - throws Exception { + Response findApplicableItemPricesRaw(String itemPriceId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_item_prices", "item-price-id", itemPriceId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public ApplicableItemPricesForItemPriceResponse applicableItemPricesForItemPrice( - String itemPriceId, ApplicableItemPricesForItemPriceParams params) throws Exception { - Response response = applicableItemPricesForItemPriceRaw(itemPriceId, params); - return ApplicableItemPricesForItemPriceResponse.fromJson( + public FindApplicableItemPricesResponse findApplicableItemPrices( + String itemPriceId, FindApplicableItemPricesParams params) throws ChargebeeException { + Response response = findApplicableItemPricesRaw(itemPriceId, params); + return FindApplicableItemPricesResponse.fromJson( response.getBodyAsString(), this, params, itemPriceId, response); } - public ApplicableItemPricesForItemPriceResponse applicableItemPricesForItemPrice( - String itemPriceId) throws Exception { - Response response = applicableItemPricesForItemPriceRaw(itemPriceId); - return ApplicableItemPricesForItemPriceResponse.fromJson( + public FindApplicableItemPricesResponse findApplicableItemPrices(String itemPriceId) + throws ChargebeeException { + Response response = findApplicableItemPricesRaw(itemPriceId); + return FindApplicableItemPricesResponse.fromJson( response.getBodyAsString(), this, null, itemPriceId, response); } /** list a itemPrice using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(ItemPriceListParams params) throws Exception { + Response listRaw(ItemPriceListParams params) throws ChargebeeException { return get("/item_prices", params != null ? params.toQueryParams() : null); } /** list a itemPrice without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/item_prices", null); } /** list a itemPrice using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public ItemPriceListResponse list(ItemPriceListParams params) throws Exception { + public ItemPriceListResponse list(ItemPriceListParams params) throws ChargebeeException { Response response = listRaw(params); return ItemPriceListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public ItemPriceListResponse list() throws Exception { + public ItemPriceListResponse list() throws ChargebeeException { Response response = listRaw(); return ItemPriceListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a itemPrice using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(ItemPriceCreateParams params) throws Exception { + Response createRaw(ItemPriceCreateParams params) throws ChargebeeException { return post("/item_prices", params != null ? params.toFormData() : null); } /** create a itemPrice using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/item_prices", jsonPayload); } - public ItemPriceCreateResponse create(ItemPriceCreateParams params) throws Exception { + public ItemPriceCreateResponse create(ItemPriceCreateParams params) throws ChargebeeException { Response response = createRaw(params); return ItemPriceCreateResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/ItemService.java b/src/main/java/com/chargebee/v4/services/ItemService.java index c0f7b1a8..3ee5fee7 100644 --- a/src/main/java/com/chargebee/v4/services/ItemService.java +++ b/src/main/java/com/chargebee/v4/services/ItemService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.item.params.ItemListParams; @@ -21,7 +22,7 @@ import com.chargebee.v4.models.item.responses.ItemCreateResponse; -import com.chargebee.v4.models.item.responses.DeleteItemResponse; +import com.chargebee.v4.models.item.responses.ItemDeleteResponse; import com.chargebee.v4.models.item.responses.ItemRetrieveResponse; @@ -62,96 +63,97 @@ public ItemService withOptions(RequestOptions options) { // === Operations === /** list a item using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(ItemListParams params) throws Exception { + Response listRaw(ItemListParams params) throws ChargebeeException { return get("/items", params != null ? params.toQueryParams() : null); } /** list a item without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/items", null); } /** list a item using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public ItemListResponse list(ItemListParams params) throws Exception { + public ItemListResponse list(ItemListParams params) throws ChargebeeException { Response response = listRaw(params); return ItemListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public ItemListResponse list() throws Exception { + public ItemListResponse list() throws ChargebeeException { Response response = listRaw(); return ItemListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a item using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(ItemCreateParams params) throws Exception { + Response createRaw(ItemCreateParams params) throws ChargebeeException { return post("/items", params != null ? params.toFormData() : null); } /** create a item using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/items", jsonPayload); } - public ItemCreateResponse create(ItemCreateParams params) throws Exception { + public ItemCreateResponse create(ItemCreateParams params) throws ChargebeeException { Response response = createRaw(params); return ItemCreateResponse.fromJson(response.getBodyAsString(), response); } - /** deleteItem a item (executes immediately) - returns raw Response. */ - Response deleteItemRaw(String itemId) throws Exception { + /** delete a item (executes immediately) - returns raw Response. */ + Response deleteRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/delete", "item-id", itemId); return post(path, null); } - public DeleteItemResponse deleteItem(String itemId) throws Exception { - Response response = deleteItemRaw(itemId); - return DeleteItemResponse.fromJson(response.getBodyAsString(), response); + public ItemDeleteResponse delete(String itemId) throws ChargebeeException { + Response response = deleteRaw(itemId); + return ItemDeleteResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a item (executes immediately) - returns raw Response. */ - Response retrieveRaw(String itemId) throws Exception { + Response retrieveRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); return get(path, null); } - public ItemRetrieveResponse retrieve(String itemId) throws Exception { + public ItemRetrieveResponse retrieve(String itemId) throws ChargebeeException { Response response = retrieveRaw(itemId); return ItemRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a item (executes immediately) - returns raw Response. */ - Response updateRaw(String itemId) throws Exception { + Response updateRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); return post(path, null); } /** update a item using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String itemId, ItemUpdateParams params) throws Exception { + Response updateRaw(String itemId, ItemUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); return post(path, params.toFormData()); } /** update a item using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String itemId, String jsonPayload) throws Exception { + Response updateRaw(String itemId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); return postJson(path, jsonPayload); } - public ItemUpdateResponse update(String itemId, ItemUpdateParams params) throws Exception { + public ItemUpdateResponse update(String itemId, ItemUpdateParams params) + throws ChargebeeException { Response response = updateRaw(itemId, params); return ItemUpdateResponse.fromJson(response.getBodyAsString(), response); } diff --git a/src/main/java/com/chargebee/v4/services/MediaService.java b/src/main/java/com/chargebee/v4/services/MediaService.java index a234f058..f990ff60 100644 --- a/src/main/java/com/chargebee/v4/services/MediaService.java +++ b/src/main/java/com/chargebee/v4/services/MediaService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.media.params.AddMediaForItemParams; +import com.chargebee.v4.models.media.params.CreateMediaAndAttachToItemParams; -import com.chargebee.v4.models.media.responses.AddMediaForItemResponse; +import com.chargebee.v4.models.media.responses.CreateMediaAndAttachToItemResponse; public final class MediaService extends BaseService { @@ -49,32 +50,36 @@ public MediaService withOptions(RequestOptions options) { // === Operations === - /** addMediaForItem a media (executes immediately) - returns raw Response. */ - Response addMediaForItemRaw(String itemId) throws Exception { + /** createMediaAndAttachToItem a media (executes immediately) - returns raw Response. */ + Response createMediaAndAttachToItemRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/media", "item-id", itemId); return post(path, null); } /** - * addMediaForItem a media using immutable params (executes immediately) - returns raw Response. + * createMediaAndAttachToItem a media using immutable params (executes immediately) - returns raw + * Response. */ - Response addMediaForItemRaw(String itemId, AddMediaForItemParams params) throws Exception { + Response createMediaAndAttachToItemRaw(String itemId, CreateMediaAndAttachToItemParams params) + throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/media", "item-id", itemId); return post(path, params.toFormData()); } /** - * addMediaForItem a media using raw JSON payload (executes immediately) - returns raw Response. + * createMediaAndAttachToItem a media using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response addMediaForItemRaw(String itemId, String jsonPayload) throws Exception { + Response createMediaAndAttachToItemRaw(String itemId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/media", "item-id", itemId); return postJson(path, jsonPayload); } - public AddMediaForItemResponse addMediaForItem(String itemId, AddMediaForItemParams params) - throws Exception { - Response response = addMediaForItemRaw(itemId, params); - return AddMediaForItemResponse.fromJson(response.getBodyAsString(), response); + public CreateMediaAndAttachToItemResponse createMediaAndAttachToItem( + String itemId, CreateMediaAndAttachToItemParams params) throws ChargebeeException { + Response response = createMediaAndAttachToItemRaw(itemId, params); + return CreateMediaAndAttachToItemResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java b/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java index ae01d511..693e9454 100644 --- a/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.nonSubscription.params.OneTimePurchaseForNonSubscriptionParams; +import com.chargebee.v4.models.nonSubscription.params.NonSubscriptionProcessReceiptParams; -import com.chargebee.v4.models.nonSubscription.responses.OneTimePurchaseForNonSubscriptionResponse; +import com.chargebee.v4.models.nonSubscription.responses.NonSubscriptionProcessReceiptResponse; public final class NonSubscriptionService extends BaseService { @@ -50,11 +51,8 @@ public NonSubscriptionService withOptions(RequestOptions options) { // === Operations === - /** - * oneTimePurchaseForNonSubscription a nonSubscription (executes immediately) - returns raw - * Response. - */ - Response oneTimePurchaseForNonSubscriptionRaw(String nonSubscriptionAppId) throws Exception { + /** processReceipt a nonSubscription (executes immediately) - returns raw Response. */ + Response processReceiptRaw(String nonSubscriptionAppId) throws ChargebeeException { String path = buildPathWithParams( "/non_subscriptions/{non-subscription-app-id}/one_time_purchase", @@ -65,12 +63,12 @@ Response oneTimePurchaseForNonSubscriptionRaw(String nonSubscriptionAppId) throw } /** - * oneTimePurchaseForNonSubscription a nonSubscription using immutable params (executes - * immediately) - returns raw Response. + * processReceipt a nonSubscription using immutable params (executes immediately) - returns raw + * Response. */ - Response oneTimePurchaseForNonSubscriptionRaw( - String nonSubscriptionAppId, OneTimePurchaseForNonSubscriptionParams params) - throws Exception { + Response processReceiptRaw( + String nonSubscriptionAppId, NonSubscriptionProcessReceiptParams params) + throws ChargebeeException { String path = buildPathWithParams( "/non_subscriptions/{non-subscription-app-id}/one_time_purchase", @@ -80,11 +78,11 @@ Response oneTimePurchaseForNonSubscriptionRaw( } /** - * oneTimePurchaseForNonSubscription a nonSubscription using raw JSON payload (executes - * immediately) - returns raw Response. + * processReceipt a nonSubscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response oneTimePurchaseForNonSubscriptionRaw(String nonSubscriptionAppId, String jsonPayload) - throws Exception { + Response processReceiptRaw(String nonSubscriptionAppId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/non_subscriptions/{non-subscription-app-id}/one_time_purchase", @@ -93,10 +91,10 @@ Response oneTimePurchaseForNonSubscriptionRaw(String nonSubscriptionAppId, Strin return postJson(path, jsonPayload); } - public OneTimePurchaseForNonSubscriptionResponse oneTimePurchaseForNonSubscription( - String nonSubscriptionAppId, OneTimePurchaseForNonSubscriptionParams params) - throws Exception { - Response response = oneTimePurchaseForNonSubscriptionRaw(nonSubscriptionAppId, params); - return OneTimePurchaseForNonSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public NonSubscriptionProcessReceiptResponse processReceipt( + String nonSubscriptionAppId, NonSubscriptionProcessReceiptParams params) + throws ChargebeeException { + Response response = processReceiptRaw(nonSubscriptionAppId, params); + return NonSubscriptionProcessReceiptResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/OfferEventService.java b/src/main/java/com/chargebee/v4/services/OfferEventService.java index 26b74c4b..7bcd66e3 100644 --- a/src/main/java/com/chargebee/v4/services/OfferEventService.java +++ b/src/main/java/com/chargebee/v4/services/OfferEventService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.offerEvent.params.OfferEventCreateParams; +import com.chargebee.v4.models.offerEvent.params.OfferEventsParams; -import com.chargebee.v4.models.offerEvent.responses.OfferEventCreateResponse; +import com.chargebee.v4.models.offerEvent.responses.OfferEventsResponse; public final class OfferEventService extends BaseService { @@ -49,21 +50,25 @@ public OfferEventService withOptions(RequestOptions options) { // === Operations === - /** create a offerEvent using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(OfferEventCreateParams params) throws Exception { + /** + * offerEvents a offerEvent using immutable params (executes immediately) - returns raw Response. + */ + Response offerEventsRaw(OfferEventsParams params) throws ChargebeeException { return post("/offer_events", params != null ? params.toFormData() : null); } - /** create a offerEvent using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + /** + * offerEvents a offerEvent using raw JSON payload (executes immediately) - returns raw Response. + */ + Response offerEventsRaw(String jsonPayload) throws ChargebeeException { return postJson("/offer_events", jsonPayload); } - public OfferEventCreateResponse create(OfferEventCreateParams params) throws Exception { - Response response = createRaw(params); + public OfferEventsResponse offerEvents(OfferEventsParams params) throws ChargebeeException { + Response response = offerEventsRaw(params); - return OfferEventCreateResponse.fromJson(response.getBodyAsString(), response); + return OfferEventsResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java b/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java index ac9ee904..1b294ee3 100644 --- a/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java +++ b/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java @@ -9,17 +9,18 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.offerFulfillment.params.OfferFulfillmentCreateParams; +import com.chargebee.v4.models.offerFulfillment.params.OfferFulfillmentsParams; -import com.chargebee.v4.models.offerFulfillment.params.OfferFulfillmentUpdateParams; +import com.chargebee.v4.models.offerFulfillment.params.OfferFulfillmentsUpdateParams; -import com.chargebee.v4.models.offerFulfillment.responses.OfferFulfillmentCreateResponse; +import com.chargebee.v4.models.offerFulfillment.responses.OfferFulfillmentsResponse; -import com.chargebee.v4.models.offerFulfillment.responses.OfferFulfillmentRetrieveResponse; +import com.chargebee.v4.models.offerFulfillment.responses.OfferFulfillmentsGetResponse; -import com.chargebee.v4.models.offerFulfillment.responses.OfferFulfillmentUpdateResponse; +import com.chargebee.v4.models.offerFulfillment.responses.OfferFulfillmentsUpdateResponse; public final class OfferFulfillmentService extends BaseService { @@ -57,30 +58,32 @@ public OfferFulfillmentService withOptions(RequestOptions options) { // === Operations === /** - * create a offerFulfillment using immutable params (executes immediately) - returns raw Response. + * offerFulfillments a offerFulfillment using immutable params (executes immediately) - returns + * raw Response. */ - Response createRaw(OfferFulfillmentCreateParams params) throws Exception { + Response offerFulfillmentsRaw(OfferFulfillmentsParams params) throws ChargebeeException { return post("/offer_fulfillments", params != null ? params.toFormData() : null); } /** - * create a offerFulfillment using raw JSON payload (executes immediately) - returns raw Response. + * offerFulfillments a offerFulfillment using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response offerFulfillmentsRaw(String jsonPayload) throws ChargebeeException { return postJson("/offer_fulfillments", jsonPayload); } - public OfferFulfillmentCreateResponse create(OfferFulfillmentCreateParams params) - throws Exception { - Response response = createRaw(params); + public OfferFulfillmentsResponse offerFulfillments(OfferFulfillmentsParams params) + throws ChargebeeException { + Response response = offerFulfillmentsRaw(params); - return OfferFulfillmentCreateResponse.fromJson(response.getBodyAsString(), response); + return OfferFulfillmentsResponse.fromJson(response.getBodyAsString(), response); } - /** retrieve a offerFulfillment (executes immediately) - returns raw Response. */ - Response retrieveRaw(String offerFulfillmentId) throws Exception { + /** offerFulfillmentsGet a offerFulfillment (executes immediately) - returns raw Response. */ + Response offerFulfillmentsGetRaw(String offerFulfillmentId) throws ChargebeeException { String path = buildPathWithParams( "/offer_fulfillments/{offer-fulfillment-id}", @@ -90,13 +93,14 @@ Response retrieveRaw(String offerFulfillmentId) throws Exception { return get(path, null); } - public OfferFulfillmentRetrieveResponse retrieve(String offerFulfillmentId) throws Exception { - Response response = retrieveRaw(offerFulfillmentId); - return OfferFulfillmentRetrieveResponse.fromJson(response.getBodyAsString(), response); + public OfferFulfillmentsGetResponse offerFulfillmentsGet(String offerFulfillmentId) + throws ChargebeeException { + Response response = offerFulfillmentsGetRaw(offerFulfillmentId); + return OfferFulfillmentsGetResponse.fromJson(response.getBodyAsString(), response); } - /** update a offerFulfillment (executes immediately) - returns raw Response. */ - Response updateRaw(String offerFulfillmentId) throws Exception { + /** offerFulfillmentsUpdate a offerFulfillment (executes immediately) - returns raw Response. */ + Response offerFulfillmentsUpdateRaw(String offerFulfillmentId) throws ChargebeeException { String path = buildPathWithParams( "/offer_fulfillments/{offer-fulfillment-id}", @@ -107,10 +111,11 @@ Response updateRaw(String offerFulfillmentId) throws Exception { } /** - * update a offerFulfillment using immutable params (executes immediately) - returns raw Response. + * offerFulfillmentsUpdate a offerFulfillment using immutable params (executes immediately) - + * returns raw Response. */ - Response updateRaw(String offerFulfillmentId, OfferFulfillmentUpdateParams params) - throws Exception { + Response offerFulfillmentsUpdateRaw( + String offerFulfillmentId, OfferFulfillmentsUpdateParams params) throws ChargebeeException { String path = buildPathWithParams( "/offer_fulfillments/{offer-fulfillment-id}", @@ -120,9 +125,11 @@ Response updateRaw(String offerFulfillmentId, OfferFulfillmentUpdateParams param } /** - * update a offerFulfillment using raw JSON payload (executes immediately) - returns raw Response. + * offerFulfillmentsUpdate a offerFulfillment using raw JSON payload (executes immediately) - + * returns raw Response. */ - Response updateRaw(String offerFulfillmentId, String jsonPayload) throws Exception { + Response offerFulfillmentsUpdateRaw(String offerFulfillmentId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/offer_fulfillments/{offer-fulfillment-id}", @@ -131,9 +138,9 @@ Response updateRaw(String offerFulfillmentId, String jsonPayload) throws Excepti return postJson(path, jsonPayload); } - public OfferFulfillmentUpdateResponse update( - String offerFulfillmentId, OfferFulfillmentUpdateParams params) throws Exception { - Response response = updateRaw(offerFulfillmentId, params); - return OfferFulfillmentUpdateResponse.fromJson(response.getBodyAsString(), response); + public OfferFulfillmentsUpdateResponse offerFulfillmentsUpdate( + String offerFulfillmentId, OfferFulfillmentsUpdateParams params) throws ChargebeeException { + Response response = offerFulfillmentsUpdateRaw(offerFulfillmentId, params); + return OfferFulfillmentsUpdateResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java b/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java index 2ac7794a..8709ffba 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.omnichannelOneTimeOrder.params.OmnichannelOneTimeOrderListParams; @@ -57,7 +58,7 @@ public OmnichannelOneTimeOrderService withOptions(RequestOptions options) { * list a omnichannelOneTimeOrder using immutable params (executes immediately) - returns raw * Response. */ - Response listRaw(OmnichannelOneTimeOrderListParams params) throws Exception { + Response listRaw(OmnichannelOneTimeOrderListParams params) throws ChargebeeException { return get("/omnichannel_one_time_orders", params != null ? params.toQueryParams() : null); } @@ -65,7 +66,7 @@ Response listRaw(OmnichannelOneTimeOrderListParams params) throws Exception { /** * list a omnichannelOneTimeOrder without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/omnichannel_one_time_orders", null); } @@ -74,27 +75,27 @@ Response listRaw() throws Exception { * list a omnichannelOneTimeOrder using raw JSON payload (executes immediately) - returns raw * Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public OmnichannelOneTimeOrderListResponse list(OmnichannelOneTimeOrderListParams params) - throws Exception { + throws ChargebeeException { Response response = listRaw(params); return OmnichannelOneTimeOrderListResponse.fromJson( response.getBodyAsString(), this, params, response); } - public OmnichannelOneTimeOrderListResponse list() throws Exception { + public OmnichannelOneTimeOrderListResponse list() throws ChargebeeException { Response response = listRaw(); return OmnichannelOneTimeOrderListResponse.fromJson( response.getBodyAsString(), this, null, response); } /** retrieve a omnichannelOneTimeOrder (executes immediately) - returns raw Response. */ - Response retrieveRaw(String omnichannelOneTimeOrderId) throws Exception { + Response retrieveRaw(String omnichannelOneTimeOrderId) throws ChargebeeException { String path = buildPathWithParams( "/omnichannel_one_time_orders/{omnichannel-one-time-order-id}", @@ -105,7 +106,7 @@ Response retrieveRaw(String omnichannelOneTimeOrderId) throws Exception { } public OmnichannelOneTimeOrderRetrieveResponse retrieve(String omnichannelOneTimeOrderId) - throws Exception { + throws ChargebeeException { Response response = retrieveRaw(omnichannelOneTimeOrderId); return OmnichannelOneTimeOrderRetrieveResponse.fromJson(response.getBodyAsString(), response); } diff --git a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java index 1b522078..3b5d9929 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.omnichannelSubscriptionItem.params.ScheduledChangesForOmnichannelSubscriptionItemParams; +import com.chargebee.v4.models.omnichannelSubscriptionItem.params.OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams; -import com.chargebee.v4.models.omnichannelSubscriptionItem.responses.ScheduledChangesForOmnichannelSubscriptionItemResponse; +import com.chargebee.v4.models.omnichannelSubscriptionItem.responses.OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse; public final class OmnichannelSubscriptionItemService extends BaseService { @@ -52,13 +53,13 @@ public OmnichannelSubscriptionItemService withOptions(RequestOptions options) { // === Operations === /** - * scheduledChangesForOmnichannelSubscriptionItem a omnichannelSubscriptionItem using immutable - * params (executes immediately) - returns raw Response. + * listOmniSubscriptionItemScheduleChanges a omnichannelSubscriptionItem using immutable params + * (executes immediately) - returns raw Response. */ - Response scheduledChangesForOmnichannelSubscriptionItemRaw( + Response listOmniSubscriptionItemScheduleChangesRaw( String omnichannelSubscriptionItemId, - ScheduledChangesForOmnichannelSubscriptionItemParams params) - throws Exception { + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams params) + throws ChargebeeException { String path = buildPathWithParams( "/omnichannel_subscription_items/{omnichannel-subscription-item-id}/scheduled_changes", @@ -68,11 +69,11 @@ Response scheduledChangesForOmnichannelSubscriptionItemRaw( } /** - * scheduledChangesForOmnichannelSubscriptionItem a omnichannelSubscriptionItem without params - * (executes immediately) - returns raw Response. + * listOmniSubscriptionItemScheduleChanges a omnichannelSubscriptionItem without params (executes + * immediately) - returns raw Response. */ - Response scheduledChangesForOmnichannelSubscriptionItemRaw(String omnichannelSubscriptionItemId) - throws Exception { + Response listOmniSubscriptionItemScheduleChangesRaw(String omnichannelSubscriptionItemId) + throws ChargebeeException { String path = buildPathWithParams( "/omnichannel_subscription_items/{omnichannel-subscription-item-id}/scheduled_changes", @@ -82,11 +83,11 @@ Response scheduledChangesForOmnichannelSubscriptionItemRaw(String omnichannelSub } /** - * scheduledChangesForOmnichannelSubscriptionItem a omnichannelSubscriptionItem using raw JSON - * payload (executes immediately) - returns raw Response. + * listOmniSubscriptionItemScheduleChanges a omnichannelSubscriptionItem using raw JSON payload + * (executes immediately) - returns raw Response. */ - Response scheduledChangesForOmnichannelSubscriptionItemRaw( - String omnichannelSubscriptionItemId, String jsonPayload) throws Exception { + Response listOmniSubscriptionItemScheduleChangesRaw( + String omnichannelSubscriptionItemId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/omnichannel_subscription_items/{omnichannel-subscription-item-id}/scheduled_changes", @@ -95,23 +96,22 @@ Response scheduledChangesForOmnichannelSubscriptionItemRaw( throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public ScheduledChangesForOmnichannelSubscriptionItemResponse - scheduledChangesForOmnichannelSubscriptionItem( + public OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse + listOmniSubscriptionItemScheduleChanges( String omnichannelSubscriptionItemId, - ScheduledChangesForOmnichannelSubscriptionItemParams params) - throws Exception { + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams params) + throws ChargebeeException { Response response = - scheduledChangesForOmnichannelSubscriptionItemRaw(omnichannelSubscriptionItemId, params); - return ScheduledChangesForOmnichannelSubscriptionItemResponse.fromJson( + listOmniSubscriptionItemScheduleChangesRaw(omnichannelSubscriptionItemId, params); + return OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse.fromJson( response.getBodyAsString(), this, params, omnichannelSubscriptionItemId, response); } - public ScheduledChangesForOmnichannelSubscriptionItemResponse - scheduledChangesForOmnichannelSubscriptionItem(String omnichannelSubscriptionItemId) - throws Exception { - Response response = - scheduledChangesForOmnichannelSubscriptionItemRaw(omnichannelSubscriptionItemId); - return ScheduledChangesForOmnichannelSubscriptionItemResponse.fromJson( + public OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse + listOmniSubscriptionItemScheduleChanges(String omnichannelSubscriptionItemId) + throws ChargebeeException { + Response response = listOmniSubscriptionItemScheduleChangesRaw(omnichannelSubscriptionItemId); + return OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse.fromJson( response.getBodyAsString(), this, null, omnichannelSubscriptionItemId, response); } } diff --git a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java index c24614a4..533f68bd 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java @@ -9,15 +9,16 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.omnichannelSubscription.params.MoveForOmnichannelSubscriptionParams; +import com.chargebee.v4.models.omnichannelSubscription.params.OmnichannelSubscriptionMoveParams; import com.chargebee.v4.models.omnichannelSubscription.params.OmnichannelTransactionsForOmnichannelSubscriptionParams; import com.chargebee.v4.models.omnichannelSubscription.params.OmnichannelSubscriptionListParams; -import com.chargebee.v4.models.omnichannelSubscription.responses.MoveForOmnichannelSubscriptionResponse; +import com.chargebee.v4.models.omnichannelSubscription.responses.OmnichannelSubscriptionMoveResponse; import com.chargebee.v4.models.omnichannelSubscription.responses.OmnichannelSubscriptionRetrieveResponse; @@ -61,11 +62,8 @@ public OmnichannelSubscriptionService withOptions(RequestOptions options) { // === Operations === - /** - * moveForOmnichannelSubscription a omnichannelSubscription (executes immediately) - returns raw - * Response. - */ - Response moveForOmnichannelSubscriptionRaw(String omnichannelSubscriptionId) throws Exception { + /** move a omnichannelSubscription (executes immediately) - returns raw Response. */ + Response moveRaw(String omnichannelSubscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/omnichannel_subscriptions/{omnichannel-subscription-id}/move", @@ -76,12 +74,11 @@ Response moveForOmnichannelSubscriptionRaw(String omnichannelSubscriptionId) thr } /** - * moveForOmnichannelSubscription a omnichannelSubscription using immutable params (executes - * immediately) - returns raw Response. + * move a omnichannelSubscription using immutable params (executes immediately) - returns raw + * Response. */ - Response moveForOmnichannelSubscriptionRaw( - String omnichannelSubscriptionId, MoveForOmnichannelSubscriptionParams params) - throws Exception { + Response moveRaw(String omnichannelSubscriptionId, OmnichannelSubscriptionMoveParams params) + throws ChargebeeException { String path = buildPathWithParams( "/omnichannel_subscriptions/{omnichannel-subscription-id}/move", @@ -91,11 +88,10 @@ Response moveForOmnichannelSubscriptionRaw( } /** - * moveForOmnichannelSubscription a omnichannelSubscription using raw JSON payload (executes - * immediately) - returns raw Response. + * move a omnichannelSubscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response moveForOmnichannelSubscriptionRaw(String omnichannelSubscriptionId, String jsonPayload) - throws Exception { + Response moveRaw(String omnichannelSubscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/omnichannel_subscriptions/{omnichannel-subscription-id}/move", @@ -104,15 +100,15 @@ Response moveForOmnichannelSubscriptionRaw(String omnichannelSubscriptionId, Str return postJson(path, jsonPayload); } - public MoveForOmnichannelSubscriptionResponse moveForOmnichannelSubscription( - String omnichannelSubscriptionId, MoveForOmnichannelSubscriptionParams params) - throws Exception { - Response response = moveForOmnichannelSubscriptionRaw(omnichannelSubscriptionId, params); - return MoveForOmnichannelSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public OmnichannelSubscriptionMoveResponse move( + String omnichannelSubscriptionId, OmnichannelSubscriptionMoveParams params) + throws ChargebeeException { + Response response = moveRaw(omnichannelSubscriptionId, params); + return OmnichannelSubscriptionMoveResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a omnichannelSubscription (executes immediately) - returns raw Response. */ - Response retrieveRaw(String omnichannelSubscriptionId) throws Exception { + Response retrieveRaw(String omnichannelSubscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/omnichannel_subscriptions/{omnichannel-subscription-id}", @@ -123,7 +119,7 @@ Response retrieveRaw(String omnichannelSubscriptionId) throws Exception { } public OmnichannelSubscriptionRetrieveResponse retrieve(String omnichannelSubscriptionId) - throws Exception { + throws ChargebeeException { Response response = retrieveRaw(omnichannelSubscriptionId); return OmnichannelSubscriptionRetrieveResponse.fromJson(response.getBodyAsString(), response); } @@ -135,7 +131,7 @@ public OmnichannelSubscriptionRetrieveResponse retrieve(String omnichannelSubscr Response omnichannelTransactionsForOmnichannelSubscriptionRaw( String omnichannelSubscriptionId, OmnichannelTransactionsForOmnichannelSubscriptionParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/omnichannel_subscriptions/{omnichannel-subscription-id}/omnichannel_transactions", @@ -149,7 +145,7 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( * (executes immediately) - returns raw Response. */ Response omnichannelTransactionsForOmnichannelSubscriptionRaw(String omnichannelSubscriptionId) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/omnichannel_subscriptions/{omnichannel-subscription-id}/omnichannel_transactions", @@ -163,7 +159,7 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw(String omnichannel * payload (executes immediately) - returns raw Response. */ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( - String omnichannelSubscriptionId, String jsonPayload) throws Exception { + String omnichannelSubscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/omnichannel_subscriptions/{omnichannel-subscription-id}/omnichannel_transactions", @@ -176,7 +172,7 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( omnichannelTransactionsForOmnichannelSubscription( String omnichannelSubscriptionId, OmnichannelTransactionsForOmnichannelSubscriptionParams params) - throws Exception { + throws ChargebeeException { Response response = omnichannelTransactionsForOmnichannelSubscriptionRaw(omnichannelSubscriptionId, params); return OmnichannelTransactionsForOmnichannelSubscriptionResponse.fromJson( @@ -185,7 +181,7 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( public OmnichannelTransactionsForOmnichannelSubscriptionResponse omnichannelTransactionsForOmnichannelSubscription(String omnichannelSubscriptionId) - throws Exception { + throws ChargebeeException { Response response = omnichannelTransactionsForOmnichannelSubscriptionRaw(omnichannelSubscriptionId); return OmnichannelTransactionsForOmnichannelSubscriptionResponse.fromJson( @@ -196,7 +192,7 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( * list a omnichannelSubscription using immutable params (executes immediately) - returns raw * Response. */ - Response listRaw(OmnichannelSubscriptionListParams params) throws Exception { + Response listRaw(OmnichannelSubscriptionListParams params) throws ChargebeeException { return get("/omnichannel_subscriptions", params != null ? params.toQueryParams() : null); } @@ -204,7 +200,7 @@ Response listRaw(OmnichannelSubscriptionListParams params) throws Exception { /** * list a omnichannelSubscription without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/omnichannel_subscriptions", null); } @@ -213,20 +209,20 @@ Response listRaw() throws Exception { * list a omnichannelSubscription using raw JSON payload (executes immediately) - returns raw * Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public OmnichannelSubscriptionListResponse list(OmnichannelSubscriptionListParams params) - throws Exception { + throws ChargebeeException { Response response = listRaw(params); return OmnichannelSubscriptionListResponse.fromJson( response.getBodyAsString(), this, params, response); } - public OmnichannelSubscriptionListResponse list() throws Exception { + public OmnichannelSubscriptionListResponse list() throws ChargebeeException { Response response = listRaw(); return OmnichannelSubscriptionListResponse.fromJson( response.getBodyAsString(), this, null, response); diff --git a/src/main/java/com/chargebee/v4/services/OrderService.java b/src/main/java/com/chargebee/v4/services/OrderService.java index f394bda9..03ea47e2 100644 --- a/src/main/java/com/chargebee/v4/services/OrderService.java +++ b/src/main/java/com/chargebee/v4/services/OrderService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.order.params.OrderListParams; @@ -17,17 +18,17 @@ import com.chargebee.v4.models.order.params.ImportOrderParams; -import com.chargebee.v4.models.order.params.ResendForOrderParams; +import com.chargebee.v4.models.order.params.OrderResendParams; -import com.chargebee.v4.models.order.params.ReopenForOrderParams; +import com.chargebee.v4.models.order.params.OrderReopenParams; import com.chargebee.v4.models.order.params.OrdersForInvoiceParams; -import com.chargebee.v4.models.order.params.CancelForOrderParams; +import com.chargebee.v4.models.order.params.OrderCancelParams; import com.chargebee.v4.models.order.params.OrderUpdateParams; -import com.chargebee.v4.models.order.params.CreateRefundableCreditNoteForOrderParams; +import com.chargebee.v4.models.order.params.OrderCreateRefundableCreditNoteParams; import com.chargebee.v4.models.order.responses.OrderListResponse; @@ -35,23 +36,23 @@ import com.chargebee.v4.models.order.responses.ImportOrderResponse; -import com.chargebee.v4.models.order.responses.AssignOrderNumberForOrderResponse; +import com.chargebee.v4.models.order.responses.AssignOrderNumberResponse; -import com.chargebee.v4.models.order.responses.ResendForOrderResponse; +import com.chargebee.v4.models.order.responses.OrderResendResponse; -import com.chargebee.v4.models.order.responses.ReopenForOrderResponse; +import com.chargebee.v4.models.order.responses.OrderReopenResponse; import com.chargebee.v4.models.order.responses.OrdersForInvoiceResponse; -import com.chargebee.v4.models.order.responses.CancelForOrderResponse; +import com.chargebee.v4.models.order.responses.OrderCancelResponse; import com.chargebee.v4.models.order.responses.OrderRetrieveResponse; import com.chargebee.v4.models.order.responses.OrderUpdateResponse; -import com.chargebee.v4.models.order.responses.DeleteOrderResponse; +import com.chargebee.v4.models.order.responses.OrderDeleteResponse; -import com.chargebee.v4.models.order.responses.CreateRefundableCreditNoteForOrderResponse; +import com.chargebee.v4.models.order.responses.OrderCreateRefundableCreditNoteResponse; public final class OrderService extends BaseService { @@ -88,152 +89,144 @@ public OrderService withOptions(RequestOptions options) { // === Operations === /** list a order using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(OrderListParams params) throws Exception { + Response listRaw(OrderListParams params) throws ChargebeeException { return get("/orders", params != null ? params.toQueryParams() : null); } /** list a order without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/orders", null); } /** list a order using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public OrderListResponse list(OrderListParams params) throws Exception { + public OrderListResponse list(OrderListParams params) throws ChargebeeException { Response response = listRaw(params); return OrderListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public OrderListResponse list() throws Exception { + public OrderListResponse list() throws ChargebeeException { Response response = listRaw(); return OrderListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a order using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(OrderCreateParams params) throws Exception { + Response createRaw(OrderCreateParams params) throws ChargebeeException { return post("/orders", params != null ? params.toFormData() : null); } /** create a order using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/orders", jsonPayload); } - public OrderCreateResponse create(OrderCreateParams params) throws Exception { + public OrderCreateResponse create(OrderCreateParams params) throws ChargebeeException { Response response = createRaw(params); return OrderCreateResponse.fromJson(response.getBodyAsString(), response); } /** importOrder a order using immutable params (executes immediately) - returns raw Response. */ - Response importOrderRaw(ImportOrderParams params) throws Exception { + Response importOrderRaw(ImportOrderParams params) throws ChargebeeException { return post("/orders/import_order", params != null ? params.toFormData() : null); } /** importOrder a order using raw JSON payload (executes immediately) - returns raw Response. */ - Response importOrderRaw(String jsonPayload) throws Exception { + Response importOrderRaw(String jsonPayload) throws ChargebeeException { return postJson("/orders/import_order", jsonPayload); } - public ImportOrderResponse importOrder(ImportOrderParams params) throws Exception { + public ImportOrderResponse importOrder(ImportOrderParams params) throws ChargebeeException { Response response = importOrderRaw(params); return ImportOrderResponse.fromJson(response.getBodyAsString(), response); } - /** assignOrderNumberForOrder a order (executes immediately) - returns raw Response. */ - Response assignOrderNumberForOrderRaw(String orderId) throws Exception { + /** assignOrderNumber a order (executes immediately) - returns raw Response. */ + Response assignOrderNumberRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/assign_order_number", "order-id", orderId); return post(path, null); } - public AssignOrderNumberForOrderResponse assignOrderNumberForOrder(String orderId) - throws Exception { - Response response = assignOrderNumberForOrderRaw(orderId); - return AssignOrderNumberForOrderResponse.fromJson(response.getBodyAsString(), response); + public AssignOrderNumberResponse assignOrderNumber(String orderId) throws ChargebeeException { + Response response = assignOrderNumberRaw(orderId); + return AssignOrderNumberResponse.fromJson(response.getBodyAsString(), response); } - /** resendForOrder a order (executes immediately) - returns raw Response. */ - Response resendForOrderRaw(String orderId) throws Exception { + /** resend a order (executes immediately) - returns raw Response. */ + Response resendRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/resend", "order-id", orderId); return post(path, null); } - /** - * resendForOrder a order using immutable params (executes immediately) - returns raw Response. - */ - Response resendForOrderRaw(String orderId, ResendForOrderParams params) throws Exception { + /** resend a order using immutable params (executes immediately) - returns raw Response. */ + Response resendRaw(String orderId, OrderResendParams params) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/resend", "order-id", orderId); return post(path, params.toFormData()); } - /** - * resendForOrder a order using raw JSON payload (executes immediately) - returns raw Response. - */ - Response resendForOrderRaw(String orderId, String jsonPayload) throws Exception { + /** resend a order using raw JSON payload (executes immediately) - returns raw Response. */ + Response resendRaw(String orderId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/resend", "order-id", orderId); return postJson(path, jsonPayload); } - public ResendForOrderResponse resendForOrder(String orderId, ResendForOrderParams params) - throws Exception { - Response response = resendForOrderRaw(orderId, params); - return ResendForOrderResponse.fromJson(response.getBodyAsString(), response); + public OrderResendResponse resend(String orderId, OrderResendParams params) + throws ChargebeeException { + Response response = resendRaw(orderId, params); + return OrderResendResponse.fromJson(response.getBodyAsString(), response); } - /** reopenForOrder a order (executes immediately) - returns raw Response. */ - Response reopenForOrderRaw(String orderId) throws Exception { + /** reopen a order (executes immediately) - returns raw Response. */ + Response reopenRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/reopen", "order-id", orderId); return post(path, null); } - /** - * reopenForOrder a order using immutable params (executes immediately) - returns raw Response. - */ - Response reopenForOrderRaw(String orderId, ReopenForOrderParams params) throws Exception { + /** reopen a order using immutable params (executes immediately) - returns raw Response. */ + Response reopenRaw(String orderId, OrderReopenParams params) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/reopen", "order-id", orderId); return post(path, params.toFormData()); } - /** - * reopenForOrder a order using raw JSON payload (executes immediately) - returns raw Response. - */ - Response reopenForOrderRaw(String orderId, String jsonPayload) throws Exception { + /** reopen a order using raw JSON payload (executes immediately) - returns raw Response. */ + Response reopenRaw(String orderId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/reopen", "order-id", orderId); return postJson(path, jsonPayload); } - public ReopenForOrderResponse reopenForOrder(String orderId, ReopenForOrderParams params) - throws Exception { - Response response = reopenForOrderRaw(orderId, params); - return ReopenForOrderResponse.fromJson(response.getBodyAsString(), response); + public OrderReopenResponse reopen(String orderId, OrderReopenParams params) + throws ChargebeeException { + Response response = reopenRaw(orderId, params); + return OrderReopenResponse.fromJson(response.getBodyAsString(), response); } /** * ordersForInvoice a order using immutable params (executes immediately) - returns raw Response. */ - Response ordersForInvoiceRaw(String invoiceId, OrdersForInvoiceParams params) throws Exception { + Response ordersForInvoiceRaw(String invoiceId, OrdersForInvoiceParams params) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/orders", "invoice-id", invoiceId); return get(path, params != null ? params.toQueryParams() : null); } /** ordersForInvoice a order without params (executes immediately) - returns raw Response. */ - Response ordersForInvoiceRaw(String invoiceId) throws Exception { + Response ordersForInvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/orders", "invoice-id", invoiceId); return get(path, null); } @@ -241,103 +234,100 @@ Response ordersForInvoiceRaw(String invoiceId) throws Exception { /** * ordersForInvoice a order using raw JSON payload (executes immediately) - returns raw Response. */ - Response ordersForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response ordersForInvoiceRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/orders", "invoice-id", invoiceId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public OrdersForInvoiceResponse ordersForInvoice(String invoiceId, OrdersForInvoiceParams params) - throws Exception { + throws ChargebeeException { Response response = ordersForInvoiceRaw(invoiceId, params); return OrdersForInvoiceResponse.fromJson( response.getBodyAsString(), this, params, invoiceId, response); } - public OrdersForInvoiceResponse ordersForInvoice(String invoiceId) throws Exception { + public OrdersForInvoiceResponse ordersForInvoice(String invoiceId) throws ChargebeeException { Response response = ordersForInvoiceRaw(invoiceId); return OrdersForInvoiceResponse.fromJson( response.getBodyAsString(), this, null, invoiceId, response); } - /** cancelForOrder a order (executes immediately) - returns raw Response. */ - Response cancelForOrderRaw(String orderId) throws Exception { + /** cancel a order (executes immediately) - returns raw Response. */ + Response cancelRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/cancel", "order-id", orderId); return post(path, null); } - /** - * cancelForOrder a order using immutable params (executes immediately) - returns raw Response. - */ - Response cancelForOrderRaw(String orderId, CancelForOrderParams params) throws Exception { + /** cancel a order using immutable params (executes immediately) - returns raw Response. */ + Response cancelRaw(String orderId, OrderCancelParams params) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/cancel", "order-id", orderId); return post(path, params.toFormData()); } - /** - * cancelForOrder a order using raw JSON payload (executes immediately) - returns raw Response. - */ - Response cancelForOrderRaw(String orderId, String jsonPayload) throws Exception { + /** cancel a order using raw JSON payload (executes immediately) - returns raw Response. */ + Response cancelRaw(String orderId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/cancel", "order-id", orderId); return postJson(path, jsonPayload); } - public CancelForOrderResponse cancelForOrder(String orderId, CancelForOrderParams params) - throws Exception { - Response response = cancelForOrderRaw(orderId, params); - return CancelForOrderResponse.fromJson(response.getBodyAsString(), response); + public OrderCancelResponse cancel(String orderId, OrderCancelParams params) + throws ChargebeeException { + Response response = cancelRaw(orderId, params); + return OrderCancelResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a order (executes immediately) - returns raw Response. */ - Response retrieveRaw(String orderId) throws Exception { + Response retrieveRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); return get(path, null); } - public OrderRetrieveResponse retrieve(String orderId) throws Exception { + public OrderRetrieveResponse retrieve(String orderId) throws ChargebeeException { Response response = retrieveRaw(orderId); return OrderRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a order (executes immediately) - returns raw Response. */ - Response updateRaw(String orderId) throws Exception { + Response updateRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); return post(path, null); } /** update a order using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String orderId, OrderUpdateParams params) throws Exception { + Response updateRaw(String orderId, OrderUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); return post(path, params.toFormData()); } /** update a order using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String orderId, String jsonPayload) throws Exception { + Response updateRaw(String orderId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); return postJson(path, jsonPayload); } - public OrderUpdateResponse update(String orderId, OrderUpdateParams params) throws Exception { + public OrderUpdateResponse update(String orderId, OrderUpdateParams params) + throws ChargebeeException { Response response = updateRaw(orderId, params); return OrderUpdateResponse.fromJson(response.getBodyAsString(), response); } - /** deleteOrder a order (executes immediately) - returns raw Response. */ - Response deleteOrderRaw(String orderId) throws Exception { + /** delete a order (executes immediately) - returns raw Response. */ + Response deleteRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/delete", "order-id", orderId); return post(path, null); } - public DeleteOrderResponse deleteOrder(String orderId) throws Exception { - Response response = deleteOrderRaw(orderId); - return DeleteOrderResponse.fromJson(response.getBodyAsString(), response); + public OrderDeleteResponse delete(String orderId) throws ChargebeeException { + Response response = deleteRaw(orderId); + return OrderDeleteResponse.fromJson(response.getBodyAsString(), response); } - /** createRefundableCreditNoteForOrder a order (executes immediately) - returns raw Response. */ - Response createRefundableCreditNoteForOrderRaw(String orderId) throws Exception { + /** createRefundableCreditNote a order (executes immediately) - returns raw Response. */ + Response createRefundableCreditNoteRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams( "/orders/{order-id}/create_refundable_credit_note", "order-id", orderId); @@ -346,11 +336,11 @@ Response createRefundableCreditNoteForOrderRaw(String orderId) throws Exception } /** - * createRefundableCreditNoteForOrder a order using immutable params (executes immediately) - - * returns raw Response. + * createRefundableCreditNote a order using immutable params (executes immediately) - returns raw + * Response. */ - Response createRefundableCreditNoteForOrderRaw( - String orderId, CreateRefundableCreditNoteForOrderParams params) throws Exception { + Response createRefundableCreditNoteRaw( + String orderId, OrderCreateRefundableCreditNoteParams params) throws ChargebeeException { String path = buildPathWithParams( "/orders/{order-id}/create_refundable_credit_note", "order-id", orderId); @@ -358,21 +348,20 @@ Response createRefundableCreditNoteForOrderRaw( } /** - * createRefundableCreditNoteForOrder a order using raw JSON payload (executes immediately) - - * returns raw Response. + * createRefundableCreditNote a order using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response createRefundableCreditNoteForOrderRaw(String orderId, String jsonPayload) - throws Exception { + Response createRefundableCreditNoteRaw(String orderId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/orders/{order-id}/create_refundable_credit_note", "order-id", orderId); return postJson(path, jsonPayload); } - public CreateRefundableCreditNoteForOrderResponse createRefundableCreditNoteForOrder( - String orderId, CreateRefundableCreditNoteForOrderParams params) throws Exception { - Response response = createRefundableCreditNoteForOrderRaw(orderId, params); - return CreateRefundableCreditNoteForOrderResponse.fromJson( - response.getBodyAsString(), response); + public OrderCreateRefundableCreditNoteResponse createRefundableCreditNote( + String orderId, OrderCreateRefundableCreditNoteParams params) throws ChargebeeException { + Response response = createRefundableCreditNoteRaw(orderId, params); + return OrderCreateRefundableCreditNoteResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/PaymentIntentService.java b/src/main/java/com/chargebee/v4/services/PaymentIntentService.java index e649de8a..ebbe8a0b 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentIntentService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentIntentService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.paymentIntent.params.PaymentIntentUpdateParams; @@ -57,7 +58,7 @@ public PaymentIntentService withOptions(RequestOptions options) { // === Operations === /** retrieve a paymentIntent (executes immediately) - returns raw Response. */ - Response retrieveRaw(String paymentIntentId) throws Exception { + Response retrieveRaw(String paymentIntentId) throws ChargebeeException { String path = buildPathWithParams( "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); @@ -65,13 +66,13 @@ Response retrieveRaw(String paymentIntentId) throws Exception { return get(path, null); } - public PaymentIntentRetrieveResponse retrieve(String paymentIntentId) throws Exception { + public PaymentIntentRetrieveResponse retrieve(String paymentIntentId) throws ChargebeeException { Response response = retrieveRaw(paymentIntentId); return PaymentIntentRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a paymentIntent (executes immediately) - returns raw Response. */ - Response updateRaw(String paymentIntentId) throws Exception { + Response updateRaw(String paymentIntentId) throws ChargebeeException { String path = buildPathWithParams( "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); @@ -82,7 +83,8 @@ Response updateRaw(String paymentIntentId) throws Exception { /** * update a paymentIntent using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String paymentIntentId, PaymentIntentUpdateParams params) throws Exception { + Response updateRaw(String paymentIntentId, PaymentIntentUpdateParams params) + throws ChargebeeException { String path = buildPathWithParams( "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); @@ -92,7 +94,7 @@ Response updateRaw(String paymentIntentId, PaymentIntentUpdateParams params) thr /** * update a paymentIntent using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String paymentIntentId, String jsonPayload) throws Exception { + Response updateRaw(String paymentIntentId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); @@ -100,7 +102,7 @@ Response updateRaw(String paymentIntentId, String jsonPayload) throws Exception } public PaymentIntentUpdateResponse update( - String paymentIntentId, PaymentIntentUpdateParams params) throws Exception { + String paymentIntentId, PaymentIntentUpdateParams params) throws ChargebeeException { Response response = updateRaw(paymentIntentId, params); return PaymentIntentUpdateResponse.fromJson(response.getBodyAsString(), response); } @@ -108,7 +110,7 @@ public PaymentIntentUpdateResponse update( /** * create a paymentIntent using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(PaymentIntentCreateParams params) throws Exception { + Response createRaw(PaymentIntentCreateParams params) throws ChargebeeException { return post("/payment_intents", params != null ? params.toFormData() : null); } @@ -116,12 +118,13 @@ Response createRaw(PaymentIntentCreateParams params) throws Exception { /** * create a paymentIntent using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/payment_intents", jsonPayload); } - public PaymentIntentCreateResponse create(PaymentIntentCreateParams params) throws Exception { + public PaymentIntentCreateResponse create(PaymentIntentCreateParams params) + throws ChargebeeException { Response response = createRaw(params); return PaymentIntentCreateResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java b/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java index a8572c79..a69eea11 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.paymentScheduleScheme.params.PaymentScheduleSchemeCreateParams; @@ -17,7 +18,7 @@ import com.chargebee.v4.models.paymentScheduleScheme.responses.PaymentScheduleSchemeCreateResponse; -import com.chargebee.v4.models.paymentScheduleScheme.responses.DeletePaymentScheduleSchemeResponse; +import com.chargebee.v4.models.paymentScheduleScheme.responses.PaymentScheduleSchemeDeleteResponse; public final class PaymentScheduleSchemeService extends BaseService { @@ -55,7 +56,7 @@ public PaymentScheduleSchemeService withOptions(RequestOptions options) { // === Operations === /** retrieve a paymentScheduleScheme (executes immediately) - returns raw Response. */ - Response retrieveRaw(String paymentScheduleSchemeId) throws Exception { + Response retrieveRaw(String paymentScheduleSchemeId) throws ChargebeeException { String path = buildPathWithParams( "/payment_schedule_schemes/{payment-schedule-scheme-id}", @@ -66,7 +67,7 @@ Response retrieveRaw(String paymentScheduleSchemeId) throws Exception { } public PaymentScheduleSchemeRetrieveResponse retrieve(String paymentScheduleSchemeId) - throws Exception { + throws ChargebeeException { Response response = retrieveRaw(paymentScheduleSchemeId); return PaymentScheduleSchemeRetrieveResponse.fromJson(response.getBodyAsString(), response); } @@ -75,7 +76,7 @@ public PaymentScheduleSchemeRetrieveResponse retrieve(String paymentScheduleSche * create a paymentScheduleScheme using immutable params (executes immediately) - returns raw * Response. */ - Response createRaw(PaymentScheduleSchemeCreateParams params) throws Exception { + Response createRaw(PaymentScheduleSchemeCreateParams params) throws ChargebeeException { return post("/payment_schedule_schemes", params != null ? params.toFormData() : null); } @@ -84,23 +85,20 @@ Response createRaw(PaymentScheduleSchemeCreateParams params) throws Exception { * create a paymentScheduleScheme using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/payment_schedule_schemes", jsonPayload); } public PaymentScheduleSchemeCreateResponse create(PaymentScheduleSchemeCreateParams params) - throws Exception { + throws ChargebeeException { Response response = createRaw(params); return PaymentScheduleSchemeCreateResponse.fromJson(response.getBodyAsString(), response); } - /** - * deletePaymentScheduleScheme a paymentScheduleScheme (executes immediately) - returns raw - * Response. - */ - Response deletePaymentScheduleSchemeRaw(String paymentScheduleSchemeId) throws Exception { + /** delete a paymentScheduleScheme (executes immediately) - returns raw Response. */ + Response deleteRaw(String paymentScheduleSchemeId) throws ChargebeeException { String path = buildPathWithParams( "/payment_schedule_schemes/{payment-schedule-scheme-id}/delete", @@ -110,9 +108,9 @@ Response deletePaymentScheduleSchemeRaw(String paymentScheduleSchemeId) throws E return post(path, null); } - public DeletePaymentScheduleSchemeResponse deletePaymentScheduleScheme( - String paymentScheduleSchemeId) throws Exception { - Response response = deletePaymentScheduleSchemeRaw(paymentScheduleSchemeId); - return DeletePaymentScheduleSchemeResponse.fromJson(response.getBodyAsString(), response); + public PaymentScheduleSchemeDeleteResponse delete(String paymentScheduleSchemeId) + throws ChargebeeException { + Response response = deleteRaw(paymentScheduleSchemeId); + return PaymentScheduleSchemeDeleteResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/PaymentSourceService.java b/src/main/java/com/chargebee/v4/services/PaymentSourceService.java index ace21983..463e1eeb 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentSourceService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentSourceService.java @@ -9,17 +9,18 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.paymentSource.params.PaymentSourceCreateUsingPermanentTokenParams; import com.chargebee.v4.models.paymentSource.params.PaymentSourceCreateCardParams; -import com.chargebee.v4.models.paymentSource.params.VerifyBankAccountForPaymentSourceParams; +import com.chargebee.v4.models.paymentSource.params.PaymentSourceVerifyBankAccountParams; import com.chargebee.v4.models.paymentSource.params.PaymentSourceListParams; -import com.chargebee.v4.models.paymentSource.params.ExportPaymentSourceForPaymentSourceParams; +import com.chargebee.v4.models.paymentSource.params.ExportPaymentSourceParams; import com.chargebee.v4.models.paymentSource.params.PaymentSourceCreateUsingPaymentIntentParams; @@ -27,31 +28,31 @@ import com.chargebee.v4.models.paymentSource.params.PaymentSourceCreateUsingTempTokenParams; -import com.chargebee.v4.models.paymentSource.params.UpdateCardForPaymentSourceParams; +import com.chargebee.v4.models.paymentSource.params.PaymentSourceUpdateCardParams; -import com.chargebee.v4.models.paymentSource.params.SwitchGatewayAccountForPaymentSourceParams; +import com.chargebee.v4.models.paymentSource.params.PaymentSourceSwitchGatewayAccountParams; import com.chargebee.v4.models.paymentSource.params.PaymentSourceCreateUsingTokenParams; import com.chargebee.v4.models.paymentSource.params.PaymentSourceCreateBankAccountParams; -import com.chargebee.v4.models.paymentSource.params.UpdateBankAccountForPaymentSourceParams; +import com.chargebee.v4.models.paymentSource.params.PaymentSourceUpdateBankAccountParams; import com.chargebee.v4.models.paymentSource.responses.PaymentSourceCreateUsingPermanentTokenResponse; -import com.chargebee.v4.models.paymentSource.responses.DeletePaymentSourceResponse; +import com.chargebee.v4.models.paymentSource.responses.PaymentSourceDeleteResponse; import com.chargebee.v4.models.paymentSource.responses.PaymentSourceCreateCardResponse; -import com.chargebee.v4.models.paymentSource.responses.VerifyBankAccountForPaymentSourceResponse; +import com.chargebee.v4.models.paymentSource.responses.PaymentSourceVerifyBankAccountResponse; import com.chargebee.v4.models.paymentSource.responses.PaymentSourceListResponse; -import com.chargebee.v4.models.paymentSource.responses.ExportPaymentSourceForPaymentSourceResponse; +import com.chargebee.v4.models.paymentSource.responses.ExportPaymentSourceResponse; import com.chargebee.v4.models.paymentSource.responses.PaymentSourceCreateUsingPaymentIntentResponse; -import com.chargebee.v4.models.paymentSource.responses.AgreementPdfForPaymentSourceResponse; +import com.chargebee.v4.models.paymentSource.responses.PaymentSourceAgreementPdfResponse; import com.chargebee.v4.models.paymentSource.responses.PaymentSourceRetrieveResponse; @@ -59,17 +60,17 @@ import com.chargebee.v4.models.paymentSource.responses.PaymentSourceCreateUsingTempTokenResponse; -import com.chargebee.v4.models.paymentSource.responses.UpdateCardForPaymentSourceResponse; +import com.chargebee.v4.models.paymentSource.responses.PaymentSourceUpdateCardResponse; -import com.chargebee.v4.models.paymentSource.responses.SwitchGatewayAccountForPaymentSourceResponse; +import com.chargebee.v4.models.paymentSource.responses.PaymentSourceSwitchGatewayAccountResponse; import com.chargebee.v4.models.paymentSource.responses.PaymentSourceCreateUsingTokenResponse; -import com.chargebee.v4.models.paymentSource.responses.DeleteLocalForPaymentSourceResponse; +import com.chargebee.v4.models.paymentSource.responses.PaymentSourceDeleteLocalResponse; import com.chargebee.v4.models.paymentSource.responses.PaymentSourceCreateBankAccountResponse; -import com.chargebee.v4.models.paymentSource.responses.UpdateBankAccountForPaymentSourceResponse; +import com.chargebee.v4.models.paymentSource.responses.PaymentSourceUpdateBankAccountResponse; public final class PaymentSourceService extends BaseService { @@ -111,7 +112,7 @@ public PaymentSourceService withOptions(RequestOptions options) { * returns raw Response. */ Response createUsingPermanentTokenRaw(PaymentSourceCreateUsingPermanentTokenParams params) - throws Exception { + throws ChargebeeException { return post( "/payment_sources/create_using_permanent_token", @@ -122,21 +123,21 @@ Response createUsingPermanentTokenRaw(PaymentSourceCreateUsingPermanentTokenPara * createUsingPermanentToken a paymentSource using raw JSON payload (executes immediately) - * returns raw Response. */ - Response createUsingPermanentTokenRaw(String jsonPayload) throws Exception { + Response createUsingPermanentTokenRaw(String jsonPayload) throws ChargebeeException { return postJson("/payment_sources/create_using_permanent_token", jsonPayload); } public PaymentSourceCreateUsingPermanentTokenResponse createUsingPermanentToken( - PaymentSourceCreateUsingPermanentTokenParams params) throws Exception { + PaymentSourceCreateUsingPermanentTokenParams params) throws ChargebeeException { Response response = createUsingPermanentTokenRaw(params); return PaymentSourceCreateUsingPermanentTokenResponse.fromJson( response.getBodyAsString(), response); } - /** deletePaymentSource a paymentSource (executes immediately) - returns raw Response. */ - Response deletePaymentSourceRaw(String custPaymentSourceId) throws Exception { + /** delete a paymentSource (executes immediately) - returns raw Response. */ + Response deleteRaw(String custPaymentSourceId) throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/delete", @@ -146,17 +147,16 @@ Response deletePaymentSourceRaw(String custPaymentSourceId) throws Exception { return post(path, null); } - public DeletePaymentSourceResponse deletePaymentSource(String custPaymentSourceId) - throws Exception { - Response response = deletePaymentSourceRaw(custPaymentSourceId); - return DeletePaymentSourceResponse.fromJson(response.getBodyAsString(), response); + public PaymentSourceDeleteResponse delete(String custPaymentSourceId) throws ChargebeeException { + Response response = deleteRaw(custPaymentSourceId); + return PaymentSourceDeleteResponse.fromJson(response.getBodyAsString(), response); } /** * createCard a paymentSource using immutable params (executes immediately) - returns raw * Response. */ - Response createCardRaw(PaymentSourceCreateCardParams params) throws Exception { + Response createCardRaw(PaymentSourceCreateCardParams params) throws ChargebeeException { return post("/payment_sources/create_card", params != null ? params.toFormData() : null); } @@ -165,23 +165,20 @@ Response createCardRaw(PaymentSourceCreateCardParams params) throws Exception { * createCard a paymentSource using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createCardRaw(String jsonPayload) throws Exception { + Response createCardRaw(String jsonPayload) throws ChargebeeException { return postJson("/payment_sources/create_card", jsonPayload); } public PaymentSourceCreateCardResponse createCard(PaymentSourceCreateCardParams params) - throws Exception { + throws ChargebeeException { Response response = createCardRaw(params); return PaymentSourceCreateCardResponse.fromJson(response.getBodyAsString(), response); } - /** - * verifyBankAccountForPaymentSource a paymentSource (executes immediately) - returns raw - * Response. - */ - Response verifyBankAccountForPaymentSourceRaw(String custPaymentSourceId) throws Exception { + /** verifyBankAccount a paymentSource (executes immediately) - returns raw Response. */ + Response verifyBankAccountRaw(String custPaymentSourceId) throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/verify_bank_account", @@ -192,11 +189,12 @@ Response verifyBankAccountForPaymentSourceRaw(String custPaymentSourceId) throws } /** - * verifyBankAccountForPaymentSource a paymentSource using immutable params (executes immediately) - * - returns raw Response. + * verifyBankAccount a paymentSource using immutable params (executes immediately) - returns raw + * Response. */ - Response verifyBankAccountForPaymentSourceRaw( - String custPaymentSourceId, VerifyBankAccountForPaymentSourceParams params) throws Exception { + Response verifyBankAccountRaw( + String custPaymentSourceId, PaymentSourceVerifyBankAccountParams params) + throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/verify_bank_account", @@ -206,11 +204,11 @@ Response verifyBankAccountForPaymentSourceRaw( } /** - * verifyBankAccountForPaymentSource a paymentSource using raw JSON payload (executes immediately) - * - returns raw Response. + * verifyBankAccount a paymentSource using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response verifyBankAccountForPaymentSourceRaw(String custPaymentSourceId, String jsonPayload) - throws Exception { + Response verifyBankAccountRaw(String custPaymentSourceId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/verify_bank_account", @@ -219,46 +217,44 @@ Response verifyBankAccountForPaymentSourceRaw(String custPaymentSourceId, String return postJson(path, jsonPayload); } - public VerifyBankAccountForPaymentSourceResponse verifyBankAccountForPaymentSource( - String custPaymentSourceId, VerifyBankAccountForPaymentSourceParams params) throws Exception { - Response response = verifyBankAccountForPaymentSourceRaw(custPaymentSourceId, params); - return VerifyBankAccountForPaymentSourceResponse.fromJson(response.getBodyAsString(), response); + public PaymentSourceVerifyBankAccountResponse verifyBankAccount( + String custPaymentSourceId, PaymentSourceVerifyBankAccountParams params) + throws ChargebeeException { + Response response = verifyBankAccountRaw(custPaymentSourceId, params); + return PaymentSourceVerifyBankAccountResponse.fromJson(response.getBodyAsString(), response); } /** list a paymentSource using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(PaymentSourceListParams params) throws Exception { + Response listRaw(PaymentSourceListParams params) throws ChargebeeException { return get("/payment_sources", params != null ? params.toQueryParams() : null); } /** list a paymentSource without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/payment_sources", null); } /** list a paymentSource using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public PaymentSourceListResponse list(PaymentSourceListParams params) throws Exception { + public PaymentSourceListResponse list(PaymentSourceListParams params) throws ChargebeeException { Response response = listRaw(params); return PaymentSourceListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public PaymentSourceListResponse list() throws Exception { + public PaymentSourceListResponse list() throws ChargebeeException { Response response = listRaw(); return PaymentSourceListResponse.fromJson(response.getBodyAsString(), this, null, response); } - /** - * exportPaymentSourceForPaymentSource a paymentSource (executes immediately) - returns raw - * Response. - */ - Response exportPaymentSourceForPaymentSourceRaw(String custPaymentSourceId) throws Exception { + /** exportPaymentSource a paymentSource (executes immediately) - returns raw Response. */ + Response exportPaymentSourceRaw(String custPaymentSourceId) throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/export_payment_source", @@ -269,12 +265,11 @@ Response exportPaymentSourceForPaymentSourceRaw(String custPaymentSourceId) thro } /** - * exportPaymentSourceForPaymentSource a paymentSource using immutable params (executes - * immediately) - returns raw Response. + * exportPaymentSource a paymentSource using immutable params (executes immediately) - returns raw + * Response. */ - Response exportPaymentSourceForPaymentSourceRaw( - String custPaymentSourceId, ExportPaymentSourceForPaymentSourceParams params) - throws Exception { + Response exportPaymentSourceRaw(String custPaymentSourceId, ExportPaymentSourceParams params) + throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/export_payment_source", @@ -284,11 +279,11 @@ Response exportPaymentSourceForPaymentSourceRaw( } /** - * exportPaymentSourceForPaymentSource a paymentSource using raw JSON payload (executes - * immediately) - returns raw Response. + * exportPaymentSource a paymentSource using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response exportPaymentSourceForPaymentSourceRaw(String custPaymentSourceId, String jsonPayload) - throws Exception { + Response exportPaymentSourceRaw(String custPaymentSourceId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/export_payment_source", @@ -297,12 +292,10 @@ Response exportPaymentSourceForPaymentSourceRaw(String custPaymentSourceId, Stri return postJson(path, jsonPayload); } - public ExportPaymentSourceForPaymentSourceResponse exportPaymentSourceForPaymentSource( - String custPaymentSourceId, ExportPaymentSourceForPaymentSourceParams params) - throws Exception { - Response response = exportPaymentSourceForPaymentSourceRaw(custPaymentSourceId, params); - return ExportPaymentSourceForPaymentSourceResponse.fromJson( - response.getBodyAsString(), response); + public ExportPaymentSourceResponse exportPaymentSource( + String custPaymentSourceId, ExportPaymentSourceParams params) throws ChargebeeException { + Response response = exportPaymentSourceRaw(custPaymentSourceId, params); + return ExportPaymentSourceResponse.fromJson(response.getBodyAsString(), response); } /** @@ -310,7 +303,7 @@ public ExportPaymentSourceForPaymentSourceResponse exportPaymentSourceForPayment * returns raw Response. */ Response createUsingPaymentIntentRaw(PaymentSourceCreateUsingPaymentIntentParams params) - throws Exception { + throws ChargebeeException { return post( "/payment_sources/create_using_payment_intent", @@ -321,21 +314,21 @@ Response createUsingPaymentIntentRaw(PaymentSourceCreateUsingPaymentIntentParams * createUsingPaymentIntent a paymentSource using raw JSON payload (executes immediately) - * returns raw Response. */ - Response createUsingPaymentIntentRaw(String jsonPayload) throws Exception { + Response createUsingPaymentIntentRaw(String jsonPayload) throws ChargebeeException { return postJson("/payment_sources/create_using_payment_intent", jsonPayload); } public PaymentSourceCreateUsingPaymentIntentResponse createUsingPaymentIntent( - PaymentSourceCreateUsingPaymentIntentParams params) throws Exception { + PaymentSourceCreateUsingPaymentIntentParams params) throws ChargebeeException { Response response = createUsingPaymentIntentRaw(params); return PaymentSourceCreateUsingPaymentIntentResponse.fromJson( response.getBodyAsString(), response); } - /** agreementPdfForPaymentSource a paymentSource (executes immediately) - returns raw Response. */ - Response agreementPdfForPaymentSourceRaw(String custPaymentSourceId) throws Exception { + /** agreementPdf a paymentSource (executes immediately) - returns raw Response. */ + Response agreementPdfRaw(String custPaymentSourceId) throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/agreement_pdf", @@ -345,14 +338,14 @@ Response agreementPdfForPaymentSourceRaw(String custPaymentSourceId) throws Exce return post(path, null); } - public AgreementPdfForPaymentSourceResponse agreementPdfForPaymentSource( - String custPaymentSourceId) throws Exception { - Response response = agreementPdfForPaymentSourceRaw(custPaymentSourceId); - return AgreementPdfForPaymentSourceResponse.fromJson(response.getBodyAsString(), response); + public PaymentSourceAgreementPdfResponse agreementPdf(String custPaymentSourceId) + throws ChargebeeException { + Response response = agreementPdfRaw(custPaymentSourceId); + return PaymentSourceAgreementPdfResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a paymentSource (executes immediately) - returns raw Response. */ - Response retrieveRaw(String custPaymentSourceId) throws Exception { + Response retrieveRaw(String custPaymentSourceId) throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}", @@ -362,7 +355,8 @@ Response retrieveRaw(String custPaymentSourceId) throws Exception { return get(path, null); } - public PaymentSourceRetrieveResponse retrieve(String custPaymentSourceId) throws Exception { + public PaymentSourceRetrieveResponse retrieve(String custPaymentSourceId) + throws ChargebeeException { Response response = retrieveRaw(custPaymentSourceId); return PaymentSourceRetrieveResponse.fromJson(response.getBodyAsString(), response); } @@ -371,7 +365,8 @@ public PaymentSourceRetrieveResponse retrieve(String custPaymentSourceId) throws * createVoucherPaymentSource a paymentSource using immutable params (executes immediately) - * returns raw Response. */ - Response createVoucherPaymentSourceRaw(CreateVoucherPaymentSourceParams params) throws Exception { + Response createVoucherPaymentSourceRaw(CreateVoucherPaymentSourceParams params) + throws ChargebeeException { return post( "/payment_sources/create_voucher_payment_source", @@ -382,13 +377,13 @@ Response createVoucherPaymentSourceRaw(CreateVoucherPaymentSourceParams params) * createVoucherPaymentSource a paymentSource using raw JSON payload (executes immediately) - * returns raw Response. */ - Response createVoucherPaymentSourceRaw(String jsonPayload) throws Exception { + Response createVoucherPaymentSourceRaw(String jsonPayload) throws ChargebeeException { return postJson("/payment_sources/create_voucher_payment_source", jsonPayload); } public CreateVoucherPaymentSourceResponse createVoucherPaymentSource( - CreateVoucherPaymentSourceParams params) throws Exception { + CreateVoucherPaymentSourceParams params) throws ChargebeeException { Response response = createVoucherPaymentSourceRaw(params); return CreateVoucherPaymentSourceResponse.fromJson(response.getBodyAsString(), response); @@ -399,7 +394,7 @@ public CreateVoucherPaymentSourceResponse createVoucherPaymentSource( * raw Response. */ Response createUsingTempTokenRaw(PaymentSourceCreateUsingTempTokenParams params) - throws Exception { + throws ChargebeeException { return post( "/payment_sources/create_using_temp_token", params != null ? params.toFormData() : null); @@ -409,20 +404,20 @@ Response createUsingTempTokenRaw(PaymentSourceCreateUsingTempTokenParams params) * createUsingTempToken a paymentSource using raw JSON payload (executes immediately) - returns * raw Response. */ - Response createUsingTempTokenRaw(String jsonPayload) throws Exception { + Response createUsingTempTokenRaw(String jsonPayload) throws ChargebeeException { return postJson("/payment_sources/create_using_temp_token", jsonPayload); } public PaymentSourceCreateUsingTempTokenResponse createUsingTempToken( - PaymentSourceCreateUsingTempTokenParams params) throws Exception { + PaymentSourceCreateUsingTempTokenParams params) throws ChargebeeException { Response response = createUsingTempTokenRaw(params); return PaymentSourceCreateUsingTempTokenResponse.fromJson(response.getBodyAsString(), response); } - /** updateCardForPaymentSource a paymentSource (executes immediately) - returns raw Response. */ - Response updateCardForPaymentSourceRaw(String custPaymentSourceId) throws Exception { + /** updateCard a paymentSource (executes immediately) - returns raw Response. */ + Response updateCardRaw(String custPaymentSourceId) throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/update_card", @@ -433,11 +428,11 @@ Response updateCardForPaymentSourceRaw(String custPaymentSourceId) throws Except } /** - * updateCardForPaymentSource a paymentSource using immutable params (executes immediately) - - * returns raw Response. + * updateCard a paymentSource using immutable params (executes immediately) - returns raw + * Response. */ - Response updateCardForPaymentSourceRaw( - String custPaymentSourceId, UpdateCardForPaymentSourceParams params) throws Exception { + Response updateCardRaw(String custPaymentSourceId, PaymentSourceUpdateCardParams params) + throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/update_card", @@ -447,11 +442,10 @@ Response updateCardForPaymentSourceRaw( } /** - * updateCardForPaymentSource a paymentSource using raw JSON payload (executes immediately) - - * returns raw Response. + * updateCard a paymentSource using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response updateCardForPaymentSourceRaw(String custPaymentSourceId, String jsonPayload) - throws Exception { + Response updateCardRaw(String custPaymentSourceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/update_card", @@ -460,17 +454,14 @@ Response updateCardForPaymentSourceRaw(String custPaymentSourceId, String jsonPa return postJson(path, jsonPayload); } - public UpdateCardForPaymentSourceResponse updateCardForPaymentSource( - String custPaymentSourceId, UpdateCardForPaymentSourceParams params) throws Exception { - Response response = updateCardForPaymentSourceRaw(custPaymentSourceId, params); - return UpdateCardForPaymentSourceResponse.fromJson(response.getBodyAsString(), response); + public PaymentSourceUpdateCardResponse updateCard( + String custPaymentSourceId, PaymentSourceUpdateCardParams params) throws ChargebeeException { + Response response = updateCardRaw(custPaymentSourceId, params); + return PaymentSourceUpdateCardResponse.fromJson(response.getBodyAsString(), response); } - /** - * switchGatewayAccountForPaymentSource a paymentSource (executes immediately) - returns raw - * Response. - */ - Response switchGatewayAccountForPaymentSourceRaw(String custPaymentSourceId) throws Exception { + /** switchGatewayAccount a paymentSource (executes immediately) - returns raw Response. */ + Response switchGatewayAccountRaw(String custPaymentSourceId) throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/switch_gateway_account", @@ -481,12 +472,12 @@ Response switchGatewayAccountForPaymentSourceRaw(String custPaymentSourceId) thr } /** - * switchGatewayAccountForPaymentSource a paymentSource using immutable params (executes - * immediately) - returns raw Response. + * switchGatewayAccount a paymentSource using immutable params (executes immediately) - returns + * raw Response. */ - Response switchGatewayAccountForPaymentSourceRaw( - String custPaymentSourceId, SwitchGatewayAccountForPaymentSourceParams params) - throws Exception { + Response switchGatewayAccountRaw( + String custPaymentSourceId, PaymentSourceSwitchGatewayAccountParams params) + throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/switch_gateway_account", @@ -496,11 +487,11 @@ Response switchGatewayAccountForPaymentSourceRaw( } /** - * switchGatewayAccountForPaymentSource a paymentSource using raw JSON payload (executes - * immediately) - returns raw Response. + * switchGatewayAccount a paymentSource using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response switchGatewayAccountForPaymentSourceRaw(String custPaymentSourceId, String jsonPayload) - throws Exception { + Response switchGatewayAccountRaw(String custPaymentSourceId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/switch_gateway_account", @@ -509,19 +500,19 @@ Response switchGatewayAccountForPaymentSourceRaw(String custPaymentSourceId, Str return postJson(path, jsonPayload); } - public SwitchGatewayAccountForPaymentSourceResponse switchGatewayAccountForPaymentSource( - String custPaymentSourceId, SwitchGatewayAccountForPaymentSourceParams params) - throws Exception { - Response response = switchGatewayAccountForPaymentSourceRaw(custPaymentSourceId, params); - return SwitchGatewayAccountForPaymentSourceResponse.fromJson( - response.getBodyAsString(), response); + public PaymentSourceSwitchGatewayAccountResponse switchGatewayAccount( + String custPaymentSourceId, PaymentSourceSwitchGatewayAccountParams params) + throws ChargebeeException { + Response response = switchGatewayAccountRaw(custPaymentSourceId, params); + return PaymentSourceSwitchGatewayAccountResponse.fromJson(response.getBodyAsString(), response); } /** * createUsingToken a paymentSource using immutable params (executes immediately) - returns raw * Response. */ - Response createUsingTokenRaw(PaymentSourceCreateUsingTokenParams params) throws Exception { + Response createUsingTokenRaw(PaymentSourceCreateUsingTokenParams params) + throws ChargebeeException { return post("/payment_sources/create_using_token", params != null ? params.toFormData() : null); } @@ -530,20 +521,20 @@ Response createUsingTokenRaw(PaymentSourceCreateUsingTokenParams params) throws * createUsingToken a paymentSource using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createUsingTokenRaw(String jsonPayload) throws Exception { + Response createUsingTokenRaw(String jsonPayload) throws ChargebeeException { return postJson("/payment_sources/create_using_token", jsonPayload); } public PaymentSourceCreateUsingTokenResponse createUsingToken( - PaymentSourceCreateUsingTokenParams params) throws Exception { + PaymentSourceCreateUsingTokenParams params) throws ChargebeeException { Response response = createUsingTokenRaw(params); return PaymentSourceCreateUsingTokenResponse.fromJson(response.getBodyAsString(), response); } - /** deleteLocalForPaymentSource a paymentSource (executes immediately) - returns raw Response. */ - Response deleteLocalForPaymentSourceRaw(String custPaymentSourceId) throws Exception { + /** deleteLocal a paymentSource (executes immediately) - returns raw Response. */ + Response deleteLocalRaw(String custPaymentSourceId) throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/delete_local", @@ -553,17 +544,18 @@ Response deleteLocalForPaymentSourceRaw(String custPaymentSourceId) throws Excep return post(path, null); } - public DeleteLocalForPaymentSourceResponse deleteLocalForPaymentSource(String custPaymentSourceId) - throws Exception { - Response response = deleteLocalForPaymentSourceRaw(custPaymentSourceId); - return DeleteLocalForPaymentSourceResponse.fromJson(response.getBodyAsString(), response); + public PaymentSourceDeleteLocalResponse deleteLocal(String custPaymentSourceId) + throws ChargebeeException { + Response response = deleteLocalRaw(custPaymentSourceId); + return PaymentSourceDeleteLocalResponse.fromJson(response.getBodyAsString(), response); } /** * createBankAccount a paymentSource using immutable params (executes immediately) - returns raw * Response. */ - Response createBankAccountRaw(PaymentSourceCreateBankAccountParams params) throws Exception { + Response createBankAccountRaw(PaymentSourceCreateBankAccountParams params) + throws ChargebeeException { return post( "/payment_sources/create_bank_account", params != null ? params.toFormData() : null); @@ -573,23 +565,20 @@ Response createBankAccountRaw(PaymentSourceCreateBankAccountParams params) throw * createBankAccount a paymentSource using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createBankAccountRaw(String jsonPayload) throws Exception { + Response createBankAccountRaw(String jsonPayload) throws ChargebeeException { return postJson("/payment_sources/create_bank_account", jsonPayload); } public PaymentSourceCreateBankAccountResponse createBankAccount( - PaymentSourceCreateBankAccountParams params) throws Exception { + PaymentSourceCreateBankAccountParams params) throws ChargebeeException { Response response = createBankAccountRaw(params); return PaymentSourceCreateBankAccountResponse.fromJson(response.getBodyAsString(), response); } - /** - * updateBankAccountForPaymentSource a paymentSource (executes immediately) - returns raw - * Response. - */ - Response updateBankAccountForPaymentSourceRaw(String custPaymentSourceId) throws Exception { + /** updateBankAccount a paymentSource (executes immediately) - returns raw Response. */ + Response updateBankAccountRaw(String custPaymentSourceId) throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/update_bank_account", @@ -600,11 +589,12 @@ Response updateBankAccountForPaymentSourceRaw(String custPaymentSourceId) throws } /** - * updateBankAccountForPaymentSource a paymentSource using immutable params (executes immediately) - * - returns raw Response. + * updateBankAccount a paymentSource using immutable params (executes immediately) - returns raw + * Response. */ - Response updateBankAccountForPaymentSourceRaw( - String custPaymentSourceId, UpdateBankAccountForPaymentSourceParams params) throws Exception { + Response updateBankAccountRaw( + String custPaymentSourceId, PaymentSourceUpdateBankAccountParams params) + throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/update_bank_account", @@ -614,11 +604,11 @@ Response updateBankAccountForPaymentSourceRaw( } /** - * updateBankAccountForPaymentSource a paymentSource using raw JSON payload (executes immediately) - * - returns raw Response. + * updateBankAccount a paymentSource using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response updateBankAccountForPaymentSourceRaw(String custPaymentSourceId, String jsonPayload) - throws Exception { + Response updateBankAccountRaw(String custPaymentSourceId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/payment_sources/{cust-payment-source-id}/update_bank_account", @@ -627,9 +617,10 @@ Response updateBankAccountForPaymentSourceRaw(String custPaymentSourceId, String return postJson(path, jsonPayload); } - public UpdateBankAccountForPaymentSourceResponse updateBankAccountForPaymentSource( - String custPaymentSourceId, UpdateBankAccountForPaymentSourceParams params) throws Exception { - Response response = updateBankAccountForPaymentSourceRaw(custPaymentSourceId, params); - return UpdateBankAccountForPaymentSourceResponse.fromJson(response.getBodyAsString(), response); + public PaymentSourceUpdateBankAccountResponse updateBankAccount( + String custPaymentSourceId, PaymentSourceUpdateBankAccountParams params) + throws ChargebeeException { + Response response = updateBankAccountRaw(custPaymentSourceId, params); + return PaymentSourceUpdateBankAccountResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java b/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java index 8226d0d6..066c3287 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.paymentVoucher.params.PaymentVouchersForCustomerParams; @@ -65,7 +66,7 @@ public PaymentVoucherService withOptions(RequestOptions options) { * returns raw Response. */ Response paymentVouchersForCustomerRaw(String customerId, PaymentVouchersForCustomerParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/payment_vouchers", "customer-id", customerId); return get(path, params != null ? params.toQueryParams() : null); @@ -75,7 +76,7 @@ Response paymentVouchersForCustomerRaw(String customerId, PaymentVouchersForCust * paymentVouchersForCustomer a paymentVoucher without params (executes immediately) - returns raw * Response. */ - Response paymentVouchersForCustomerRaw(String customerId) throws Exception { + Response paymentVouchersForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/payment_vouchers", "customer-id", customerId); return get(path, null); @@ -85,21 +86,22 @@ Response paymentVouchersForCustomerRaw(String customerId) throws Exception { * paymentVouchersForCustomer a paymentVoucher using raw JSON payload (executes immediately) - * returns raw Response. */ - Response paymentVouchersForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response paymentVouchersForCustomerRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/payment_vouchers", "customer-id", customerId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public PaymentVouchersForCustomerResponse paymentVouchersForCustomer( - String customerId, PaymentVouchersForCustomerParams params) throws Exception { + String customerId, PaymentVouchersForCustomerParams params) throws ChargebeeException { Response response = paymentVouchersForCustomerRaw(customerId, params); return PaymentVouchersForCustomerResponse.fromJson( response.getBodyAsString(), this, params, customerId, response); } public PaymentVouchersForCustomerResponse paymentVouchersForCustomer(String customerId) - throws Exception { + throws ChargebeeException { Response response = paymentVouchersForCustomerRaw(customerId); return PaymentVouchersForCustomerResponse.fromJson( response.getBodyAsString(), this, null, customerId, response); @@ -110,7 +112,7 @@ public PaymentVouchersForCustomerResponse paymentVouchersForCustomer(String cust * returns raw Response. */ Response paymentVouchersForInvoiceRaw(String invoiceId, PaymentVouchersForInvoiceParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payment_vouchers", "invoice-id", invoiceId); return get(path, params != null ? params.toQueryParams() : null); @@ -120,7 +122,7 @@ Response paymentVouchersForInvoiceRaw(String invoiceId, PaymentVouchersForInvoic * paymentVouchersForInvoice a paymentVoucher without params (executes immediately) - returns raw * Response. */ - Response paymentVouchersForInvoiceRaw(String invoiceId) throws Exception { + Response paymentVouchersForInvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payment_vouchers", "invoice-id", invoiceId); return get(path, null); @@ -130,28 +132,29 @@ Response paymentVouchersForInvoiceRaw(String invoiceId) throws Exception { * paymentVouchersForInvoice a paymentVoucher using raw JSON payload (executes immediately) - * returns raw Response. */ - Response paymentVouchersForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response paymentVouchersForInvoiceRaw(String invoiceId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payment_vouchers", "invoice-id", invoiceId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public PaymentVouchersForInvoiceResponse paymentVouchersForInvoice( - String invoiceId, PaymentVouchersForInvoiceParams params) throws Exception { + String invoiceId, PaymentVouchersForInvoiceParams params) throws ChargebeeException { Response response = paymentVouchersForInvoiceRaw(invoiceId, params); return PaymentVouchersForInvoiceResponse.fromJson( response.getBodyAsString(), this, params, invoiceId, response); } public PaymentVouchersForInvoiceResponse paymentVouchersForInvoice(String invoiceId) - throws Exception { + throws ChargebeeException { Response response = paymentVouchersForInvoiceRaw(invoiceId); return PaymentVouchersForInvoiceResponse.fromJson( response.getBodyAsString(), this, null, invoiceId, response); } /** retrieve a paymentVoucher (executes immediately) - returns raw Response. */ - Response retrieveRaw(String paymentVoucherId) throws Exception { + Response retrieveRaw(String paymentVoucherId) throws ChargebeeException { String path = buildPathWithParams( "/payment_vouchers/{payment-voucher-id}", "payment-voucher-id", paymentVoucherId); @@ -159,7 +162,8 @@ Response retrieveRaw(String paymentVoucherId) throws Exception { return get(path, null); } - public PaymentVoucherRetrieveResponse retrieve(String paymentVoucherId) throws Exception { + public PaymentVoucherRetrieveResponse retrieve(String paymentVoucherId) + throws ChargebeeException { Response response = retrieveRaw(paymentVoucherId); return PaymentVoucherRetrieveResponse.fromJson(response.getBodyAsString(), response); } @@ -167,7 +171,7 @@ public PaymentVoucherRetrieveResponse retrieve(String paymentVoucherId) throws E /** * create a paymentVoucher using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(PaymentVoucherCreateParams params) throws Exception { + Response createRaw(PaymentVoucherCreateParams params) throws ChargebeeException { return post("/payment_vouchers", params != null ? params.toFormData() : null); } @@ -175,12 +179,13 @@ Response createRaw(PaymentVoucherCreateParams params) throws Exception { /** * create a paymentVoucher using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/payment_vouchers", jsonPayload); } - public PaymentVoucherCreateResponse create(PaymentVoucherCreateParams params) throws Exception { + public PaymentVoucherCreateResponse create(PaymentVoucherCreateParams params) + throws ChargebeeException { Response response = createRaw(params); return PaymentVoucherCreateResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java index ffa92bfb..91b4f87f 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.pc2MigrationItemFamily.params.Pc2MigrationItemFamilyUpdateParams; @@ -17,7 +18,7 @@ import com.chargebee.v4.models.pc2MigrationItemFamily.params.Pc2MigrationItemFamilyCreateParams; -import com.chargebee.v4.models.pc2MigrationItemFamily.responses.DeletePc2MigrationItemFamilyResponse; +import com.chargebee.v4.models.pc2MigrationItemFamily.responses.Pc2MigrationItemFamilyDeleteResponse; import com.chargebee.v4.models.pc2MigrationItemFamily.responses.Pc2MigrationItemFamilyRetrieveResponse; @@ -63,11 +64,8 @@ public Pc2MigrationItemFamilyService withOptions(RequestOptions options) { // === Operations === - /** - * deletePc2MigrationItemFamily a pc2MigrationItemFamily (executes immediately) - returns raw - * Response. - */ - Response deletePc2MigrationItemFamilyRaw(String pc2MigrationItemFamilyId) throws Exception { + /** delete a pc2MigrationItemFamily (executes immediately) - returns raw Response. */ + Response deleteRaw(String pc2MigrationItemFamilyId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_item_families/{pc2-migration-item-family-id}/delete", @@ -77,14 +75,14 @@ Response deletePc2MigrationItemFamilyRaw(String pc2MigrationItemFamilyId) throws return post(path, null); } - public DeletePc2MigrationItemFamilyResponse deletePc2MigrationItemFamily( - String pc2MigrationItemFamilyId) throws Exception { - Response response = deletePc2MigrationItemFamilyRaw(pc2MigrationItemFamilyId); - return DeletePc2MigrationItemFamilyResponse.fromJson(response.getBodyAsString(), response); + public Pc2MigrationItemFamilyDeleteResponse delete(String pc2MigrationItemFamilyId) + throws ChargebeeException { + Response response = deleteRaw(pc2MigrationItemFamilyId); + return Pc2MigrationItemFamilyDeleteResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a pc2MigrationItemFamily (executes immediately) - returns raw Response. */ - Response retrieveRaw(String pc2MigrationItemFamilyId) throws Exception { + Response retrieveRaw(String pc2MigrationItemFamilyId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_item_families/{pc2-migration-item-family-id}", @@ -95,13 +93,13 @@ Response retrieveRaw(String pc2MigrationItemFamilyId) throws Exception { } public Pc2MigrationItemFamilyRetrieveResponse retrieve(String pc2MigrationItemFamilyId) - throws Exception { + throws ChargebeeException { Response response = retrieveRaw(pc2MigrationItemFamilyId); return Pc2MigrationItemFamilyRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a pc2MigrationItemFamily (executes immediately) - returns raw Response. */ - Response updateRaw(String pc2MigrationItemFamilyId) throws Exception { + Response updateRaw(String pc2MigrationItemFamilyId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_item_families/{pc2-migration-item-family-id}", @@ -116,7 +114,7 @@ Response updateRaw(String pc2MigrationItemFamilyId) throws Exception { * Response. */ Response updateRaw(String pc2MigrationItemFamilyId, Pc2MigrationItemFamilyUpdateParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_item_families/{pc2-migration-item-family-id}", @@ -129,7 +127,8 @@ Response updateRaw(String pc2MigrationItemFamilyId, Pc2MigrationItemFamilyUpdate * update a pc2MigrationItemFamily using raw JSON payload (executes immediately) - returns raw * Response. */ - Response updateRaw(String pc2MigrationItemFamilyId, String jsonPayload) throws Exception { + Response updateRaw(String pc2MigrationItemFamilyId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_item_families/{pc2-migration-item-family-id}", @@ -139,7 +138,8 @@ Response updateRaw(String pc2MigrationItemFamilyId, String jsonPayload) throws E } public Pc2MigrationItemFamilyUpdateResponse update( - String pc2MigrationItemFamilyId, Pc2MigrationItemFamilyUpdateParams params) throws Exception { + String pc2MigrationItemFamilyId, Pc2MigrationItemFamilyUpdateParams params) + throws ChargebeeException { Response response = updateRaw(pc2MigrationItemFamilyId, params); return Pc2MigrationItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response); } @@ -148,13 +148,13 @@ public Pc2MigrationItemFamilyUpdateResponse update( * list a pc2MigrationItemFamily using immutable params (executes immediately) - returns raw * Response. */ - Response listRaw(Pc2MigrationItemFamilyListParams params) throws Exception { + Response listRaw(Pc2MigrationItemFamilyListParams params) throws ChargebeeException { return get("/pc2_migration_item_families", params != null ? params.toQueryParams() : null); } /** list a pc2MigrationItemFamily without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/pc2_migration_item_families", null); } @@ -163,20 +163,20 @@ Response listRaw() throws Exception { * list a pc2MigrationItemFamily using raw JSON payload (executes immediately) - returns raw * Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public Pc2MigrationItemFamilyListResponse list(Pc2MigrationItemFamilyListParams params) - throws Exception { + throws ChargebeeException { Response response = listRaw(params); return Pc2MigrationItemFamilyListResponse.fromJson( response.getBodyAsString(), this, params, response); } - public Pc2MigrationItemFamilyListResponse list() throws Exception { + public Pc2MigrationItemFamilyListResponse list() throws ChargebeeException { Response response = listRaw(); return Pc2MigrationItemFamilyListResponse.fromJson( response.getBodyAsString(), this, null, response); @@ -186,7 +186,7 @@ public Pc2MigrationItemFamilyListResponse list() throws Exception { * create a pc2MigrationItemFamily using immutable params (executes immediately) - returns raw * Response. */ - Response createRaw(Pc2MigrationItemFamilyCreateParams params) throws Exception { + Response createRaw(Pc2MigrationItemFamilyCreateParams params) throws ChargebeeException { return post("/pc2_migration_item_families", params != null ? params.toFormData() : null); } @@ -195,13 +195,13 @@ Response createRaw(Pc2MigrationItemFamilyCreateParams params) throws Exception { * create a pc2MigrationItemFamily using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/pc2_migration_item_families", jsonPayload); } public Pc2MigrationItemFamilyCreateResponse create(Pc2MigrationItemFamilyCreateParams params) - throws Exception { + throws ChargebeeException { Response response = createRaw(params); return Pc2MigrationItemFamilyCreateResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java index 004aebc2..1b3ede9f 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.pc2MigrationItemPrice.params.Pc2MigrationItemPriceListParams; @@ -17,7 +18,7 @@ import com.chargebee.v4.models.pc2MigrationItemPrice.responses.Pc2MigrationItemPriceListResponse; -import com.chargebee.v4.models.pc2MigrationItemPrice.responses.DeletePc2MigrationItemPriceResponse; +import com.chargebee.v4.models.pc2MigrationItemPrice.responses.Pc2MigrationItemPriceDeleteResponse; import com.chargebee.v4.models.pc2MigrationItemPrice.responses.Pc2MigrationItemPriceRetrieveResponse; @@ -62,13 +63,13 @@ public Pc2MigrationItemPriceService withOptions(RequestOptions options) { * list a pc2MigrationItemPrice using immutable params (executes immediately) - returns raw * Response. */ - Response listRaw(Pc2MigrationItemPriceListParams params) throws Exception { + Response listRaw(Pc2MigrationItemPriceListParams params) throws ChargebeeException { return get("/pc2_migration_item_prices", params != null ? params.toQueryParams() : null); } /** list a pc2MigrationItemPrice without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/pc2_migration_item_prices", null); } @@ -77,30 +78,27 @@ Response listRaw() throws Exception { * list a pc2MigrationItemPrice using raw JSON payload (executes immediately) - returns raw * Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public Pc2MigrationItemPriceListResponse list(Pc2MigrationItemPriceListParams params) - throws Exception { + throws ChargebeeException { Response response = listRaw(params); return Pc2MigrationItemPriceListResponse.fromJson( response.getBodyAsString(), this, params, response); } - public Pc2MigrationItemPriceListResponse list() throws Exception { + public Pc2MigrationItemPriceListResponse list() throws ChargebeeException { Response response = listRaw(); return Pc2MigrationItemPriceListResponse.fromJson( response.getBodyAsString(), this, null, response); } - /** - * deletePc2MigrationItemPrice a pc2MigrationItemPrice (executes immediately) - returns raw - * Response. - */ - Response deletePc2MigrationItemPriceRaw(String pc2MigrationItemPriceId) throws Exception { + /** delete a pc2MigrationItemPrice (executes immediately) - returns raw Response. */ + Response deleteRaw(String pc2MigrationItemPriceId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_item_prices/{pc2-migration-item-price-id}/delete", @@ -110,14 +108,14 @@ Response deletePc2MigrationItemPriceRaw(String pc2MigrationItemPriceId) throws E return post(path, null); } - public DeletePc2MigrationItemPriceResponse deletePc2MigrationItemPrice( - String pc2MigrationItemPriceId) throws Exception { - Response response = deletePc2MigrationItemPriceRaw(pc2MigrationItemPriceId); - return DeletePc2MigrationItemPriceResponse.fromJson(response.getBodyAsString(), response); + public Pc2MigrationItemPriceDeleteResponse delete(String pc2MigrationItemPriceId) + throws ChargebeeException { + Response response = deleteRaw(pc2MigrationItemPriceId); + return Pc2MigrationItemPriceDeleteResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a pc2MigrationItemPrice (executes immediately) - returns raw Response. */ - Response retrieveRaw(String pc2MigrationItemPriceId) throws Exception { + Response retrieveRaw(String pc2MigrationItemPriceId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_item_prices/{pc2-migration-item-price-id}", @@ -128,13 +126,13 @@ Response retrieveRaw(String pc2MigrationItemPriceId) throws Exception { } public Pc2MigrationItemPriceRetrieveResponse retrieve(String pc2MigrationItemPriceId) - throws Exception { + throws ChargebeeException { Response response = retrieveRaw(pc2MigrationItemPriceId); return Pc2MigrationItemPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a pc2MigrationItemPrice (executes immediately) - returns raw Response. */ - Response updateRaw(String pc2MigrationItemPriceId) throws Exception { + Response updateRaw(String pc2MigrationItemPriceId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_item_prices/{pc2-migration-item-price-id}", @@ -149,7 +147,7 @@ Response updateRaw(String pc2MigrationItemPriceId) throws Exception { * Response. */ Response updateRaw(String pc2MigrationItemPriceId, Pc2MigrationItemPriceUpdateParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_item_prices/{pc2-migration-item-price-id}", @@ -162,7 +160,7 @@ Response updateRaw(String pc2MigrationItemPriceId, Pc2MigrationItemPriceUpdatePa * update a pc2MigrationItemPrice using raw JSON payload (executes immediately) - returns raw * Response. */ - Response updateRaw(String pc2MigrationItemPriceId, String jsonPayload) throws Exception { + Response updateRaw(String pc2MigrationItemPriceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_item_prices/{pc2-migration-item-price-id}", @@ -172,7 +170,8 @@ Response updateRaw(String pc2MigrationItemPriceId, String jsonPayload) throws Ex } public Pc2MigrationItemPriceUpdateResponse update( - String pc2MigrationItemPriceId, Pc2MigrationItemPriceUpdateParams params) throws Exception { + String pc2MigrationItemPriceId, Pc2MigrationItemPriceUpdateParams params) + throws ChargebeeException { Response response = updateRaw(pc2MigrationItemPriceId, params); return Pc2MigrationItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java index a2c200aa..2da39717 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.pc2MigrationItem.params.Pc2MigrationItemUpdateParams; @@ -17,19 +18,19 @@ import com.chargebee.v4.models.pc2MigrationItem.params.Pc2MigrationItemCreateParams; -import com.chargebee.v4.models.pc2MigrationItem.params.Pc2MigrationItemListApplicableItemsParams; +import com.chargebee.v4.models.pc2MigrationItem.params.Pc2MigrationItemListApplicableAddonsParams; import com.chargebee.v4.models.pc2MigrationItem.responses.Pc2MigrationItemRetrieveResponse; import com.chargebee.v4.models.pc2MigrationItem.responses.Pc2MigrationItemUpdateResponse; -import com.chargebee.v4.models.pc2MigrationItem.responses.DeletePc2MigrationItemResponse; +import com.chargebee.v4.models.pc2MigrationItem.responses.Pc2MigrationItemDeleteResponse; import com.chargebee.v4.models.pc2MigrationItem.responses.Pc2MigrationItemListResponse; import com.chargebee.v4.models.pc2MigrationItem.responses.Pc2MigrationItemCreateResponse; -import com.chargebee.v4.models.pc2MigrationItem.responses.Pc2MigrationItemListApplicableItemsResponse; +import com.chargebee.v4.models.pc2MigrationItem.responses.Pc2MigrationItemListApplicableAddonsResponse; public final class Pc2MigrationItemService extends BaseService { @@ -67,7 +68,7 @@ public Pc2MigrationItemService withOptions(RequestOptions options) { // === Operations === /** retrieve a pc2MigrationItem (executes immediately) - returns raw Response. */ - Response retrieveRaw(String pc2MigrationItemId) throws Exception { + Response retrieveRaw(String pc2MigrationItemId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_items/{pc2-migration-item-id}", @@ -77,13 +78,14 @@ Response retrieveRaw(String pc2MigrationItemId) throws Exception { return get(path, null); } - public Pc2MigrationItemRetrieveResponse retrieve(String pc2MigrationItemId) throws Exception { + public Pc2MigrationItemRetrieveResponse retrieve(String pc2MigrationItemId) + throws ChargebeeException { Response response = retrieveRaw(pc2MigrationItemId); return Pc2MigrationItemRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a pc2MigrationItem (executes immediately) - returns raw Response. */ - Response updateRaw(String pc2MigrationItemId) throws Exception { + Response updateRaw(String pc2MigrationItemId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_items/{pc2-migration-item-id}", @@ -97,7 +99,7 @@ Response updateRaw(String pc2MigrationItemId) throws Exception { * update a pc2MigrationItem using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String pc2MigrationItemId, Pc2MigrationItemUpdateParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_items/{pc2-migration-item-id}", @@ -109,7 +111,7 @@ Response updateRaw(String pc2MigrationItemId, Pc2MigrationItemUpdateParams param /** * update a pc2MigrationItem using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String pc2MigrationItemId, String jsonPayload) throws Exception { + Response updateRaw(String pc2MigrationItemId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_items/{pc2-migration-item-id}", @@ -119,13 +121,13 @@ Response updateRaw(String pc2MigrationItemId, String jsonPayload) throws Excepti } public Pc2MigrationItemUpdateResponse update( - String pc2MigrationItemId, Pc2MigrationItemUpdateParams params) throws Exception { + String pc2MigrationItemId, Pc2MigrationItemUpdateParams params) throws ChargebeeException { Response response = updateRaw(pc2MigrationItemId, params); return Pc2MigrationItemUpdateResponse.fromJson(response.getBodyAsString(), response); } - /** deletePc2MigrationItem a pc2MigrationItem (executes immediately) - returns raw Response. */ - Response deletePc2MigrationItemRaw(String pc2MigrationItemId) throws Exception { + /** delete a pc2MigrationItem (executes immediately) - returns raw Response. */ + Response deleteRaw(String pc2MigrationItemId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migration_items/{pc2-migration-item-id}/delete", @@ -135,22 +137,22 @@ Response deletePc2MigrationItemRaw(String pc2MigrationItemId) throws Exception { return post(path, null); } - public DeletePc2MigrationItemResponse deletePc2MigrationItem(String pc2MigrationItemId) - throws Exception { - Response response = deletePc2MigrationItemRaw(pc2MigrationItemId); - return DeletePc2MigrationItemResponse.fromJson(response.getBodyAsString(), response); + public Pc2MigrationItemDeleteResponse delete(String pc2MigrationItemId) + throws ChargebeeException { + Response response = deleteRaw(pc2MigrationItemId); + return Pc2MigrationItemDeleteResponse.fromJson(response.getBodyAsString(), response); } /** * list a pc2MigrationItem using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(Pc2MigrationItemListParams params) throws Exception { + Response listRaw(Pc2MigrationItemListParams params) throws ChargebeeException { return get("/pc2_migration_items", params != null ? params.toQueryParams() : null); } /** list a pc2MigrationItem without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/pc2_migration_items", null); } @@ -158,19 +160,20 @@ Response listRaw() throws Exception { /** * list a pc2MigrationItem using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public Pc2MigrationItemListResponse list(Pc2MigrationItemListParams params) throws Exception { + public Pc2MigrationItemListResponse list(Pc2MigrationItemListParams params) + throws ChargebeeException { Response response = listRaw(params); return Pc2MigrationItemListResponse.fromJson( response.getBodyAsString(), this, params, response); } - public Pc2MigrationItemListResponse list() throws Exception { + public Pc2MigrationItemListResponse list() throws ChargebeeException { Response response = listRaw(); return Pc2MigrationItemListResponse.fromJson(response.getBodyAsString(), this, null, response); } @@ -178,7 +181,7 @@ public Pc2MigrationItemListResponse list() throws Exception { /** * create a pc2MigrationItem using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(Pc2MigrationItemCreateParams params) throws Exception { + Response createRaw(Pc2MigrationItemCreateParams params) throws ChargebeeException { return post("/pc2_migration_items", params != null ? params.toFormData() : null); } @@ -186,58 +189,59 @@ Response createRaw(Pc2MigrationItemCreateParams params) throws Exception { /** * create a pc2MigrationItem using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/pc2_migration_items", jsonPayload); } public Pc2MigrationItemCreateResponse create(Pc2MigrationItemCreateParams params) - throws Exception { + throws ChargebeeException { Response response = createRaw(params); return Pc2MigrationItemCreateResponse.fromJson(response.getBodyAsString(), response); } /** - * listApplicableItems a pc2MigrationItem using immutable params (executes immediately) - returns + * listApplicableAddons a pc2MigrationItem using immutable params (executes immediately) - returns * raw Response. */ - Response listApplicableItemsRaw(Pc2MigrationItemListApplicableItemsParams params) - throws Exception { + Response listApplicableAddonsRaw(Pc2MigrationItemListApplicableAddonsParams params) + throws ChargebeeException { return get( "/pc2_migration_items/applicable_items", params != null ? params.toQueryParams() : null); } /** - * listApplicableItems a pc2MigrationItem without params (executes immediately) - returns raw + * listApplicableAddons a pc2MigrationItem without params (executes immediately) - returns raw * Response. */ - Response listApplicableItemsRaw() throws Exception { + Response listApplicableAddonsRaw() throws ChargebeeException { return get("/pc2_migration_items/applicable_items", null); } /** - * listApplicableItems a pc2MigrationItem using raw JSON payload (executes immediately) - returns + * listApplicableAddons a pc2MigrationItem using raw JSON payload (executes immediately) - returns * raw Response. */ - Response listApplicableItemsRaw(String jsonPayload) throws Exception { + Response listApplicableAddonsRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public Pc2MigrationItemListApplicableItemsResponse listApplicableItems( - Pc2MigrationItemListApplicableItemsParams params) throws Exception { - Response response = listApplicableItemsRaw(params); + public Pc2MigrationItemListApplicableAddonsResponse listApplicableAddons( + Pc2MigrationItemListApplicableAddonsParams params) throws ChargebeeException { + Response response = listApplicableAddonsRaw(params); - return Pc2MigrationItemListApplicableItemsResponse.fromJson( + return Pc2MigrationItemListApplicableAddonsResponse.fromJson( response.getBodyAsString(), this, params, response); } - public Pc2MigrationItemListApplicableItemsResponse listApplicableItems() throws Exception { - Response response = listApplicableItemsRaw(); - return Pc2MigrationItemListApplicableItemsResponse.fromJson( + public Pc2MigrationItemListApplicableAddonsResponse listApplicableAddons() + throws ChargebeeException { + Response response = listApplicableAddonsRaw(); + return Pc2MigrationItemListApplicableAddonsResponse.fromJson( response.getBodyAsString(), this, null, response); } } diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java index dd07ae78..55c58f7e 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java @@ -9,17 +9,18 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.pc2Migration.params.Pc2MigrationCreateParams; -import com.chargebee.v4.models.pc2Migration.responses.ContactSupportForPc2MigrationResponse; +import com.chargebee.v4.models.pc2Migration.responses.Pc2MigrationContactSupportResponse; import com.chargebee.v4.models.pc2Migration.responses.Pc2MigrationRetrieveResponse; import com.chargebee.v4.models.pc2Migration.responses.Pc2MigrationCreateResponse; -import com.chargebee.v4.models.pc2Migration.responses.InitiateForPc2MigrationResponse; +import com.chargebee.v4.models.pc2Migration.responses.Pc2MigrationInitiateResponse; public final class Pc2MigrationService extends BaseService { @@ -56,8 +57,8 @@ public Pc2MigrationService withOptions(RequestOptions options) { // === Operations === - /** contactSupportForPc2Migration a pc2Migration (executes immediately) - returns raw Response. */ - Response contactSupportForPc2MigrationRaw(String pc2MigrationId) throws Exception { + /** contactSupport a pc2Migration (executes immediately) - returns raw Response. */ + Response contactSupportRaw(String pc2MigrationId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migrations/{pc2-migration-id}/contact_support", @@ -67,14 +68,14 @@ Response contactSupportForPc2MigrationRaw(String pc2MigrationId) throws Exceptio return post(path, null); } - public ContactSupportForPc2MigrationResponse contactSupportForPc2Migration(String pc2MigrationId) - throws Exception { - Response response = contactSupportForPc2MigrationRaw(pc2MigrationId); - return ContactSupportForPc2MigrationResponse.fromJson(response.getBodyAsString(), response); + public Pc2MigrationContactSupportResponse contactSupport(String pc2MigrationId) + throws ChargebeeException { + Response response = contactSupportRaw(pc2MigrationId); + return Pc2MigrationContactSupportResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a pc2Migration (executes immediately) - returns raw Response. */ - Response retrieveRaw(String pc2MigrationId) throws Exception { + Response retrieveRaw(String pc2MigrationId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migrations/{pc2-migration-id}", "pc2-migration-id", pc2MigrationId); @@ -82,31 +83,32 @@ Response retrieveRaw(String pc2MigrationId) throws Exception { return get(path, null); } - public Pc2MigrationRetrieveResponse retrieve(String pc2MigrationId) throws Exception { + public Pc2MigrationRetrieveResponse retrieve(String pc2MigrationId) throws ChargebeeException { Response response = retrieveRaw(pc2MigrationId); return Pc2MigrationRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** create a pc2Migration using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(Pc2MigrationCreateParams params) throws Exception { + Response createRaw(Pc2MigrationCreateParams params) throws ChargebeeException { return post("/pc2_migrations", params != null ? params.toFormData() : null); } /** create a pc2Migration using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/pc2_migrations", jsonPayload); } - public Pc2MigrationCreateResponse create(Pc2MigrationCreateParams params) throws Exception { + public Pc2MigrationCreateResponse create(Pc2MigrationCreateParams params) + throws ChargebeeException { Response response = createRaw(params); return Pc2MigrationCreateResponse.fromJson(response.getBodyAsString(), response); } - /** initiateForPc2Migration a pc2Migration (executes immediately) - returns raw Response. */ - Response initiateForPc2MigrationRaw(String pc2MigrationId) throws Exception { + /** initiate a pc2Migration (executes immediately) - returns raw Response. */ + Response initiateRaw(String pc2MigrationId) throws ChargebeeException { String path = buildPathWithParams( "/pc2_migrations/{pc2-migration-id}/initiate", "pc2-migration-id", pc2MigrationId); @@ -114,9 +116,8 @@ Response initiateForPc2MigrationRaw(String pc2MigrationId) throws Exception { return post(path, null); } - public InitiateForPc2MigrationResponse initiateForPc2Migration(String pc2MigrationId) - throws Exception { - Response response = initiateForPc2MigrationRaw(pc2MigrationId); - return InitiateForPc2MigrationResponse.fromJson(response.getBodyAsString(), response); + public Pc2MigrationInitiateResponse initiate(String pc2MigrationId) throws ChargebeeException { + Response response = initiateRaw(pc2MigrationId); + return Pc2MigrationInitiateResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java b/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java index c106fe8f..489f72fa 100644 --- a/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java +++ b/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.personalizedOffer.params.PersonalizedOfferCreateParams; +import com.chargebee.v4.models.personalizedOffer.params.PersonalizedOffersParams; -import com.chargebee.v4.models.personalizedOffer.responses.PersonalizedOfferCreateResponse; +import com.chargebee.v4.models.personalizedOffer.responses.PersonalizedOffersResponse; public final class PersonalizedOfferService extends BaseService { @@ -51,27 +52,27 @@ public PersonalizedOfferService withOptions(RequestOptions options) { // === Operations === /** - * create a personalizedOffer using immutable params (executes immediately) - returns raw - * Response. + * personalizedOffers a personalizedOffer using immutable params (executes immediately) - returns + * raw Response. */ - Response createRaw(PersonalizedOfferCreateParams params) throws Exception { + Response personalizedOffersRaw(PersonalizedOffersParams params) throws ChargebeeException { return post("/personalized_offers", params != null ? params.toFormData() : null); } /** - * create a personalizedOffer using raw JSON payload (executes immediately) - returns raw - * Response. + * personalizedOffers a personalizedOffer using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response personalizedOffersRaw(String jsonPayload) throws ChargebeeException { return postJson("/personalized_offers", jsonPayload); } - public PersonalizedOfferCreateResponse create(PersonalizedOfferCreateParams params) - throws Exception { - Response response = createRaw(params); + public PersonalizedOffersResponse personalizedOffers(PersonalizedOffersParams params) + throws ChargebeeException { + Response response = personalizedOffersRaw(params); - return PersonalizedOfferCreateResponse.fromJson(response.getBodyAsString(), response); + return PersonalizedOffersResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/PlanService.java b/src/main/java/com/chargebee/v4/services/PlanService.java index b946e082..3566cd75 100644 --- a/src/main/java/com/chargebee/v4/services/PlanService.java +++ b/src/main/java/com/chargebee/v4/services/PlanService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.plan.params.PlanCopyParams; @@ -19,9 +20,9 @@ import com.chargebee.v4.models.plan.params.PlanUpdateParams; -import com.chargebee.v4.models.plan.responses.UnarchiveForPlanResponse; +import com.chargebee.v4.models.plan.responses.PlanUnarchiveResponse; -import com.chargebee.v4.models.plan.responses.DeletePlanResponse; +import com.chargebee.v4.models.plan.responses.PlanDeleteResponse; import com.chargebee.v4.models.plan.responses.PlanCopyResponse; @@ -67,127 +68,128 @@ public PlanService withOptions(RequestOptions options) { // === Operations === - /** unarchiveForPlan a plan (executes immediately) - returns raw Response. */ - Response unarchiveForPlanRaw(String planId) throws Exception { + /** unarchive a plan (executes immediately) - returns raw Response. */ + Response unarchiveRaw(String planId) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}/unarchive", "plan-id", planId); return post(path, null); } - public UnarchiveForPlanResponse unarchiveForPlan(String planId) throws Exception { - Response response = unarchiveForPlanRaw(planId); - return UnarchiveForPlanResponse.fromJson(response.getBodyAsString(), response); + public PlanUnarchiveResponse unarchive(String planId) throws ChargebeeException { + Response response = unarchiveRaw(planId); + return PlanUnarchiveResponse.fromJson(response.getBodyAsString(), response); } - /** deletePlan a plan (executes immediately) - returns raw Response. */ - Response deletePlanRaw(String planId) throws Exception { + /** delete a plan (executes immediately) - returns raw Response. */ + Response deleteRaw(String planId) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}/delete", "plan-id", planId); return post(path, null); } - public DeletePlanResponse deletePlan(String planId) throws Exception { - Response response = deletePlanRaw(planId); - return DeletePlanResponse.fromJson(response.getBodyAsString(), response); + public PlanDeleteResponse delete(String planId) throws ChargebeeException { + Response response = deleteRaw(planId); + return PlanDeleteResponse.fromJson(response.getBodyAsString(), response); } /** copy a plan using immutable params (executes immediately) - returns raw Response. */ - Response copyRaw(PlanCopyParams params) throws Exception { + Response copyRaw(PlanCopyParams params) throws ChargebeeException { return post("/plans/copy", params != null ? params.toFormData() : null); } /** copy a plan using raw JSON payload (executes immediately) - returns raw Response. */ - Response copyRaw(String jsonPayload) throws Exception { + Response copyRaw(String jsonPayload) throws ChargebeeException { return postJson("/plans/copy", jsonPayload); } - public PlanCopyResponse copy(PlanCopyParams params) throws Exception { + public PlanCopyResponse copy(PlanCopyParams params) throws ChargebeeException { Response response = copyRaw(params); return PlanCopyResponse.fromJson(response.getBodyAsString(), response); } /** list a plan using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(PlanListParams params) throws Exception { + Response listRaw(PlanListParams params) throws ChargebeeException { return get("/plans", params != null ? params.toQueryParams() : null); } /** list a plan without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/plans", null); } /** list a plan using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public PlanListResponse list(PlanListParams params) throws Exception { + public PlanListResponse list(PlanListParams params) throws ChargebeeException { Response response = listRaw(params); return PlanListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public PlanListResponse list() throws Exception { + public PlanListResponse list() throws ChargebeeException { Response response = listRaw(); return PlanListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a plan using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(PlanCreateParams params) throws Exception { + Response createRaw(PlanCreateParams params) throws ChargebeeException { return post("/plans", params != null ? params.toFormData() : null); } /** create a plan using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/plans", jsonPayload); } - public PlanCreateResponse create(PlanCreateParams params) throws Exception { + public PlanCreateResponse create(PlanCreateParams params) throws ChargebeeException { Response response = createRaw(params); return PlanCreateResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a plan (executes immediately) - returns raw Response. */ - Response retrieveRaw(String planId) throws Exception { + Response retrieveRaw(String planId) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); return get(path, null); } - public PlanRetrieveResponse retrieve(String planId) throws Exception { + public PlanRetrieveResponse retrieve(String planId) throws ChargebeeException { Response response = retrieveRaw(planId); return PlanRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a plan (executes immediately) - returns raw Response. */ - Response updateRaw(String planId) throws Exception { + Response updateRaw(String planId) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); return post(path, null); } /** update a plan using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String planId, PlanUpdateParams params) throws Exception { + Response updateRaw(String planId, PlanUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); return post(path, params.toFormData()); } /** update a plan using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String planId, String jsonPayload) throws Exception { + Response updateRaw(String planId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); return postJson(path, jsonPayload); } - public PlanUpdateResponse update(String planId, PlanUpdateParams params) throws Exception { + public PlanUpdateResponse update(String planId, PlanUpdateParams params) + throws ChargebeeException { Response response = updateRaw(planId, params); return PlanUpdateResponse.fromJson(response.getBodyAsString(), response); } diff --git a/src/main/java/com/chargebee/v4/services/PortalSessionService.java b/src/main/java/com/chargebee/v4/services/PortalSessionService.java index 458d9248..9e928f65 100644 --- a/src/main/java/com/chargebee/v4/services/PortalSessionService.java +++ b/src/main/java/com/chargebee/v4/services/PortalSessionService.java @@ -9,17 +9,18 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.portalSession.params.PortalSessionCreateParams; -import com.chargebee.v4.models.portalSession.params.ActivateForPortalSessionParams; +import com.chargebee.v4.models.portalSession.params.PortalSessionActivateParams; import com.chargebee.v4.models.portalSession.responses.PortalSessionCreateResponse; -import com.chargebee.v4.models.portalSession.responses.ActivateForPortalSessionResponse; +import com.chargebee.v4.models.portalSession.responses.PortalSessionActivateResponse; -import com.chargebee.v4.models.portalSession.responses.LogoutForPortalSessionResponse; +import com.chargebee.v4.models.portalSession.responses.PortalSessionLogoutResponse; import com.chargebee.v4.models.portalSession.responses.PortalSessionRetrieveResponse; @@ -61,7 +62,7 @@ public PortalSessionService withOptions(RequestOptions options) { /** * create a portalSession using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(PortalSessionCreateParams params) throws Exception { + Response createRaw(PortalSessionCreateParams params) throws ChargebeeException { return post("/portal_sessions", params != null ? params.toFormData() : null); } @@ -69,19 +70,20 @@ Response createRaw(PortalSessionCreateParams params) throws Exception { /** * create a portalSession using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/portal_sessions", jsonPayload); } - public PortalSessionCreateResponse create(PortalSessionCreateParams params) throws Exception { + public PortalSessionCreateResponse create(PortalSessionCreateParams params) + throws ChargebeeException { Response response = createRaw(params); return PortalSessionCreateResponse.fromJson(response.getBodyAsString(), response); } - /** activateForPortalSession a portalSession (executes immediately) - returns raw Response. */ - Response activateForPortalSessionRaw(String portalSessionId) throws Exception { + /** activate a portalSession (executes immediately) - returns raw Response. */ + Response activateRaw(String portalSessionId) throws ChargebeeException { String path = buildPathWithParams( "/portal_sessions/{portal-session-id}/activate", "portal-session-id", portalSessionId); @@ -90,11 +92,10 @@ Response activateForPortalSessionRaw(String portalSessionId) throws Exception { } /** - * activateForPortalSession a portalSession using immutable params (executes immediately) - - * returns raw Response. + * activate a portalSession using immutable params (executes immediately) - returns raw Response. */ - Response activateForPortalSessionRaw( - String portalSessionId, ActivateForPortalSessionParams params) throws Exception { + Response activateRaw(String portalSessionId, PortalSessionActivateParams params) + throws ChargebeeException { String path = buildPathWithParams( "/portal_sessions/{portal-session-id}/activate", "portal-session-id", portalSessionId); @@ -102,25 +103,23 @@ Response activateForPortalSessionRaw( } /** - * activateForPortalSession a portalSession using raw JSON payload (executes immediately) - - * returns raw Response. + * activate a portalSession using raw JSON payload (executes immediately) - returns raw Response. */ - Response activateForPortalSessionRaw(String portalSessionId, String jsonPayload) - throws Exception { + Response activateRaw(String portalSessionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/portal_sessions/{portal-session-id}/activate", "portal-session-id", portalSessionId); return postJson(path, jsonPayload); } - public ActivateForPortalSessionResponse activateForPortalSession( - String portalSessionId, ActivateForPortalSessionParams params) throws Exception { - Response response = activateForPortalSessionRaw(portalSessionId, params); - return ActivateForPortalSessionResponse.fromJson(response.getBodyAsString(), response); + public PortalSessionActivateResponse activate( + String portalSessionId, PortalSessionActivateParams params) throws ChargebeeException { + Response response = activateRaw(portalSessionId, params); + return PortalSessionActivateResponse.fromJson(response.getBodyAsString(), response); } - /** logoutForPortalSession a portalSession (executes immediately) - returns raw Response. */ - Response logoutForPortalSessionRaw(String portalSessionId) throws Exception { + /** logout a portalSession (executes immediately) - returns raw Response. */ + Response logoutRaw(String portalSessionId) throws ChargebeeException { String path = buildPathWithParams( "/portal_sessions/{portal-session-id}/logout", "portal-session-id", portalSessionId); @@ -128,14 +127,13 @@ Response logoutForPortalSessionRaw(String portalSessionId) throws Exception { return post(path, null); } - public LogoutForPortalSessionResponse logoutForPortalSession(String portalSessionId) - throws Exception { - Response response = logoutForPortalSessionRaw(portalSessionId); - return LogoutForPortalSessionResponse.fromJson(response.getBodyAsString(), response); + public PortalSessionLogoutResponse logout(String portalSessionId) throws ChargebeeException { + Response response = logoutRaw(portalSessionId); + return PortalSessionLogoutResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a portalSession (executes immediately) - returns raw Response. */ - Response retrieveRaw(String portalSessionId) throws Exception { + Response retrieveRaw(String portalSessionId) throws ChargebeeException { String path = buildPathWithParams( "/portal_sessions/{portal-session-id}", "portal-session-id", portalSessionId); @@ -143,7 +141,7 @@ Response retrieveRaw(String portalSessionId) throws Exception { return get(path, null); } - public PortalSessionRetrieveResponse retrieve(String portalSessionId) throws Exception { + public PortalSessionRetrieveResponse retrieve(String portalSessionId) throws ChargebeeException { Response response = retrieveRaw(portalSessionId); return PortalSessionRetrieveResponse.fromJson(response.getBodyAsString(), response); } diff --git a/src/main/java/com/chargebee/v4/services/PriceVariantService.java b/src/main/java/com/chargebee/v4/services/PriceVariantService.java index cfca053c..d1884b26 100644 --- a/src/main/java/com/chargebee/v4/services/PriceVariantService.java +++ b/src/main/java/com/chargebee/v4/services/PriceVariantService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.priceVariant.params.PriceVariantListParams; @@ -17,7 +18,7 @@ import com.chargebee.v4.models.priceVariant.params.PriceVariantUpdateParams; -import com.chargebee.v4.models.priceVariant.responses.DeletePriceVariantResponse; +import com.chargebee.v4.models.priceVariant.responses.PriceVariantDeleteResponse; import com.chargebee.v4.models.priceVariant.responses.PriceVariantListResponse; @@ -62,8 +63,8 @@ public PriceVariantService withOptions(RequestOptions options) { // === Operations === - /** deletePriceVariant a priceVariant (executes immediately) - returns raw Response. */ - Response deletePriceVariantRaw(String priceVariantId) throws Exception { + /** delete a priceVariant (executes immediately) - returns raw Response. */ + Response deleteRaw(String priceVariantId) throws ChargebeeException { String path = buildPathWithParams( "/price_variants/{price-variant-id}/delete", "price-variant-id", priceVariantId); @@ -71,60 +72,61 @@ Response deletePriceVariantRaw(String priceVariantId) throws Exception { return post(path, null); } - public DeletePriceVariantResponse deletePriceVariant(String priceVariantId) throws Exception { - Response response = deletePriceVariantRaw(priceVariantId); - return DeletePriceVariantResponse.fromJson(response.getBodyAsString(), response); + public PriceVariantDeleteResponse delete(String priceVariantId) throws ChargebeeException { + Response response = deleteRaw(priceVariantId); + return PriceVariantDeleteResponse.fromJson(response.getBodyAsString(), response); } /** list a priceVariant using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(PriceVariantListParams params) throws Exception { + Response listRaw(PriceVariantListParams params) throws ChargebeeException { return get("/price_variants", params != null ? params.toQueryParams() : null); } /** list a priceVariant without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/price_variants", null); } /** list a priceVariant using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public PriceVariantListResponse list(PriceVariantListParams params) throws Exception { + public PriceVariantListResponse list(PriceVariantListParams params) throws ChargebeeException { Response response = listRaw(params); return PriceVariantListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public PriceVariantListResponse list() throws Exception { + public PriceVariantListResponse list() throws ChargebeeException { Response response = listRaw(); return PriceVariantListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a priceVariant using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(PriceVariantCreateParams params) throws Exception { + Response createRaw(PriceVariantCreateParams params) throws ChargebeeException { return post("/price_variants", params != null ? params.toFormData() : null); } /** create a priceVariant using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/price_variants", jsonPayload); } - public PriceVariantCreateResponse create(PriceVariantCreateParams params) throws Exception { + public PriceVariantCreateResponse create(PriceVariantCreateParams params) + throws ChargebeeException { Response response = createRaw(params); return PriceVariantCreateResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a priceVariant (executes immediately) - returns raw Response. */ - Response retrieveRaw(String priceVariantId) throws Exception { + Response retrieveRaw(String priceVariantId) throws ChargebeeException { String path = buildPathWithParams( "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); @@ -132,13 +134,13 @@ Response retrieveRaw(String priceVariantId) throws Exception { return get(path, null); } - public PriceVariantRetrieveResponse retrieve(String priceVariantId) throws Exception { + public PriceVariantRetrieveResponse retrieve(String priceVariantId) throws ChargebeeException { Response response = retrieveRaw(priceVariantId); return PriceVariantRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a priceVariant (executes immediately) - returns raw Response. */ - Response updateRaw(String priceVariantId) throws Exception { + Response updateRaw(String priceVariantId) throws ChargebeeException { String path = buildPathWithParams( "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); @@ -147,7 +149,8 @@ Response updateRaw(String priceVariantId) throws Exception { } /** update a priceVariant using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String priceVariantId, PriceVariantUpdateParams params) throws Exception { + Response updateRaw(String priceVariantId, PriceVariantUpdateParams params) + throws ChargebeeException { String path = buildPathWithParams( "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); @@ -155,7 +158,7 @@ Response updateRaw(String priceVariantId, PriceVariantUpdateParams params) throw } /** update a priceVariant using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String priceVariantId, String jsonPayload) throws Exception { + Response updateRaw(String priceVariantId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); @@ -163,7 +166,7 @@ Response updateRaw(String priceVariantId, String jsonPayload) throws Exception { } public PriceVariantUpdateResponse update(String priceVariantId, PriceVariantUpdateParams params) - throws Exception { + throws ChargebeeException { Response response = updateRaw(priceVariantId, params); return PriceVariantUpdateResponse.fromJson(response.getBodyAsString(), response); } diff --git a/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java b/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java index 885e342d..763de0cf 100644 --- a/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java +++ b/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.pricingPageSession.params.PricingPageSessionCreateForExistingSubscriptionParams; @@ -59,7 +60,7 @@ public PricingPageSessionService withOptions(RequestOptions options) { * immediately) - returns raw Response. */ Response createForExistingSubscriptionRaw( - PricingPageSessionCreateForExistingSubscriptionParams params) throws Exception { + PricingPageSessionCreateForExistingSubscriptionParams params) throws ChargebeeException { return post( "/pricing_page_sessions/create_for_existing_subscription", @@ -70,13 +71,13 @@ Response createForExistingSubscriptionRaw( * createForExistingSubscription a pricingPageSession using raw JSON payload (executes * immediately) - returns raw Response. */ - Response createForExistingSubscriptionRaw(String jsonPayload) throws Exception { + Response createForExistingSubscriptionRaw(String jsonPayload) throws ChargebeeException { return postJson("/pricing_page_sessions/create_for_existing_subscription", jsonPayload); } public PricingPageSessionCreateForExistingSubscriptionResponse createForExistingSubscription( - PricingPageSessionCreateForExistingSubscriptionParams params) throws Exception { + PricingPageSessionCreateForExistingSubscriptionParams params) throws ChargebeeException { Response response = createForExistingSubscriptionRaw(params); return PricingPageSessionCreateForExistingSubscriptionResponse.fromJson( @@ -88,7 +89,7 @@ public PricingPageSessionCreateForExistingSubscriptionResponse createForExisting * returns raw Response. */ Response createForNewSubscriptionRaw(PricingPageSessionCreateForNewSubscriptionParams params) - throws Exception { + throws ChargebeeException { return post( "/pricing_page_sessions/create_for_new_subscription", @@ -99,13 +100,13 @@ Response createForNewSubscriptionRaw(PricingPageSessionCreateForNewSubscriptionP * createForNewSubscription a pricingPageSession using raw JSON payload (executes immediately) - * returns raw Response. */ - Response createForNewSubscriptionRaw(String jsonPayload) throws Exception { + Response createForNewSubscriptionRaw(String jsonPayload) throws ChargebeeException { return postJson("/pricing_page_sessions/create_for_new_subscription", jsonPayload); } public PricingPageSessionCreateForNewSubscriptionResponse createForNewSubscription( - PricingPageSessionCreateForNewSubscriptionParams params) throws Exception { + PricingPageSessionCreateForNewSubscriptionParams params) throws ChargebeeException { Response response = createForNewSubscriptionRaw(params); return PricingPageSessionCreateForNewSubscriptionResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/ProductService.java b/src/main/java/com/chargebee/v4/services/ProductService.java index 5c0af25d..1e6e0270 100644 --- a/src/main/java/com/chargebee/v4/services/ProductService.java +++ b/src/main/java/com/chargebee/v4/services/ProductService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.product.params.ProductUpdateParams; -import com.chargebee.v4.models.product.params.UpdateOptionsForProductParams; +import com.chargebee.v4.models.product.params.ProductUpdateOptionsParams; import com.chargebee.v4.models.product.params.ProductListParams; @@ -23,9 +24,9 @@ import com.chargebee.v4.models.product.responses.ProductUpdateResponse; -import com.chargebee.v4.models.product.responses.DeleteProductResponse; +import com.chargebee.v4.models.product.responses.ProductDeleteResponse; -import com.chargebee.v4.models.product.responses.UpdateOptionsForProductResponse; +import com.chargebee.v4.models.product.responses.ProductUpdateOptionsResponse; import com.chargebee.v4.models.product.responses.ProductListResponse; @@ -66,56 +67,56 @@ public ProductService withOptions(RequestOptions options) { // === Operations === /** retrieve a product (executes immediately) - returns raw Response. */ - Response retrieveRaw(String productId) throws Exception { + Response retrieveRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); return get(path, null); } - public ProductRetrieveResponse retrieve(String productId) throws Exception { + public ProductRetrieveResponse retrieve(String productId) throws ChargebeeException { Response response = retrieveRaw(productId); return ProductRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a product (executes immediately) - returns raw Response. */ - Response updateRaw(String productId) throws Exception { + Response updateRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); return post(path, null); } /** update a product using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String productId, ProductUpdateParams params) throws Exception { + Response updateRaw(String productId, ProductUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); return post(path, params.toFormData()); } /** update a product using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String productId, String jsonPayload) throws Exception { + Response updateRaw(String productId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); return postJson(path, jsonPayload); } public ProductUpdateResponse update(String productId, ProductUpdateParams params) - throws Exception { + throws ChargebeeException { Response response = updateRaw(productId, params); return ProductUpdateResponse.fromJson(response.getBodyAsString(), response); } - /** deleteProduct a product (executes immediately) - returns raw Response. */ - Response deleteProductRaw(String productId) throws Exception { + /** delete a product (executes immediately) - returns raw Response. */ + Response deleteRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/delete", "product-id", productId); return post(path, null); } - public DeleteProductResponse deleteProduct(String productId) throws Exception { - Response response = deleteProductRaw(productId); - return DeleteProductResponse.fromJson(response.getBodyAsString(), response); + public ProductDeleteResponse delete(String productId) throws ChargebeeException { + Response response = deleteRaw(productId); + return ProductDeleteResponse.fromJson(response.getBodyAsString(), response); } - /** updateOptionsForProduct a product (executes immediately) - returns raw Response. */ - Response updateOptionsForProductRaw(String productId) throws Exception { + /** updateOptions a product (executes immediately) - returns raw Response. */ + Response updateOptionsRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/update_options", "product-id", productId); @@ -123,74 +124,72 @@ Response updateOptionsForProductRaw(String productId) throws Exception { } /** - * updateOptionsForProduct a product using immutable params (executes immediately) - returns raw - * Response. + * updateOptions a product using immutable params (executes immediately) - returns raw Response. */ - Response updateOptionsForProductRaw(String productId, UpdateOptionsForProductParams params) - throws Exception { + Response updateOptionsRaw(String productId, ProductUpdateOptionsParams params) + throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/update_options", "product-id", productId); return post(path, params.toFormData()); } /** - * updateOptionsForProduct a product using raw JSON payload (executes immediately) - returns raw - * Response. + * updateOptions a product using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateOptionsForProductRaw(String productId, String jsonPayload) throws Exception { + Response updateOptionsRaw(String productId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/update_options", "product-id", productId); return postJson(path, jsonPayload); } - public UpdateOptionsForProductResponse updateOptionsForProduct( - String productId, UpdateOptionsForProductParams params) throws Exception { - Response response = updateOptionsForProductRaw(productId, params); - return UpdateOptionsForProductResponse.fromJson(response.getBodyAsString(), response); + public ProductUpdateOptionsResponse updateOptions( + String productId, ProductUpdateOptionsParams params) throws ChargebeeException { + Response response = updateOptionsRaw(productId, params); + return ProductUpdateOptionsResponse.fromJson(response.getBodyAsString(), response); } /** list a product using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(ProductListParams params) throws Exception { + Response listRaw(ProductListParams params) throws ChargebeeException { return get("/products", params != null ? params.toQueryParams() : null); } /** list a product without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/products", null); } /** list a product using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public ProductListResponse list(ProductListParams params) throws Exception { + public ProductListResponse list(ProductListParams params) throws ChargebeeException { Response response = listRaw(params); return ProductListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public ProductListResponse list() throws Exception { + public ProductListResponse list() throws ChargebeeException { Response response = listRaw(); return ProductListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a product using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(ProductCreateParams params) throws Exception { + Response createRaw(ProductCreateParams params) throws ChargebeeException { return post("/products", params != null ? params.toFormData() : null); } /** create a product using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/products", jsonPayload); } - public ProductCreateResponse create(ProductCreateParams params) throws Exception { + public ProductCreateResponse create(ProductCreateParams params) throws ChargebeeException { Response response = createRaw(params); return ProductCreateResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java b/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java index 6e8066c4..85626f87 100644 --- a/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java +++ b/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.promotionalCredit.params.PromotionalCreditListParams; @@ -65,7 +66,7 @@ public PromotionalCreditService withOptions(RequestOptions options) { // === Operations === /** retrieve a promotionalCredit (executes immediately) - returns raw Response. */ - Response retrieveRaw(String accountCreditId) throws Exception { + Response retrieveRaw(String accountCreditId) throws ChargebeeException { String path = buildPathWithParams( "/promotional_credits/{account-credit-id}", "account-credit-id", accountCreditId); @@ -73,7 +74,8 @@ Response retrieveRaw(String accountCreditId) throws Exception { return get(path, null); } - public PromotionalCreditRetrieveResponse retrieve(String accountCreditId) throws Exception { + public PromotionalCreditRetrieveResponse retrieve(String accountCreditId) + throws ChargebeeException { Response response = retrieveRaw(accountCreditId); return PromotionalCreditRetrieveResponse.fromJson(response.getBodyAsString(), response); } @@ -81,13 +83,13 @@ public PromotionalCreditRetrieveResponse retrieve(String accountCreditId) throws /** * list a promotionalCredit using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(PromotionalCreditListParams params) throws Exception { + Response listRaw(PromotionalCreditListParams params) throws ChargebeeException { return get("/promotional_credits", params != null ? params.toQueryParams() : null); } /** list a promotionalCredit without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/promotional_credits", null); } @@ -95,19 +97,20 @@ Response listRaw() throws Exception { /** * list a promotionalCredit using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public PromotionalCreditListResponse list(PromotionalCreditListParams params) throws Exception { + public PromotionalCreditListResponse list(PromotionalCreditListParams params) + throws ChargebeeException { Response response = listRaw(params); return PromotionalCreditListResponse.fromJson( response.getBodyAsString(), this, params, response); } - public PromotionalCreditListResponse list() throws Exception { + public PromotionalCreditListResponse list() throws ChargebeeException { Response response = listRaw(); return PromotionalCreditListResponse.fromJson(response.getBodyAsString(), this, null, response); } @@ -116,7 +119,7 @@ public PromotionalCreditListResponse list() throws Exception { * deduct a promotionalCredit using immutable params (executes immediately) - returns raw * Response. */ - Response deductRaw(PromotionalCreditDeductParams params) throws Exception { + Response deductRaw(PromotionalCreditDeductParams params) throws ChargebeeException { return post("/promotional_credits/deduct", params != null ? params.toFormData() : null); } @@ -125,13 +128,13 @@ Response deductRaw(PromotionalCreditDeductParams params) throws Exception { * deduct a promotionalCredit using raw JSON payload (executes immediately) - returns raw * Response. */ - Response deductRaw(String jsonPayload) throws Exception { + Response deductRaw(String jsonPayload) throws ChargebeeException { return postJson("/promotional_credits/deduct", jsonPayload); } public PromotionalCreditDeductResponse deduct(PromotionalCreditDeductParams params) - throws Exception { + throws ChargebeeException { Response response = deductRaw(params); return PromotionalCreditDeductResponse.fromJson(response.getBodyAsString(), response); @@ -140,7 +143,7 @@ public PromotionalCreditDeductResponse deduct(PromotionalCreditDeductParams para /** * set a promotionalCredit using immutable params (executes immediately) - returns raw Response. */ - Response setRaw(PromotionalCreditSetParams params) throws Exception { + Response setRaw(PromotionalCreditSetParams params) throws ChargebeeException { return post("/promotional_credits/set", params != null ? params.toFormData() : null); } @@ -148,12 +151,13 @@ Response setRaw(PromotionalCreditSetParams params) throws Exception { /** * set a promotionalCredit using raw JSON payload (executes immediately) - returns raw Response. */ - Response setRaw(String jsonPayload) throws Exception { + Response setRaw(String jsonPayload) throws ChargebeeException { return postJson("/promotional_credits/set", jsonPayload); } - public PromotionalCreditSetResponse set(PromotionalCreditSetParams params) throws Exception { + public PromotionalCreditSetResponse set(PromotionalCreditSetParams params) + throws ChargebeeException { Response response = setRaw(params); return PromotionalCreditSetResponse.fromJson(response.getBodyAsString(), response); @@ -162,7 +166,7 @@ public PromotionalCreditSetResponse set(PromotionalCreditSetParams params) throw /** * add a promotionalCredit using immutable params (executes immediately) - returns raw Response. */ - Response addRaw(PromotionalCreditAddParams params) throws Exception { + Response addRaw(PromotionalCreditAddParams params) throws ChargebeeException { return post("/promotional_credits/add", params != null ? params.toFormData() : null); } @@ -170,12 +174,13 @@ Response addRaw(PromotionalCreditAddParams params) throws Exception { /** * add a promotionalCredit using raw JSON payload (executes immediately) - returns raw Response. */ - Response addRaw(String jsonPayload) throws Exception { + Response addRaw(String jsonPayload) throws ChargebeeException { return postJson("/promotional_credits/add", jsonPayload); } - public PromotionalCreditAddResponse add(PromotionalCreditAddParams params) throws Exception { + public PromotionalCreditAddResponse add(PromotionalCreditAddParams params) + throws ChargebeeException { Response response = addRaw(params); return PromotionalCreditAddResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/PurchaseService.java b/src/main/java/com/chargebee/v4/services/PurchaseService.java index c76443a5..c40269f4 100644 --- a/src/main/java/com/chargebee/v4/services/PurchaseService.java +++ b/src/main/java/com/chargebee/v4/services/PurchaseService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.purchase.params.PurchaseCreateParams; @@ -54,36 +55,37 @@ public PurchaseService withOptions(RequestOptions options) { // === Operations === /** create a purchase using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(PurchaseCreateParams params) throws Exception { + Response createRaw(PurchaseCreateParams params) throws ChargebeeException { return post("/purchases", params != null ? params.toFormData() : null); } /** create a purchase using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/purchases", jsonPayload); } - public PurchaseCreateResponse create(PurchaseCreateParams params) throws Exception { + public PurchaseCreateResponse create(PurchaseCreateParams params) throws ChargebeeException { Response response = createRaw(params); return PurchaseCreateResponse.fromJson(response.getBodyAsString(), response); } /** estimate a purchase using immutable params (executes immediately) - returns raw Response. */ - Response estimateRaw(PurchaseEstimateParams params) throws Exception { + Response estimateRaw(PurchaseEstimateParams params) throws ChargebeeException { return post("/purchases/estimate", params != null ? params.toFormData() : null); } /** estimate a purchase using raw JSON payload (executes immediately) - returns raw Response. */ - Response estimateRaw(String jsonPayload) throws Exception { + Response estimateRaw(String jsonPayload) throws ChargebeeException { return postJson("/purchases/estimate", jsonPayload); } - public PurchaseEstimateResponse estimate(PurchaseEstimateParams params) throws Exception { + public PurchaseEstimateResponse estimate(PurchaseEstimateParams params) + throws ChargebeeException { Response response = estimateRaw(params); return PurchaseEstimateResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/QuoteService.java b/src/main/java/com/chargebee/v4/services/QuoteService.java index 13e66b2b..55676ec8 100644 --- a/src/main/java/com/chargebee/v4/services/QuoteService.java +++ b/src/main/java/com/chargebee/v4/services/QuoteService.java @@ -9,85 +9,86 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.quote.params.CreateSubscriptionQuoteForItemsForCustomerParams; +import com.chargebee.v4.models.quote.params.CreateSubscriptionItemsForCustomerQuoteParams; -import com.chargebee.v4.models.quote.params.EditCreateSubscriptionQuoteForItemsForQuoteParams; +import com.chargebee.v4.models.quote.params.EditCreateSubscriptionCustomerQuoteForItemsParams; -import com.chargebee.v4.models.quote.params.UpdateStatusForQuoteParams; +import com.chargebee.v4.models.quote.params.QuoteUpdateStatusParams; import com.chargebee.v4.models.quote.params.UpdateSubscriptionQuoteForItemsParams; import com.chargebee.v4.models.quote.params.QuoteLineGroupsForQuoteParams; -import com.chargebee.v4.models.quote.params.ExtendExpiryDateForQuoteParams; +import com.chargebee.v4.models.quote.params.QuoteExtendExpiryDateParams; -import com.chargebee.v4.models.quote.params.EditForChargeItemsAndChargesForQuoteParams; +import com.chargebee.v4.models.quote.params.QuoteEditForChargeItemsAndChargesParams; -import com.chargebee.v4.models.quote.params.EditUpdateSubscriptionQuoteForItemsForQuoteParams; +import com.chargebee.v4.models.quote.params.EditUpdateSubscriptionQuoteForItemsParams; import com.chargebee.v4.models.quote.params.QuoteListParams; -import com.chargebee.v4.models.quote.params.PdfForQuoteParams; +import com.chargebee.v4.models.quote.params.QuotePdfParams; -import com.chargebee.v4.models.quote.params.ConvertForQuoteParams; +import com.chargebee.v4.models.quote.params.QuoteConvertParams; import com.chargebee.v4.models.quote.params.QuoteCreateForChargeItemsAndChargesParams; -import com.chargebee.v4.models.quote.params.DeleteQuoteParams; +import com.chargebee.v4.models.quote.params.QuoteDeleteParams; -import com.chargebee.v4.models.quote.params.EditOneTimeQuoteForQuoteParams; +import com.chargebee.v4.models.quote.params.EditOneTimeQuoteParams; import com.chargebee.v4.models.quote.params.UpdateSubscriptionQuoteParams; import com.chargebee.v4.models.quote.params.QuoteCreateForOnetimeChargesParams; -import com.chargebee.v4.models.quote.params.CreateSubscriptionQuoteForCustomerParams; +import com.chargebee.v4.models.quote.params.CreateSubscriptionForCustomerQuoteParams; -import com.chargebee.v4.models.quote.params.EditUpdateSubscriptionQuoteForQuoteParams; +import com.chargebee.v4.models.quote.params.EditUpdateSubscriptionQuoteParams; -import com.chargebee.v4.models.quote.params.EditCreateSubscriptionQuoteForQuoteParams; +import com.chargebee.v4.models.quote.params.EditCreateSubscriptionForCustomerQuoteParams; -import com.chargebee.v4.models.quote.responses.CreateSubscriptionQuoteForItemsForCustomerResponse; +import com.chargebee.v4.models.quote.responses.CreateSubscriptionItemsForCustomerQuoteResponse; import com.chargebee.v4.models.quote.responses.QuoteRetrieveResponse; -import com.chargebee.v4.models.quote.responses.EditCreateSubscriptionQuoteForItemsForQuoteResponse; +import com.chargebee.v4.models.quote.responses.EditCreateSubscriptionCustomerQuoteForItemsResponse; -import com.chargebee.v4.models.quote.responses.UpdateStatusForQuoteResponse; +import com.chargebee.v4.models.quote.responses.QuoteUpdateStatusResponse; import com.chargebee.v4.models.quote.responses.UpdateSubscriptionQuoteForItemsResponse; import com.chargebee.v4.models.quote.responses.QuoteLineGroupsForQuoteResponse; -import com.chargebee.v4.models.quote.responses.ExtendExpiryDateForQuoteResponse; +import com.chargebee.v4.models.quote.responses.QuoteExtendExpiryDateResponse; -import com.chargebee.v4.models.quote.responses.EditForChargeItemsAndChargesForQuoteResponse; +import com.chargebee.v4.models.quote.responses.QuoteEditForChargeItemsAndChargesResponse; -import com.chargebee.v4.models.quote.responses.EditUpdateSubscriptionQuoteForItemsForQuoteResponse; +import com.chargebee.v4.models.quote.responses.EditUpdateSubscriptionQuoteForItemsResponse; import com.chargebee.v4.models.quote.responses.QuoteListResponse; -import com.chargebee.v4.models.quote.responses.PdfForQuoteResponse; +import com.chargebee.v4.models.quote.responses.QuotePdfResponse; -import com.chargebee.v4.models.quote.responses.ConvertForQuoteResponse; +import com.chargebee.v4.models.quote.responses.QuoteConvertResponse; import com.chargebee.v4.models.quote.responses.QuoteCreateForChargeItemsAndChargesResponse; -import com.chargebee.v4.models.quote.responses.DeleteQuoteResponse; +import com.chargebee.v4.models.quote.responses.QuoteDeleteResponse; -import com.chargebee.v4.models.quote.responses.EditOneTimeQuoteForQuoteResponse; +import com.chargebee.v4.models.quote.responses.EditOneTimeQuoteResponse; import com.chargebee.v4.models.quote.responses.UpdateSubscriptionQuoteResponse; import com.chargebee.v4.models.quote.responses.QuoteCreateForOnetimeChargesResponse; -import com.chargebee.v4.models.quote.responses.CreateSubscriptionQuoteForCustomerResponse; +import com.chargebee.v4.models.quote.responses.CreateSubscriptionForCustomerQuoteResponse; -import com.chargebee.v4.models.quote.responses.EditUpdateSubscriptionQuoteForQuoteResponse; +import com.chargebee.v4.models.quote.responses.EditUpdateSubscriptionQuoteResponse; -import com.chargebee.v4.models.quote.responses.EditCreateSubscriptionQuoteForQuoteResponse; +import com.chargebee.v4.models.quote.responses.EditCreateSubscriptionForCustomerQuoteResponse; public final class QuoteService extends BaseService { @@ -124,10 +125,9 @@ public QuoteService withOptions(RequestOptions options) { // === Operations === /** - * createSubscriptionQuoteForItemsForCustomer a quote (executes immediately) - returns raw - * Response. + * createSubscriptionItemsForCustomerQuote a quote (executes immediately) - returns raw Response. */ - Response createSubscriptionQuoteForItemsForCustomerRaw(String customerId) throws Exception { + Response createSubscriptionItemsForCustomerQuoteRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_quote_for_items", @@ -138,11 +138,12 @@ Response createSubscriptionQuoteForItemsForCustomerRaw(String customerId) throws } /** - * createSubscriptionQuoteForItemsForCustomer a quote using immutable params (executes - * immediately) - returns raw Response. + * createSubscriptionItemsForCustomerQuote a quote using immutable params (executes immediately) - + * returns raw Response. */ - Response createSubscriptionQuoteForItemsForCustomerRaw( - String customerId, CreateSubscriptionQuoteForItemsForCustomerParams params) throws Exception { + Response createSubscriptionItemsForCustomerQuoteRaw( + String customerId, CreateSubscriptionItemsForCustomerQuoteParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_quote_for_items", @@ -152,11 +153,11 @@ Response createSubscriptionQuoteForItemsForCustomerRaw( } /** - * createSubscriptionQuoteForItemsForCustomer a quote using raw JSON payload (executes - * immediately) - returns raw Response. + * createSubscriptionItemsForCustomerQuote a quote using raw JSON payload (executes immediately) - + * returns raw Response. */ - Response createSubscriptionQuoteForItemsForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response createSubscriptionItemsForCustomerQuoteRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_quote_for_items", @@ -165,32 +166,32 @@ Response createSubscriptionQuoteForItemsForCustomerRaw(String customerId, String return postJson(path, jsonPayload); } - public CreateSubscriptionQuoteForItemsForCustomerResponse - createSubscriptionQuoteForItemsForCustomer( - String customerId, CreateSubscriptionQuoteForItemsForCustomerParams params) - throws Exception { - Response response = createSubscriptionQuoteForItemsForCustomerRaw(customerId, params); - return CreateSubscriptionQuoteForItemsForCustomerResponse.fromJson( + public CreateSubscriptionItemsForCustomerQuoteResponse createSubscriptionItemsForCustomerQuote( + String customerId, CreateSubscriptionItemsForCustomerQuoteParams params) + throws ChargebeeException { + Response response = createSubscriptionItemsForCustomerQuoteRaw(customerId, params); + return CreateSubscriptionItemsForCustomerQuoteResponse.fromJson( response.getBodyAsString(), response); } /** retrieve a quote (executes immediately) - returns raw Response. */ - Response retrieveRaw(String quoteId) throws Exception { + Response retrieveRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}", "quote-id", quoteId); return get(path, null); } - public QuoteRetrieveResponse retrieve(String quoteId) throws Exception { + public QuoteRetrieveResponse retrieve(String quoteId) throws ChargebeeException { Response response = retrieveRaw(quoteId); return QuoteRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** - * editCreateSubscriptionQuoteForItemsForQuote a quote (executes immediately) - returns raw + * editCreateSubscriptionCustomerQuoteForItems a quote (executes immediately) - returns raw * Response. */ - Response editCreateSubscriptionQuoteForItemsForQuoteRaw(String quoteId) throws Exception { + Response editCreateSubscriptionCustomerQuoteForItemsRaw(String quoteId) + throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote_for_items", "quote-id", quoteId); @@ -199,11 +200,12 @@ Response editCreateSubscriptionQuoteForItemsForQuoteRaw(String quoteId) throws E } /** - * editCreateSubscriptionQuoteForItemsForQuote a quote using immutable params (executes + * editCreateSubscriptionCustomerQuoteForItems a quote using immutable params (executes * immediately) - returns raw Response. */ - Response editCreateSubscriptionQuoteForItemsForQuoteRaw( - String quoteId, EditCreateSubscriptionQuoteForItemsForQuoteParams params) throws Exception { + Response editCreateSubscriptionCustomerQuoteForItemsRaw( + String quoteId, EditCreateSubscriptionCustomerQuoteForItemsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote_for_items", "quote-id", quoteId); @@ -211,56 +213,50 @@ Response editCreateSubscriptionQuoteForItemsForQuoteRaw( } /** - * editCreateSubscriptionQuoteForItemsForQuote a quote using raw JSON payload (executes + * editCreateSubscriptionCustomerQuoteForItems a quote using raw JSON payload (executes * immediately) - returns raw Response. */ - Response editCreateSubscriptionQuoteForItemsForQuoteRaw(String quoteId, String jsonPayload) - throws Exception { + Response editCreateSubscriptionCustomerQuoteForItemsRaw(String quoteId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote_for_items", "quote-id", quoteId); return postJson(path, jsonPayload); } - public EditCreateSubscriptionQuoteForItemsForQuoteResponse - editCreateSubscriptionQuoteForItemsForQuote( - String quoteId, EditCreateSubscriptionQuoteForItemsForQuoteParams params) - throws Exception { - Response response = editCreateSubscriptionQuoteForItemsForQuoteRaw(quoteId, params); - return EditCreateSubscriptionQuoteForItemsForQuoteResponse.fromJson( + public EditCreateSubscriptionCustomerQuoteForItemsResponse + editCreateSubscriptionCustomerQuoteForItems( + String quoteId, EditCreateSubscriptionCustomerQuoteForItemsParams params) + throws ChargebeeException { + Response response = editCreateSubscriptionCustomerQuoteForItemsRaw(quoteId, params); + return EditCreateSubscriptionCustomerQuoteForItemsResponse.fromJson( response.getBodyAsString(), response); } - /** updateStatusForQuote a quote (executes immediately) - returns raw Response. */ - Response updateStatusForQuoteRaw(String quoteId) throws Exception { + /** updateStatus a quote (executes immediately) - returns raw Response. */ + Response updateStatusRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/update_status", "quote-id", quoteId); return post(path, null); } - /** - * updateStatusForQuote a quote using immutable params (executes immediately) - returns raw - * Response. - */ - Response updateStatusForQuoteRaw(String quoteId, UpdateStatusForQuoteParams params) - throws Exception { + /** updateStatus a quote using immutable params (executes immediately) - returns raw Response. */ + Response updateStatusRaw(String quoteId, QuoteUpdateStatusParams params) + throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/update_status", "quote-id", quoteId); return post(path, params.toFormData()); } - /** - * updateStatusForQuote a quote using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response updateStatusForQuoteRaw(String quoteId, String jsonPayload) throws Exception { + /** updateStatus a quote using raw JSON payload (executes immediately) - returns raw Response. */ + Response updateStatusRaw(String quoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/update_status", "quote-id", quoteId); return postJson(path, jsonPayload); } - public UpdateStatusForQuoteResponse updateStatusForQuote( - String quoteId, UpdateStatusForQuoteParams params) throws Exception { - Response response = updateStatusForQuoteRaw(quoteId, params); - return UpdateStatusForQuoteResponse.fromJson(response.getBodyAsString(), response); + public QuoteUpdateStatusResponse updateStatus(String quoteId, QuoteUpdateStatusParams params) + throws ChargebeeException { + Response response = updateStatusRaw(quoteId, params); + return QuoteUpdateStatusResponse.fromJson(response.getBodyAsString(), response); } /** @@ -268,7 +264,7 @@ public UpdateStatusForQuoteResponse updateStatusForQuote( * raw Response. */ Response updateSubscriptionQuoteForItemsRaw(UpdateSubscriptionQuoteForItemsParams params) - throws Exception { + throws ChargebeeException { return post( "/quotes/update_subscription_quote_for_items", params != null ? params.toFormData() : null); @@ -278,13 +274,13 @@ Response updateSubscriptionQuoteForItemsRaw(UpdateSubscriptionQuoteForItemsParam * updateSubscriptionQuoteForItems a quote using raw JSON payload (executes immediately) - returns * raw Response. */ - Response updateSubscriptionQuoteForItemsRaw(String jsonPayload) throws Exception { + Response updateSubscriptionQuoteForItemsRaw(String jsonPayload) throws ChargebeeException { return postJson("/quotes/update_subscription_quote_for_items", jsonPayload); } public UpdateSubscriptionQuoteForItemsResponse updateSubscriptionQuoteForItems( - UpdateSubscriptionQuoteForItemsParams params) throws Exception { + UpdateSubscriptionQuoteForItemsParams params) throws ChargebeeException { Response response = updateSubscriptionQuoteForItemsRaw(params); return UpdateSubscriptionQuoteForItemsResponse.fromJson(response.getBodyAsString(), response); @@ -295,7 +291,7 @@ public UpdateSubscriptionQuoteForItemsResponse updateSubscriptionQuoteForItems( * Response. */ Response quoteLineGroupsForQuoteRaw(String quoteId, QuoteLineGroupsForQuoteParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/quote_line_groups", "quote-id", quoteId); return get(path, params != null ? params.toQueryParams() : null); } @@ -303,7 +299,7 @@ Response quoteLineGroupsForQuoteRaw(String quoteId, QuoteLineGroupsForQuoteParam /** * quoteLineGroupsForQuote a quote without params (executes immediately) - returns raw Response. */ - Response quoteLineGroupsForQuoteRaw(String quoteId) throws Exception { + Response quoteLineGroupsForQuoteRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/quote_line_groups", "quote-id", quoteId); return get(path, null); } @@ -312,58 +308,58 @@ Response quoteLineGroupsForQuoteRaw(String quoteId) throws Exception { * quoteLineGroupsForQuote a quote using raw JSON payload (executes immediately) - returns raw * Response. */ - Response quoteLineGroupsForQuoteRaw(String quoteId, String jsonPayload) throws Exception { + Response quoteLineGroupsForQuoteRaw(String quoteId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/quote_line_groups", "quote-id", quoteId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public QuoteLineGroupsForQuoteResponse quoteLineGroupsForQuote( - String quoteId, QuoteLineGroupsForQuoteParams params) throws Exception { + String quoteId, QuoteLineGroupsForQuoteParams params) throws ChargebeeException { Response response = quoteLineGroupsForQuoteRaw(quoteId, params); return QuoteLineGroupsForQuoteResponse.fromJson( response.getBodyAsString(), this, params, quoteId, response); } - public QuoteLineGroupsForQuoteResponse quoteLineGroupsForQuote(String quoteId) throws Exception { + public QuoteLineGroupsForQuoteResponse quoteLineGroupsForQuote(String quoteId) + throws ChargebeeException { Response response = quoteLineGroupsForQuoteRaw(quoteId); return QuoteLineGroupsForQuoteResponse.fromJson( response.getBodyAsString(), this, null, quoteId, response); } - /** extendExpiryDateForQuote a quote (executes immediately) - returns raw Response. */ - Response extendExpiryDateForQuoteRaw(String quoteId) throws Exception { + /** extendExpiryDate a quote (executes immediately) - returns raw Response. */ + Response extendExpiryDateRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/extend_expiry_date", "quote-id", quoteId); return post(path, null); } /** - * extendExpiryDateForQuote a quote using immutable params (executes immediately) - returns raw - * Response. + * extendExpiryDate a quote using immutable params (executes immediately) - returns raw Response. */ - Response extendExpiryDateForQuoteRaw(String quoteId, ExtendExpiryDateForQuoteParams params) - throws Exception { + Response extendExpiryDateRaw(String quoteId, QuoteExtendExpiryDateParams params) + throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/extend_expiry_date", "quote-id", quoteId); return post(path, params.toFormData()); } /** - * extendExpiryDateForQuote a quote using raw JSON payload (executes immediately) - returns raw - * Response. + * extendExpiryDate a quote using raw JSON payload (executes immediately) - returns raw Response. */ - Response extendExpiryDateForQuoteRaw(String quoteId, String jsonPayload) throws Exception { + Response extendExpiryDateRaw(String quoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/extend_expiry_date", "quote-id", quoteId); return postJson(path, jsonPayload); } - public ExtendExpiryDateForQuoteResponse extendExpiryDateForQuote( - String quoteId, ExtendExpiryDateForQuoteParams params) throws Exception { - Response response = extendExpiryDateForQuoteRaw(quoteId, params); - return ExtendExpiryDateForQuoteResponse.fromJson(response.getBodyAsString(), response); + public QuoteExtendExpiryDateResponse extendExpiryDate( + String quoteId, QuoteExtendExpiryDateParams params) throws ChargebeeException { + Response response = extendExpiryDateRaw(quoteId, params); + return QuoteExtendExpiryDateResponse.fromJson(response.getBodyAsString(), response); } - /** editForChargeItemsAndChargesForQuote a quote (executes immediately) - returns raw Response. */ - Response editForChargeItemsAndChargesForQuoteRaw(String quoteId) throws Exception { + /** editForChargeItemsAndCharges a quote (executes immediately) - returns raw Response. */ + Response editForChargeItemsAndChargesRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_for_charge_items_and_charges", "quote-id", quoteId); @@ -372,11 +368,11 @@ Response editForChargeItemsAndChargesForQuoteRaw(String quoteId) throws Exceptio } /** - * editForChargeItemsAndChargesForQuote a quote using immutable params (executes immediately) - - * returns raw Response. + * editForChargeItemsAndCharges a quote using immutable params (executes immediately) - returns + * raw Response. */ - Response editForChargeItemsAndChargesForQuoteRaw( - String quoteId, EditForChargeItemsAndChargesForQuoteParams params) throws Exception { + Response editForChargeItemsAndChargesRaw( + String quoteId, QuoteEditForChargeItemsAndChargesParams params) throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_for_charge_items_and_charges", "quote-id", quoteId); @@ -384,29 +380,25 @@ Response editForChargeItemsAndChargesForQuoteRaw( } /** - * editForChargeItemsAndChargesForQuote a quote using raw JSON payload (executes immediately) - - * returns raw Response. + * editForChargeItemsAndCharges a quote using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response editForChargeItemsAndChargesForQuoteRaw(String quoteId, String jsonPayload) - throws Exception { + Response editForChargeItemsAndChargesRaw(String quoteId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_for_charge_items_and_charges", "quote-id", quoteId); return postJson(path, jsonPayload); } - public EditForChargeItemsAndChargesForQuoteResponse editForChargeItemsAndChargesForQuote( - String quoteId, EditForChargeItemsAndChargesForQuoteParams params) throws Exception { - Response response = editForChargeItemsAndChargesForQuoteRaw(quoteId, params); - return EditForChargeItemsAndChargesForQuoteResponse.fromJson( - response.getBodyAsString(), response); + public QuoteEditForChargeItemsAndChargesResponse editForChargeItemsAndCharges( + String quoteId, QuoteEditForChargeItemsAndChargesParams params) throws ChargebeeException { + Response response = editForChargeItemsAndChargesRaw(quoteId, params); + return QuoteEditForChargeItemsAndChargesResponse.fromJson(response.getBodyAsString(), response); } - /** - * editUpdateSubscriptionQuoteForItemsForQuote a quote (executes immediately) - returns raw - * Response. - */ - Response editUpdateSubscriptionQuoteForItemsForQuoteRaw(String quoteId) throws Exception { + /** editUpdateSubscriptionQuoteForItems a quote (executes immediately) - returns raw Response. */ + Response editUpdateSubscriptionQuoteForItemsRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote_for_items", "quote-id", quoteId); @@ -415,11 +407,11 @@ Response editUpdateSubscriptionQuoteForItemsForQuoteRaw(String quoteId) throws E } /** - * editUpdateSubscriptionQuoteForItemsForQuote a quote using immutable params (executes - * immediately) - returns raw Response. + * editUpdateSubscriptionQuoteForItems a quote using immutable params (executes immediately) - + * returns raw Response. */ - Response editUpdateSubscriptionQuoteForItemsForQuoteRaw( - String quoteId, EditUpdateSubscriptionQuoteForItemsForQuoteParams params) throws Exception { + Response editUpdateSubscriptionQuoteForItemsRaw( + String quoteId, EditUpdateSubscriptionQuoteForItemsParams params) throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote_for_items", "quote-id", quoteId); @@ -427,107 +419,100 @@ Response editUpdateSubscriptionQuoteForItemsForQuoteRaw( } /** - * editUpdateSubscriptionQuoteForItemsForQuote a quote using raw JSON payload (executes - * immediately) - returns raw Response. + * editUpdateSubscriptionQuoteForItems a quote using raw JSON payload (executes immediately) - + * returns raw Response. */ - Response editUpdateSubscriptionQuoteForItemsForQuoteRaw(String quoteId, String jsonPayload) - throws Exception { + Response editUpdateSubscriptionQuoteForItemsRaw(String quoteId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote_for_items", "quote-id", quoteId); return postJson(path, jsonPayload); } - public EditUpdateSubscriptionQuoteForItemsForQuoteResponse - editUpdateSubscriptionQuoteForItemsForQuote( - String quoteId, EditUpdateSubscriptionQuoteForItemsForQuoteParams params) - throws Exception { - Response response = editUpdateSubscriptionQuoteForItemsForQuoteRaw(quoteId, params); - return EditUpdateSubscriptionQuoteForItemsForQuoteResponse.fromJson( + public EditUpdateSubscriptionQuoteForItemsResponse editUpdateSubscriptionQuoteForItems( + String quoteId, EditUpdateSubscriptionQuoteForItemsParams params) throws ChargebeeException { + Response response = editUpdateSubscriptionQuoteForItemsRaw(quoteId, params); + return EditUpdateSubscriptionQuoteForItemsResponse.fromJson( response.getBodyAsString(), response); } /** list a quote using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(QuoteListParams params) throws Exception { + Response listRaw(QuoteListParams params) throws ChargebeeException { return get("/quotes", params != null ? params.toQueryParams() : null); } /** list a quote without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/quotes", null); } /** list a quote using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public QuoteListResponse list(QuoteListParams params) throws Exception { + public QuoteListResponse list(QuoteListParams params) throws ChargebeeException { Response response = listRaw(params); return QuoteListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public QuoteListResponse list() throws Exception { + public QuoteListResponse list() throws ChargebeeException { Response response = listRaw(); return QuoteListResponse.fromJson(response.getBodyAsString(), this, null, response); } - /** pdfForQuote a quote (executes immediately) - returns raw Response. */ - Response pdfForQuoteRaw(String quoteId) throws Exception { + /** pdf a quote (executes immediately) - returns raw Response. */ + Response pdfRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/pdf", "quote-id", quoteId); return post(path, null); } - /** pdfForQuote a quote using immutable params (executes immediately) - returns raw Response. */ - Response pdfForQuoteRaw(String quoteId, PdfForQuoteParams params) throws Exception { + /** pdf a quote using immutable params (executes immediately) - returns raw Response. */ + Response pdfRaw(String quoteId, QuotePdfParams params) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/pdf", "quote-id", quoteId); return post(path, params.toFormData()); } - /** pdfForQuote a quote using raw JSON payload (executes immediately) - returns raw Response. */ - Response pdfForQuoteRaw(String quoteId, String jsonPayload) throws Exception { + /** pdf a quote using raw JSON payload (executes immediately) - returns raw Response. */ + Response pdfRaw(String quoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/pdf", "quote-id", quoteId); return postJson(path, jsonPayload); } - public PdfForQuoteResponse pdfForQuote(String quoteId, PdfForQuoteParams params) - throws Exception { - Response response = pdfForQuoteRaw(quoteId, params); - return PdfForQuoteResponse.fromJson(response.getBodyAsString(), response); + public QuotePdfResponse pdf(String quoteId, QuotePdfParams params) throws ChargebeeException { + Response response = pdfRaw(quoteId, params); + return QuotePdfResponse.fromJson(response.getBodyAsString(), response); } - /** convertForQuote a quote (executes immediately) - returns raw Response. */ - Response convertForQuoteRaw(String quoteId) throws Exception { + /** convert a quote (executes immediately) - returns raw Response. */ + Response convertRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/convert", "quote-id", quoteId); return post(path, null); } - /** - * convertForQuote a quote using immutable params (executes immediately) - returns raw Response. - */ - Response convertForQuoteRaw(String quoteId, ConvertForQuoteParams params) throws Exception { + /** convert a quote using immutable params (executes immediately) - returns raw Response. */ + Response convertRaw(String quoteId, QuoteConvertParams params) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/convert", "quote-id", quoteId); return post(path, params.toFormData()); } - /** - * convertForQuote a quote using raw JSON payload (executes immediately) - returns raw Response. - */ - Response convertForQuoteRaw(String quoteId, String jsonPayload) throws Exception { + /** convert a quote using raw JSON payload (executes immediately) - returns raw Response. */ + Response convertRaw(String quoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/convert", "quote-id", quoteId); return postJson(path, jsonPayload); } - public ConvertForQuoteResponse convertForQuote(String quoteId, ConvertForQuoteParams params) - throws Exception { - Response response = convertForQuoteRaw(quoteId, params); - return ConvertForQuoteResponse.fromJson(response.getBodyAsString(), response); + public QuoteConvertResponse convert(String quoteId, QuoteConvertParams params) + throws ChargebeeException { + Response response = convertRaw(quoteId, params); + return QuoteConvertResponse.fromJson(response.getBodyAsString(), response); } /** @@ -535,7 +520,7 @@ public ConvertForQuoteResponse convertForQuote(String quoteId, ConvertForQuotePa * raw Response. */ Response createForChargeItemsAndChargesRaw(QuoteCreateForChargeItemsAndChargesParams params) - throws Exception { + throws ChargebeeException { return post( "/quotes/create_for_charge_items_and_charges", params != null ? params.toFormData() : null); @@ -545,46 +530,46 @@ Response createForChargeItemsAndChargesRaw(QuoteCreateForChargeItemsAndChargesPa * createForChargeItemsAndCharges a quote using raw JSON payload (executes immediately) - returns * raw Response. */ - Response createForChargeItemsAndChargesRaw(String jsonPayload) throws Exception { + Response createForChargeItemsAndChargesRaw(String jsonPayload) throws ChargebeeException { return postJson("/quotes/create_for_charge_items_and_charges", jsonPayload); } public QuoteCreateForChargeItemsAndChargesResponse createForChargeItemsAndCharges( - QuoteCreateForChargeItemsAndChargesParams params) throws Exception { + QuoteCreateForChargeItemsAndChargesParams params) throws ChargebeeException { Response response = createForChargeItemsAndChargesRaw(params); return QuoteCreateForChargeItemsAndChargesResponse.fromJson( response.getBodyAsString(), response); } - /** deleteQuote a quote (executes immediately) - returns raw Response. */ - Response deleteQuoteRaw(String quoteId) throws Exception { + /** delete a quote (executes immediately) - returns raw Response. */ + Response deleteRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/delete", "quote-id", quoteId); return post(path, null); } - /** deleteQuote a quote using immutable params (executes immediately) - returns raw Response. */ - Response deleteQuoteRaw(String quoteId, DeleteQuoteParams params) throws Exception { + /** delete a quote using immutable params (executes immediately) - returns raw Response. */ + Response deleteRaw(String quoteId, QuoteDeleteParams params) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/delete", "quote-id", quoteId); return post(path, params.toFormData()); } - /** deleteQuote a quote using raw JSON payload (executes immediately) - returns raw Response. */ - Response deleteQuoteRaw(String quoteId, String jsonPayload) throws Exception { + /** delete a quote using raw JSON payload (executes immediately) - returns raw Response. */ + Response deleteRaw(String quoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/delete", "quote-id", quoteId); return postJson(path, jsonPayload); } - public DeleteQuoteResponse deleteQuote(String quoteId, DeleteQuoteParams params) - throws Exception { - Response response = deleteQuoteRaw(quoteId, params); - return DeleteQuoteResponse.fromJson(response.getBodyAsString(), response); + public QuoteDeleteResponse delete(String quoteId, QuoteDeleteParams params) + throws ChargebeeException { + Response response = deleteRaw(quoteId, params); + return QuoteDeleteResponse.fromJson(response.getBodyAsString(), response); } - /** editOneTimeQuoteForQuote a quote (executes immediately) - returns raw Response. */ - Response editOneTimeQuoteForQuoteRaw(String quoteId) throws Exception { + /** editOneTimeQuote a quote (executes immediately) - returns raw Response. */ + Response editOneTimeQuoteRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/edit_one_time_quote", "quote-id", quoteId); @@ -592,37 +577,36 @@ Response editOneTimeQuoteForQuoteRaw(String quoteId) throws Exception { } /** - * editOneTimeQuoteForQuote a quote using immutable params (executes immediately) - returns raw - * Response. + * editOneTimeQuote a quote using immutable params (executes immediately) - returns raw Response. */ - Response editOneTimeQuoteForQuoteRaw(String quoteId, EditOneTimeQuoteForQuoteParams params) - throws Exception { + Response editOneTimeQuoteRaw(String quoteId, EditOneTimeQuoteParams params) + throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/edit_one_time_quote", "quote-id", quoteId); return post(path, params.toFormData()); } /** - * editOneTimeQuoteForQuote a quote using raw JSON payload (executes immediately) - returns raw - * Response. + * editOneTimeQuote a quote using raw JSON payload (executes immediately) - returns raw Response. */ - Response editOneTimeQuoteForQuoteRaw(String quoteId, String jsonPayload) throws Exception { + Response editOneTimeQuoteRaw(String quoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/edit_one_time_quote", "quote-id", quoteId); return postJson(path, jsonPayload); } - public EditOneTimeQuoteForQuoteResponse editOneTimeQuoteForQuote( - String quoteId, EditOneTimeQuoteForQuoteParams params) throws Exception { - Response response = editOneTimeQuoteForQuoteRaw(quoteId, params); - return EditOneTimeQuoteForQuoteResponse.fromJson(response.getBodyAsString(), response); + public EditOneTimeQuoteResponse editOneTimeQuote(String quoteId, EditOneTimeQuoteParams params) + throws ChargebeeException { + Response response = editOneTimeQuoteRaw(quoteId, params); + return EditOneTimeQuoteResponse.fromJson(response.getBodyAsString(), response); } /** * updateSubscriptionQuote a quote using immutable params (executes immediately) - returns raw * Response. */ - Response updateSubscriptionQuoteRaw(UpdateSubscriptionQuoteParams params) throws Exception { + Response updateSubscriptionQuoteRaw(UpdateSubscriptionQuoteParams params) + throws ChargebeeException { return post("/quotes/update_subscription_quote", params != null ? params.toFormData() : null); } @@ -631,13 +615,13 @@ Response updateSubscriptionQuoteRaw(UpdateSubscriptionQuoteParams params) throws * updateSubscriptionQuote a quote using raw JSON payload (executes immediately) - returns raw * Response. */ - Response updateSubscriptionQuoteRaw(String jsonPayload) throws Exception { + Response updateSubscriptionQuoteRaw(String jsonPayload) throws ChargebeeException { return postJson("/quotes/update_subscription_quote", jsonPayload); } public UpdateSubscriptionQuoteResponse updateSubscriptionQuote( - UpdateSubscriptionQuoteParams params) throws Exception { + UpdateSubscriptionQuoteParams params) throws ChargebeeException { Response response = updateSubscriptionQuoteRaw(params); return UpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response); @@ -647,7 +631,8 @@ public UpdateSubscriptionQuoteResponse updateSubscriptionQuote( * createForOnetimeCharges a quote using immutable params (executes immediately) - returns raw * Response. */ - Response createForOnetimeChargesRaw(QuoteCreateForOnetimeChargesParams params) throws Exception { + Response createForOnetimeChargesRaw(QuoteCreateForOnetimeChargesParams params) + throws ChargebeeException { return post("/quotes/create_for_onetime_charges", params != null ? params.toFormData() : null); } @@ -656,20 +641,20 @@ Response createForOnetimeChargesRaw(QuoteCreateForOnetimeChargesParams params) t * createForOnetimeCharges a quote using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createForOnetimeChargesRaw(String jsonPayload) throws Exception { + Response createForOnetimeChargesRaw(String jsonPayload) throws ChargebeeException { return postJson("/quotes/create_for_onetime_charges", jsonPayload); } public QuoteCreateForOnetimeChargesResponse createForOnetimeCharges( - QuoteCreateForOnetimeChargesParams params) throws Exception { + QuoteCreateForOnetimeChargesParams params) throws ChargebeeException { Response response = createForOnetimeChargesRaw(params); return QuoteCreateForOnetimeChargesResponse.fromJson(response.getBodyAsString(), response); } - /** createSubscriptionQuoteForCustomer a quote (executes immediately) - returns raw Response. */ - Response createSubscriptionQuoteForCustomerRaw(String customerId) throws Exception { + /** createSubscriptionForCustomerQuote a quote (executes immediately) - returns raw Response. */ + Response createSubscriptionForCustomerQuoteRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_quote", "customer-id", customerId); @@ -678,11 +663,12 @@ Response createSubscriptionQuoteForCustomerRaw(String customerId) throws Excepti } /** - * createSubscriptionQuoteForCustomer a quote using immutable params (executes immediately) - + * createSubscriptionForCustomerQuote a quote using immutable params (executes immediately) - * returns raw Response. */ - Response createSubscriptionQuoteForCustomerRaw( - String customerId, CreateSubscriptionQuoteForCustomerParams params) throws Exception { + Response createSubscriptionForCustomerQuoteRaw( + String customerId, CreateSubscriptionForCustomerQuoteParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_quote", "customer-id", customerId); @@ -690,26 +676,27 @@ Response createSubscriptionQuoteForCustomerRaw( } /** - * createSubscriptionQuoteForCustomer a quote using raw JSON payload (executes immediately) - + * createSubscriptionForCustomerQuote a quote using raw JSON payload (executes immediately) - * returns raw Response. */ - Response createSubscriptionQuoteForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response createSubscriptionForCustomerQuoteRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_quote", "customer-id", customerId); return postJson(path, jsonPayload); } - public CreateSubscriptionQuoteForCustomerResponse createSubscriptionQuoteForCustomer( - String customerId, CreateSubscriptionQuoteForCustomerParams params) throws Exception { - Response response = createSubscriptionQuoteForCustomerRaw(customerId, params); - return CreateSubscriptionQuoteForCustomerResponse.fromJson( + public CreateSubscriptionForCustomerQuoteResponse createSubscriptionForCustomerQuote( + String customerId, CreateSubscriptionForCustomerQuoteParams params) + throws ChargebeeException { + Response response = createSubscriptionForCustomerQuoteRaw(customerId, params); + return CreateSubscriptionForCustomerQuoteResponse.fromJson( response.getBodyAsString(), response); } - /** editUpdateSubscriptionQuoteForQuote a quote (executes immediately) - returns raw Response. */ - Response editUpdateSubscriptionQuoteForQuoteRaw(String quoteId) throws Exception { + /** editUpdateSubscriptionQuote a quote (executes immediately) - returns raw Response. */ + Response editUpdateSubscriptionQuoteRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote", "quote-id", quoteId); @@ -718,11 +705,11 @@ Response editUpdateSubscriptionQuoteForQuoteRaw(String quoteId) throws Exception } /** - * editUpdateSubscriptionQuoteForQuote a quote using immutable params (executes immediately) - - * returns raw Response. + * editUpdateSubscriptionQuote a quote using immutable params (executes immediately) - returns raw + * Response. */ - Response editUpdateSubscriptionQuoteForQuoteRaw( - String quoteId, EditUpdateSubscriptionQuoteForQuoteParams params) throws Exception { + Response editUpdateSubscriptionQuoteRaw(String quoteId, EditUpdateSubscriptionQuoteParams params) + throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote", "quote-id", quoteId); @@ -730,26 +717,27 @@ Response editUpdateSubscriptionQuoteForQuoteRaw( } /** - * editUpdateSubscriptionQuoteForQuote a quote using raw JSON payload (executes immediately) - - * returns raw Response. + * editUpdateSubscriptionQuote a quote using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response editUpdateSubscriptionQuoteForQuoteRaw(String quoteId, String jsonPayload) - throws Exception { + Response editUpdateSubscriptionQuoteRaw(String quoteId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote", "quote-id", quoteId); return postJson(path, jsonPayload); } - public EditUpdateSubscriptionQuoteForQuoteResponse editUpdateSubscriptionQuoteForQuote( - String quoteId, EditUpdateSubscriptionQuoteForQuoteParams params) throws Exception { - Response response = editUpdateSubscriptionQuoteForQuoteRaw(quoteId, params); - return EditUpdateSubscriptionQuoteForQuoteResponse.fromJson( - response.getBodyAsString(), response); + public EditUpdateSubscriptionQuoteResponse editUpdateSubscriptionQuote( + String quoteId, EditUpdateSubscriptionQuoteParams params) throws ChargebeeException { + Response response = editUpdateSubscriptionQuoteRaw(quoteId, params); + return EditUpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response); } - /** editCreateSubscriptionQuoteForQuote a quote (executes immediately) - returns raw Response. */ - Response editCreateSubscriptionQuoteForQuoteRaw(String quoteId) throws Exception { + /** + * editCreateSubscriptionForCustomerQuote a quote (executes immediately) - returns raw Response. + */ + Response editCreateSubscriptionForCustomerQuoteRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote", "quote-id", quoteId); @@ -758,11 +746,12 @@ Response editCreateSubscriptionQuoteForQuoteRaw(String quoteId) throws Exception } /** - * editCreateSubscriptionQuoteForQuote a quote using immutable params (executes immediately) - + * editCreateSubscriptionForCustomerQuote a quote using immutable params (executes immediately) - * returns raw Response. */ - Response editCreateSubscriptionQuoteForQuoteRaw( - String quoteId, EditCreateSubscriptionQuoteForQuoteParams params) throws Exception { + Response editCreateSubscriptionForCustomerQuoteRaw( + String quoteId, EditCreateSubscriptionForCustomerQuoteParams params) + throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote", "quote-id", quoteId); @@ -770,21 +759,22 @@ Response editCreateSubscriptionQuoteForQuoteRaw( } /** - * editCreateSubscriptionQuoteForQuote a quote using raw JSON payload (executes immediately) - + * editCreateSubscriptionForCustomerQuote a quote using raw JSON payload (executes immediately) - * returns raw Response. */ - Response editCreateSubscriptionQuoteForQuoteRaw(String quoteId, String jsonPayload) - throws Exception { + Response editCreateSubscriptionForCustomerQuoteRaw(String quoteId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote", "quote-id", quoteId); return postJson(path, jsonPayload); } - public EditCreateSubscriptionQuoteForQuoteResponse editCreateSubscriptionQuoteForQuote( - String quoteId, EditCreateSubscriptionQuoteForQuoteParams params) throws Exception { - Response response = editCreateSubscriptionQuoteForQuoteRaw(quoteId, params); - return EditCreateSubscriptionQuoteForQuoteResponse.fromJson( + public EditCreateSubscriptionForCustomerQuoteResponse editCreateSubscriptionForCustomerQuote( + String quoteId, EditCreateSubscriptionForCustomerQuoteParams params) + throws ChargebeeException { + Response response = editCreateSubscriptionForCustomerQuoteRaw(quoteId, params); + return EditCreateSubscriptionForCustomerQuoteResponse.fromJson( response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/RampService.java b/src/main/java/com/chargebee/v4/services/RampService.java index 84bba06a..cf98a6f6 100644 --- a/src/main/java/com/chargebee/v4/services/RampService.java +++ b/src/main/java/com/chargebee/v4/services/RampService.java @@ -9,23 +9,24 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.ramp.params.CreateRampForSubscriptionParams; +import com.chargebee.v4.models.ramp.params.RampCreateForSubscriptionParams; import com.chargebee.v4.models.ramp.params.RampListParams; -import com.chargebee.v4.models.ramp.params.UpdateRampParams; +import com.chargebee.v4.models.ramp.params.RampUpdateParams; import com.chargebee.v4.models.ramp.responses.RampRetrieveResponse; -import com.chargebee.v4.models.ramp.responses.CreateRampForSubscriptionResponse; +import com.chargebee.v4.models.ramp.responses.RampCreateForSubscriptionResponse; import com.chargebee.v4.models.ramp.responses.RampListResponse; -import com.chargebee.v4.models.ramp.responses.UpdateRampResponse; +import com.chargebee.v4.models.ramp.responses.RampUpdateResponse; -import com.chargebee.v4.models.ramp.responses.DeleteRampResponse; +import com.chargebee.v4.models.ramp.responses.RampDeleteResponse; public final class RampService extends BaseService { @@ -62,19 +63,19 @@ public RampService withOptions(RequestOptions options) { // === Operations === /** retrieve a ramp (executes immediately) - returns raw Response. */ - Response retrieveRaw(String rampId) throws Exception { + Response retrieveRaw(String rampId) throws ChargebeeException { String path = buildPathWithParams("/ramps/{ramp-id}", "ramp-id", rampId); return get(path, null); } - public RampRetrieveResponse retrieve(String rampId) throws Exception { + public RampRetrieveResponse retrieve(String rampId) throws ChargebeeException { Response response = retrieveRaw(rampId); return RampRetrieveResponse.fromJson(response.getBodyAsString(), response); } - /** createRampForSubscription a ramp (executes immediately) - returns raw Response. */ - Response createRampForSubscriptionRaw(String subscriptionId) throws Exception { + /** createForSubscription a ramp (executes immediately) - returns raw Response. */ + Response createForSubscriptionRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/create_ramp", "subscription-id", subscriptionId); @@ -83,11 +84,11 @@ Response createRampForSubscriptionRaw(String subscriptionId) throws Exception { } /** - * createRampForSubscription a ramp using immutable params (executes immediately) - returns raw + * createForSubscription a ramp using immutable params (executes immediately) - returns raw * Response. */ - Response createRampForSubscriptionRaw( - String subscriptionId, CreateRampForSubscriptionParams params) throws Exception { + Response createForSubscriptionRaw(String subscriptionId, RampCreateForSubscriptionParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/create_ramp", "subscription-id", subscriptionId); @@ -95,85 +96,86 @@ Response createRampForSubscriptionRaw( } /** - * createRampForSubscription a ramp using raw JSON payload (executes immediately) - returns raw + * createForSubscription a ramp using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createRampForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response createForSubscriptionRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/create_ramp", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public CreateRampForSubscriptionResponse createRampForSubscription( - String subscriptionId, CreateRampForSubscriptionParams params) throws Exception { - Response response = createRampForSubscriptionRaw(subscriptionId, params); - return CreateRampForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public RampCreateForSubscriptionResponse createForSubscription( + String subscriptionId, RampCreateForSubscriptionParams params) throws ChargebeeException { + Response response = createForSubscriptionRaw(subscriptionId, params); + return RampCreateForSubscriptionResponse.fromJson(response.getBodyAsString(), response); } /** list a ramp using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(RampListParams params) throws Exception { + Response listRaw(RampListParams params) throws ChargebeeException { return get("/ramps", params != null ? params.toQueryParams() : null); } /** list a ramp without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/ramps", null); } /** list a ramp using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public RampListResponse list(RampListParams params) throws Exception { + public RampListResponse list(RampListParams params) throws ChargebeeException { Response response = listRaw(params); return RampListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public RampListResponse list() throws Exception { + public RampListResponse list() throws ChargebeeException { Response response = listRaw(); return RampListResponse.fromJson(response.getBodyAsString(), this, null, response); } - /** updateRamp a ramp (executes immediately) - returns raw Response. */ - Response updateRampRaw(String rampId) throws Exception { + /** update a ramp (executes immediately) - returns raw Response. */ + Response updateRaw(String rampId) throws ChargebeeException { String path = buildPathWithParams("/ramps/{ramp-id}/update", "ramp-id", rampId); return post(path, null); } - /** updateRamp a ramp using immutable params (executes immediately) - returns raw Response. */ - Response updateRampRaw(String rampId, UpdateRampParams params) throws Exception { + /** update a ramp using immutable params (executes immediately) - returns raw Response. */ + Response updateRaw(String rampId, RampUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/ramps/{ramp-id}/update", "ramp-id", rampId); return post(path, params.toFormData()); } - /** updateRamp a ramp using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRampRaw(String rampId, String jsonPayload) throws Exception { + /** update a ramp using raw JSON payload (executes immediately) - returns raw Response. */ + Response updateRaw(String rampId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/ramps/{ramp-id}/update", "ramp-id", rampId); return postJson(path, jsonPayload); } - public UpdateRampResponse updateRamp(String rampId, UpdateRampParams params) throws Exception { - Response response = updateRampRaw(rampId, params); - return UpdateRampResponse.fromJson(response.getBodyAsString(), response); + public RampUpdateResponse update(String rampId, RampUpdateParams params) + throws ChargebeeException { + Response response = updateRaw(rampId, params); + return RampUpdateResponse.fromJson(response.getBodyAsString(), response); } - /** deleteRamp a ramp (executes immediately) - returns raw Response. */ - Response deleteRampRaw(String rampId) throws Exception { + /** delete a ramp (executes immediately) - returns raw Response. */ + Response deleteRaw(String rampId) throws ChargebeeException { String path = buildPathWithParams("/ramps/{ramp-id}/delete", "ramp-id", rampId); return post(path, null); } - public DeleteRampResponse deleteRamp(String rampId) throws Exception { - Response response = deleteRampRaw(rampId); - return DeleteRampResponse.fromJson(response.getBodyAsString(), response); + public RampDeleteResponse delete(String rampId) throws ChargebeeException { + Response response = deleteRaw(rampId); + return RampDeleteResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java b/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java index 47f77e64..67b65fe9 100644 --- a/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java +++ b/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.recordedPurchase.params.RecordedPurchaseCreateParams; @@ -53,7 +54,7 @@ public RecordedPurchaseService withOptions(RequestOptions options) { // === Operations === /** retrieve a recordedPurchase (executes immediately) - returns raw Response. */ - Response retrieveRaw(String recordedPurchaseId) throws Exception { + Response retrieveRaw(String recordedPurchaseId) throws ChargebeeException { String path = buildPathWithParams( "/recorded_purchases/{recorded-purchase-id}", @@ -63,7 +64,8 @@ Response retrieveRaw(String recordedPurchaseId) throws Exception { return get(path, null); } - public RecordedPurchaseRetrieveResponse retrieve(String recordedPurchaseId) throws Exception { + public RecordedPurchaseRetrieveResponse retrieve(String recordedPurchaseId) + throws ChargebeeException { Response response = retrieveRaw(recordedPurchaseId); return RecordedPurchaseRetrieveResponse.fromJson(response.getBodyAsString(), response); } @@ -71,7 +73,7 @@ public RecordedPurchaseRetrieveResponse retrieve(String recordedPurchaseId) thro /** * create a recordedPurchase using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(RecordedPurchaseCreateParams params) throws Exception { + Response createRaw(RecordedPurchaseCreateParams params) throws ChargebeeException { return post("/recorded_purchases", params != null ? params.toFormData() : null); } @@ -79,13 +81,13 @@ Response createRaw(RecordedPurchaseCreateParams params) throws Exception { /** * create a recordedPurchase using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/recorded_purchases", jsonPayload); } public RecordedPurchaseCreateResponse create(RecordedPurchaseCreateParams params) - throws Exception { + throws ChargebeeException { Response response = createRaw(params); return RecordedPurchaseCreateResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java b/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java index 888aee63..19a552d5 100644 --- a/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java +++ b/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.resourceMigration.params.ResourceMigrationRetrieveLatestParams; @@ -54,7 +55,8 @@ public ResourceMigrationService withOptions(RequestOptions options) { * retrieveLatest a resourceMigration using immutable params (executes immediately) - returns raw * Response. */ - Response retrieveLatestRaw(ResourceMigrationRetrieveLatestParams params) throws Exception { + Response retrieveLatestRaw(ResourceMigrationRetrieveLatestParams params) + throws ChargebeeException { return get( "/resource_migrations/retrieve_latest", params != null ? params.toQueryParams() : null); @@ -64,13 +66,13 @@ Response retrieveLatestRaw(ResourceMigrationRetrieveLatestParams params) throws * retrieveLatest a resourceMigration using raw JSON payload (executes immediately) - returns raw * Response. */ - Response retrieveLatestRaw(String jsonPayload) throws Exception { + Response retrieveLatestRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public ResourceMigrationRetrieveLatestResponse retrieveLatest( - ResourceMigrationRetrieveLatestParams params) throws Exception { + ResourceMigrationRetrieveLatestParams params) throws ChargebeeException { Response response = retrieveLatestRaw(params); return ResourceMigrationRetrieveLatestResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/RuleService.java b/src/main/java/com/chargebee/v4/services/RuleService.java index 72ee3d27..3b774961 100644 --- a/src/main/java/com/chargebee/v4/services/RuleService.java +++ b/src/main/java/com/chargebee/v4/services/RuleService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.rule.responses.RuleRetrieveResponse; @@ -48,13 +49,13 @@ public RuleService withOptions(RequestOptions options) { // === Operations === /** retrieve a rule (executes immediately) - returns raw Response. */ - Response retrieveRaw(String ruleId) throws Exception { + Response retrieveRaw(String ruleId) throws ChargebeeException { String path = buildPathWithParams("/rules/{rule-id}", "rule-id", ruleId); return get(path, null); } - public RuleRetrieveResponse retrieve(String ruleId) throws Exception { + public RuleRetrieveResponse retrieve(String ruleId) throws ChargebeeException { Response response = retrieveRaw(ruleId); return RuleRetrieveResponse.fromJson(response.getBodyAsString(), response); } diff --git a/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java b/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java index 7247d83e..01f25bf1 100644 --- a/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java +++ b/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.siteMigrationDetail.params.SiteMigrationDetailListParams; @@ -54,13 +55,13 @@ public SiteMigrationDetailService withOptions(RequestOptions options) { * list a siteMigrationDetail using immutable params (executes immediately) - returns raw * Response. */ - Response listRaw(SiteMigrationDetailListParams params) throws Exception { + Response listRaw(SiteMigrationDetailListParams params) throws ChargebeeException { return get("/site_migration_details", params != null ? params.toQueryParams() : null); } /** list a siteMigrationDetail without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/site_migration_details", null); } @@ -69,20 +70,20 @@ Response listRaw() throws Exception { * list a siteMigrationDetail using raw JSON payload (executes immediately) - returns raw * Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public SiteMigrationDetailListResponse list(SiteMigrationDetailListParams params) - throws Exception { + throws ChargebeeException { Response response = listRaw(params); return SiteMigrationDetailListResponse.fromJson( response.getBodyAsString(), this, params, response); } - public SiteMigrationDetailListResponse list() throws Exception { + public SiteMigrationDetailListResponse list() throws ChargebeeException { Response response = listRaw(); return SiteMigrationDetailListResponse.fromJson( response.getBodyAsString(), this, null, response); diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java b/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java index 57bc8a24..ef765657 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java @@ -9,13 +9,14 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.subscriptionEntitlement.params.SubscriptionEntitlementsSetAvailabilityForSubscriptionParams; +import com.chargebee.v4.models.subscriptionEntitlement.params.SetSubscriptionEntitlementAvailabilityParams; import com.chargebee.v4.models.subscriptionEntitlement.params.SubscriptionEntitlementsForSubscriptionParams; -import com.chargebee.v4.models.subscriptionEntitlement.responses.SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse; +import com.chargebee.v4.models.subscriptionEntitlement.responses.SetSubscriptionEntitlementAvailabilityResponse; import com.chargebee.v4.models.subscriptionEntitlement.responses.SubscriptionEntitlementsForSubscriptionResponse; @@ -56,11 +57,11 @@ public SubscriptionEntitlementService withOptions(RequestOptions options) { // === Operations === /** - * subscriptionEntitlementsSetAvailabilityForSubscription a subscriptionEntitlement (executes - * immediately) - returns raw Response. + * setSubscriptionEntitlementAvailability a subscriptionEntitlement (executes immediately) - + * returns raw Response. */ - Response subscriptionEntitlementsSetAvailabilityForSubscriptionRaw(String subscriptionId) - throws Exception { + Response setSubscriptionEntitlementAvailabilityRaw(String subscriptionId) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/subscription_entitlements/set_availability", @@ -71,12 +72,12 @@ Response subscriptionEntitlementsSetAvailabilityForSubscriptionRaw(String subscr } /** - * subscriptionEntitlementsSetAvailabilityForSubscription a subscriptionEntitlement using - * immutable params (executes immediately) - returns raw Response. + * setSubscriptionEntitlementAvailability a subscriptionEntitlement using immutable params + * (executes immediately) - returns raw Response. */ - Response subscriptionEntitlementsSetAvailabilityForSubscriptionRaw( - String subscriptionId, SubscriptionEntitlementsSetAvailabilityForSubscriptionParams params) - throws Exception { + Response setSubscriptionEntitlementAvailabilityRaw( + String subscriptionId, SetSubscriptionEntitlementAvailabilityParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/subscription_entitlements/set_availability", @@ -86,11 +87,11 @@ Response subscriptionEntitlementsSetAvailabilityForSubscriptionRaw( } /** - * subscriptionEntitlementsSetAvailabilityForSubscription a subscriptionEntitlement using raw JSON - * payload (executes immediately) - returns raw Response. + * setSubscriptionEntitlementAvailability a subscriptionEntitlement using raw JSON payload + * (executes immediately) - returns raw Response. */ - Response subscriptionEntitlementsSetAvailabilityForSubscriptionRaw( - String subscriptionId, String jsonPayload) throws Exception { + Response setSubscriptionEntitlementAvailabilityRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/subscription_entitlements/set_availability", @@ -99,14 +100,11 @@ Response subscriptionEntitlementsSetAvailabilityForSubscriptionRaw( return postJson(path, jsonPayload); } - public SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse - subscriptionEntitlementsSetAvailabilityForSubscription( - String subscriptionId, - SubscriptionEntitlementsSetAvailabilityForSubscriptionParams params) - throws Exception { - Response response = - subscriptionEntitlementsSetAvailabilityForSubscriptionRaw(subscriptionId, params); - return SubscriptionEntitlementsSetAvailabilityForSubscriptionResponse.fromJson( + public SetSubscriptionEntitlementAvailabilityResponse setSubscriptionEntitlementAvailability( + String subscriptionId, SetSubscriptionEntitlementAvailabilityParams params) + throws ChargebeeException { + Response response = setSubscriptionEntitlementAvailabilityRaw(subscriptionId, params); + return SetSubscriptionEntitlementAvailabilityResponse.fromJson( response.getBodyAsString(), response); } @@ -116,7 +114,7 @@ Response subscriptionEntitlementsSetAvailabilityForSubscriptionRaw( */ Response subscriptionEntitlementsForSubscriptionRaw( String subscriptionId, SubscriptionEntitlementsForSubscriptionParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/subscription_entitlements", @@ -129,7 +127,8 @@ Response subscriptionEntitlementsForSubscriptionRaw( * subscriptionEntitlementsForSubscription a subscriptionEntitlement without params (executes * immediately) - returns raw Response. */ - Response subscriptionEntitlementsForSubscriptionRaw(String subscriptionId) throws Exception { + Response subscriptionEntitlementsForSubscriptionRaw(String subscriptionId) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/subscription_entitlements", @@ -143,7 +142,7 @@ Response subscriptionEntitlementsForSubscriptionRaw(String subscriptionId) throw * (executes immediately) - returns raw Response. */ Response subscriptionEntitlementsForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/subscription_entitlements", @@ -154,14 +153,14 @@ Response subscriptionEntitlementsForSubscriptionRaw(String subscriptionId, Strin public SubscriptionEntitlementsForSubscriptionResponse subscriptionEntitlementsForSubscription( String subscriptionId, SubscriptionEntitlementsForSubscriptionParams params) - throws Exception { + throws ChargebeeException { Response response = subscriptionEntitlementsForSubscriptionRaw(subscriptionId, params); return SubscriptionEntitlementsForSubscriptionResponse.fromJson( response.getBodyAsString(), this, params, subscriptionId, response); } public SubscriptionEntitlementsForSubscriptionResponse subscriptionEntitlementsForSubscription( - String subscriptionId) throws Exception { + String subscriptionId) throws ChargebeeException { Response response = subscriptionEntitlementsForSubscriptionRaw(subscriptionId); return SubscriptionEntitlementsForSubscriptionResponse.fromJson( response.getBodyAsString(), this, null, subscriptionId, response); diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionService.java b/src/main/java/com/chargebee/v4/services/SubscriptionService.java index b34a161d..3d0b726b 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionService.java @@ -9,141 +9,142 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.subscription.params.RemoveAdvanceInvoiceScheduleForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionRemoveAdvanceInvoiceScheduleParams; -import com.chargebee.v4.models.subscription.params.UpdateForItemsForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionUpdateForItemsParams; -import com.chargebee.v4.models.subscription.params.RemoveCouponsForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionRemoveCouponsParams; -import com.chargebee.v4.models.subscription.params.ResumeForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionResumeParams; -import com.chargebee.v4.models.subscription.params.CancelForItemsForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionCancelForItemsParams; -import com.chargebee.v4.models.subscription.params.RegenerateInvoiceForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionRegenerateInvoiceParams; import com.chargebee.v4.models.subscription.params.SubscriptionListParams; import com.chargebee.v4.models.subscription.params.SubscriptionCreateParams; -import com.chargebee.v4.models.subscription.params.MoveForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionMoveParams; import com.chargebee.v4.models.subscription.params.SubscriptionsForCustomerParams; -import com.chargebee.v4.models.subscription.params.AddSubscriptionForCustomerParams; +import com.chargebee.v4.models.subscription.params.SubscriptionCreateForCustomerParams; -import com.chargebee.v4.models.subscription.params.SubscriptionImportForItemsForCustomerParams; +import com.chargebee.v4.models.subscription.params.SubscriptionImportForItemsParams; -import com.chargebee.v4.models.subscription.params.RemoveScheduledCancellationForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionRemoveScheduledCancellationParams; -import com.chargebee.v4.models.subscription.params.ReactivateForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionReactivateParams; -import com.chargebee.v4.models.subscription.params.ChargeFutureRenewalsForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionChargeFutureRenewalsParams; -import com.chargebee.v4.models.subscription.params.AddChargeAtTermEndForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionAddChargeAtTermEndParams; -import com.chargebee.v4.models.subscription.params.ChangeTermEndForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionChangeTermEndParams; -import com.chargebee.v4.models.subscription.params.SubscriptionForItemsForCustomerParams; +import com.chargebee.v4.models.subscription.params.SubscriptionCreateWithItemsParams; -import com.chargebee.v4.models.subscription.params.ImportUnbilledChargesForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionImportUnbilledChargesParams; import com.chargebee.v4.models.subscription.params.SubscriptionUpdateParams; -import com.chargebee.v4.models.subscription.params.ImportContractTermForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionImportContractTermParams; -import com.chargebee.v4.models.subscription.params.OverrideBillingProfileForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionOverrideBillingProfileParams; -import com.chargebee.v4.models.subscription.params.EditAdvanceInvoiceScheduleForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionEditAdvanceInvoiceScheduleParams; -import com.chargebee.v4.models.subscription.params.DiscountsForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionListDiscountsParams; import com.chargebee.v4.models.subscription.params.ContractTermsForSubscriptionParams; -import com.chargebee.v4.models.subscription.params.PauseForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionPauseParams; -import com.chargebee.v4.models.subscription.params.ImportSubscriptionForCustomerParams; +import com.chargebee.v4.models.subscription.params.SubscriptionImportForCustomerParams; import com.chargebee.v4.models.subscription.params.ImportSubscriptionParams; -import com.chargebee.v4.models.subscription.params.CancelForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionCancelParams; -import com.chargebee.v4.models.subscription.params.ChargeAddonAtTermEndForSubscriptionParams; +import com.chargebee.v4.models.subscription.params.SubscriptionChargeAddonAtTermEndParams; -import com.chargebee.v4.models.subscription.responses.RemoveAdvanceInvoiceScheduleForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionRemoveAdvanceInvoiceScheduleResponse; -import com.chargebee.v4.models.subscription.responses.UpdateForItemsForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionUpdateForItemsResponse; -import com.chargebee.v4.models.subscription.responses.RemoveCouponsForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionRemoveCouponsResponse; -import com.chargebee.v4.models.subscription.responses.ResumeForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionResumeResponse; -import com.chargebee.v4.models.subscription.responses.CancelForItemsForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionCancelForItemsResponse; -import com.chargebee.v4.models.subscription.responses.RegenerateInvoiceForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionRegenerateInvoiceResponse; import com.chargebee.v4.models.subscription.responses.SubscriptionListResponse; import com.chargebee.v4.models.subscription.responses.SubscriptionCreateResponse; -import com.chargebee.v4.models.subscription.responses.MoveForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionMoveResponse; import com.chargebee.v4.models.subscription.responses.SubscriptionsForCustomerResponse; -import com.chargebee.v4.models.subscription.responses.AddSubscriptionForCustomerResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionCreateForCustomerResponse; -import com.chargebee.v4.models.subscription.responses.SubscriptionImportForItemsForCustomerResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionImportForItemsResponse; -import com.chargebee.v4.models.subscription.responses.RetrieveAdvanceInvoiceScheduleForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionRetrieveAdvanceInvoiceScheduleResponse; -import com.chargebee.v4.models.subscription.responses.RemoveScheduledCancellationForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionRemoveScheduledCancellationResponse; -import com.chargebee.v4.models.subscription.responses.RetrieveWithScheduledChangesForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionRetrieveWithScheduledChangesResponse; -import com.chargebee.v4.models.subscription.responses.ReactivateForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionReactivateResponse; -import com.chargebee.v4.models.subscription.responses.ChargeFutureRenewalsForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionChargeFutureRenewalsResponse; -import com.chargebee.v4.models.subscription.responses.AddChargeAtTermEndForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionAddChargeAtTermEndResponse; -import com.chargebee.v4.models.subscription.responses.RemoveScheduledChangesForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionRemoveScheduledChangesResponse; -import com.chargebee.v4.models.subscription.responses.ChangeTermEndForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionChangeTermEndResponse; -import com.chargebee.v4.models.subscription.responses.DeleteSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionDeleteResponse; -import com.chargebee.v4.models.subscription.responses.SubscriptionForItemsForCustomerResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionCreateWithItemsResponse; -import com.chargebee.v4.models.subscription.responses.ImportUnbilledChargesForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionImportUnbilledChargesResponse; -import com.chargebee.v4.models.subscription.responses.RemoveScheduledResumptionForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionRemoveScheduledResumptionResponse; import com.chargebee.v4.models.subscription.responses.SubscriptionRetrieveResponse; import com.chargebee.v4.models.subscription.responses.SubscriptionUpdateResponse; -import com.chargebee.v4.models.subscription.responses.ImportContractTermForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionImportContractTermResponse; -import com.chargebee.v4.models.subscription.responses.OverrideBillingProfileForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionOverrideBillingProfileResponse; -import com.chargebee.v4.models.subscription.responses.RemoveScheduledPauseForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionRemoveScheduledPauseResponse; -import com.chargebee.v4.models.subscription.responses.EditAdvanceInvoiceScheduleForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionEditAdvanceInvoiceScheduleResponse; -import com.chargebee.v4.models.subscription.responses.DiscountsForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionListDiscountsResponse; import com.chargebee.v4.models.subscription.responses.ContractTermsForSubscriptionResponse; -import com.chargebee.v4.models.subscription.responses.PauseForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionPauseResponse; -import com.chargebee.v4.models.subscription.responses.ImportSubscriptionForCustomerResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionImportForCustomerResponse; import com.chargebee.v4.models.subscription.responses.ImportSubscriptionResponse; -import com.chargebee.v4.models.subscription.responses.CancelForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionCancelResponse; -import com.chargebee.v4.models.subscription.responses.ChargeAddonAtTermEndForSubscriptionResponse; +import com.chargebee.v4.models.subscription.responses.SubscriptionChargeAddonAtTermEndResponse; public final class SubscriptionService extends BaseService { @@ -180,11 +181,8 @@ public SubscriptionService withOptions(RequestOptions options) { // === Operations === - /** - * removeAdvanceInvoiceScheduleForSubscription a subscription (executes immediately) - returns raw - * Response. - */ - Response removeAdvanceInvoiceScheduleForSubscriptionRaw(String subscriptionId) throws Exception { + /** removeAdvanceInvoiceSchedule a subscription (executes immediately) - returns raw Response. */ + Response removeAdvanceInvoiceScheduleRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_advance_invoice_schedule", @@ -195,12 +193,12 @@ Response removeAdvanceInvoiceScheduleForSubscriptionRaw(String subscriptionId) t } /** - * removeAdvanceInvoiceScheduleForSubscription a subscription using immutable params (executes - * immediately) - returns raw Response. + * removeAdvanceInvoiceSchedule a subscription using immutable params (executes immediately) - + * returns raw Response. */ - Response removeAdvanceInvoiceScheduleForSubscriptionRaw( - String subscriptionId, RemoveAdvanceInvoiceScheduleForSubscriptionParams params) - throws Exception { + Response removeAdvanceInvoiceScheduleRaw( + String subscriptionId, SubscriptionRemoveAdvanceInvoiceScheduleParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_advance_invoice_schedule", @@ -210,11 +208,11 @@ Response removeAdvanceInvoiceScheduleForSubscriptionRaw( } /** - * removeAdvanceInvoiceScheduleForSubscription a subscription using raw JSON payload (executes - * immediately) - returns raw Response. + * removeAdvanceInvoiceSchedule a subscription using raw JSON payload (executes immediately) - + * returns raw Response. */ - Response removeAdvanceInvoiceScheduleForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response removeAdvanceInvoiceScheduleRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_advance_invoice_schedule", @@ -223,17 +221,16 @@ Response removeAdvanceInvoiceScheduleForSubscriptionRaw(String subscriptionId, S return postJson(path, jsonPayload); } - public RemoveAdvanceInvoiceScheduleForSubscriptionResponse - removeAdvanceInvoiceScheduleForSubscription( - String subscriptionId, RemoveAdvanceInvoiceScheduleForSubscriptionParams params) - throws Exception { - Response response = removeAdvanceInvoiceScheduleForSubscriptionRaw(subscriptionId, params); - return RemoveAdvanceInvoiceScheduleForSubscriptionResponse.fromJson( + public SubscriptionRemoveAdvanceInvoiceScheduleResponse removeAdvanceInvoiceSchedule( + String subscriptionId, SubscriptionRemoveAdvanceInvoiceScheduleParams params) + throws ChargebeeException { + Response response = removeAdvanceInvoiceScheduleRaw(subscriptionId, params); + return SubscriptionRemoveAdvanceInvoiceScheduleResponse.fromJson( response.getBodyAsString(), response); } - /** updateForItemsForSubscription a subscription (executes immediately) - returns raw Response. */ - Response updateForItemsForSubscriptionRaw(String subscriptionId) throws Exception { + /** updateForItems a subscription (executes immediately) - returns raw Response. */ + Response updateForItemsRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/update_for_items", "subscription-id", subscriptionId); @@ -242,11 +239,11 @@ Response updateForItemsForSubscriptionRaw(String subscriptionId) throws Exceptio } /** - * updateForItemsForSubscription a subscription using immutable params (executes immediately) - - * returns raw Response. + * updateForItems a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response updateForItemsForSubscriptionRaw( - String subscriptionId, UpdateForItemsForSubscriptionParams params) throws Exception { + Response updateForItemsRaw(String subscriptionId, SubscriptionUpdateForItemsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/update_for_items", "subscription-id", subscriptionId); @@ -254,25 +251,24 @@ Response updateForItemsForSubscriptionRaw( } /** - * updateForItemsForSubscription a subscription using raw JSON payload (executes immediately) - - * returns raw Response. + * updateForItems a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response updateForItemsForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response updateForItemsRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/update_for_items", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public UpdateForItemsForSubscriptionResponse updateForItemsForSubscription( - String subscriptionId, UpdateForItemsForSubscriptionParams params) throws Exception { - Response response = updateForItemsForSubscriptionRaw(subscriptionId, params); - return UpdateForItemsForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionUpdateForItemsResponse updateForItems( + String subscriptionId, SubscriptionUpdateForItemsParams params) throws ChargebeeException { + Response response = updateForItemsRaw(subscriptionId, params); + return SubscriptionUpdateForItemsResponse.fromJson(response.getBodyAsString(), response); } - /** removeCouponsForSubscription a subscription (executes immediately) - returns raw Response. */ - Response removeCouponsForSubscriptionRaw(String subscriptionId) throws Exception { + /** removeCoupons a subscription (executes immediately) - returns raw Response. */ + Response removeCouponsRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_coupons", "subscription-id", subscriptionId); @@ -281,11 +277,11 @@ Response removeCouponsForSubscriptionRaw(String subscriptionId) throws Exception } /** - * removeCouponsForSubscription a subscription using immutable params (executes immediately) - - * returns raw Response. + * removeCoupons a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response removeCouponsForSubscriptionRaw( - String subscriptionId, RemoveCouponsForSubscriptionParams params) throws Exception { + Response removeCouponsRaw(String subscriptionId, SubscriptionRemoveCouponsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_coupons", "subscription-id", subscriptionId); @@ -293,25 +289,24 @@ Response removeCouponsForSubscriptionRaw( } /** - * removeCouponsForSubscription a subscription using raw JSON payload (executes immediately) - - * returns raw Response. + * removeCoupons a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response removeCouponsForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response removeCouponsRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_coupons", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public RemoveCouponsForSubscriptionResponse removeCouponsForSubscription( - String subscriptionId, RemoveCouponsForSubscriptionParams params) throws Exception { - Response response = removeCouponsForSubscriptionRaw(subscriptionId, params); - return RemoveCouponsForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionRemoveCouponsResponse removeCoupons( + String subscriptionId, SubscriptionRemoveCouponsParams params) throws ChargebeeException { + Response response = removeCouponsRaw(subscriptionId, params); + return SubscriptionRemoveCouponsResponse.fromJson(response.getBodyAsString(), response); } - /** resumeForSubscription a subscription (executes immediately) - returns raw Response. */ - Response resumeForSubscriptionRaw(String subscriptionId) throws Exception { + /** resume a subscription (executes immediately) - returns raw Response. */ + Response resumeRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/resume", "subscription-id", subscriptionId); @@ -319,37 +314,31 @@ Response resumeForSubscriptionRaw(String subscriptionId) throws Exception { return post(path, null); } - /** - * resumeForSubscription a subscription using immutable params (executes immediately) - returns - * raw Response. - */ - Response resumeForSubscriptionRaw(String subscriptionId, ResumeForSubscriptionParams params) - throws Exception { + /** resume a subscription using immutable params (executes immediately) - returns raw Response. */ + Response resumeRaw(String subscriptionId, SubscriptionResumeParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/resume", "subscription-id", subscriptionId); return post(path, params.toFormData()); } - /** - * resumeForSubscription a subscription using raw JSON payload (executes immediately) - returns - * raw Response. - */ - Response resumeForSubscriptionRaw(String subscriptionId, String jsonPayload) throws Exception { + /** resume a subscription using raw JSON payload (executes immediately) - returns raw Response. */ + Response resumeRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/resume", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public ResumeForSubscriptionResponse resumeForSubscription( - String subscriptionId, ResumeForSubscriptionParams params) throws Exception { - Response response = resumeForSubscriptionRaw(subscriptionId, params); - return ResumeForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionResumeResponse resume(String subscriptionId, SubscriptionResumeParams params) + throws ChargebeeException { + Response response = resumeRaw(subscriptionId, params); + return SubscriptionResumeResponse.fromJson(response.getBodyAsString(), response); } - /** cancelForItemsForSubscription a subscription (executes immediately) - returns raw Response. */ - Response cancelForItemsForSubscriptionRaw(String subscriptionId) throws Exception { + /** cancelForItems a subscription (executes immediately) - returns raw Response. */ + Response cancelForItemsRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_for_items", "subscription-id", subscriptionId); @@ -358,11 +347,11 @@ Response cancelForItemsForSubscriptionRaw(String subscriptionId) throws Exceptio } /** - * cancelForItemsForSubscription a subscription using immutable params (executes immediately) - - * returns raw Response. + * cancelForItems a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response cancelForItemsForSubscriptionRaw( - String subscriptionId, CancelForItemsForSubscriptionParams params) throws Exception { + Response cancelForItemsRaw(String subscriptionId, SubscriptionCancelForItemsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_for_items", "subscription-id", subscriptionId); @@ -370,27 +359,24 @@ Response cancelForItemsForSubscriptionRaw( } /** - * cancelForItemsForSubscription a subscription using raw JSON payload (executes immediately) - - * returns raw Response. + * cancelForItems a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response cancelForItemsForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response cancelForItemsRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_for_items", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public CancelForItemsForSubscriptionResponse cancelForItemsForSubscription( - String subscriptionId, CancelForItemsForSubscriptionParams params) throws Exception { - Response response = cancelForItemsForSubscriptionRaw(subscriptionId, params); - return CancelForItemsForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionCancelForItemsResponse cancelForItems( + String subscriptionId, SubscriptionCancelForItemsParams params) throws ChargebeeException { + Response response = cancelForItemsRaw(subscriptionId, params); + return SubscriptionCancelForItemsResponse.fromJson(response.getBodyAsString(), response); } - /** - * regenerateInvoiceForSubscription a subscription (executes immediately) - returns raw Response. - */ - Response regenerateInvoiceForSubscriptionRaw(String subscriptionId) throws Exception { + /** regenerateInvoice a subscription (executes immediately) - returns raw Response. */ + Response regenerateInvoiceRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/regenerate_invoice", @@ -401,11 +387,11 @@ Response regenerateInvoiceForSubscriptionRaw(String subscriptionId) throws Excep } /** - * regenerateInvoiceForSubscription a subscription using immutable params (executes immediately) - - * returns raw Response. + * regenerateInvoice a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response regenerateInvoiceForSubscriptionRaw( - String subscriptionId, RegenerateInvoiceForSubscriptionParams params) throws Exception { + Response regenerateInvoiceRaw(String subscriptionId, SubscriptionRegenerateInvoiceParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/regenerate_invoice", @@ -415,11 +401,11 @@ Response regenerateInvoiceForSubscriptionRaw( } /** - * regenerateInvoiceForSubscription a subscription using raw JSON payload (executes immediately) - - * returns raw Response. + * regenerateInvoice a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response regenerateInvoiceForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response regenerateInvoiceRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/regenerate_invoice", @@ -428,61 +414,62 @@ Response regenerateInvoiceForSubscriptionRaw(String subscriptionId, String jsonP return postJson(path, jsonPayload); } - public RegenerateInvoiceForSubscriptionResponse regenerateInvoiceForSubscription( - String subscriptionId, RegenerateInvoiceForSubscriptionParams params) throws Exception { - Response response = regenerateInvoiceForSubscriptionRaw(subscriptionId, params); - return RegenerateInvoiceForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionRegenerateInvoiceResponse regenerateInvoice( + String subscriptionId, SubscriptionRegenerateInvoiceParams params) throws ChargebeeException { + Response response = regenerateInvoiceRaw(subscriptionId, params); + return SubscriptionRegenerateInvoiceResponse.fromJson(response.getBodyAsString(), response); } /** list a subscription using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(SubscriptionListParams params) throws Exception { + Response listRaw(SubscriptionListParams params) throws ChargebeeException { return get("/subscriptions", params != null ? params.toQueryParams() : null); } /** list a subscription without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/subscriptions", null); } /** list a subscription using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public SubscriptionListResponse list(SubscriptionListParams params) throws Exception { + public SubscriptionListResponse list(SubscriptionListParams params) throws ChargebeeException { Response response = listRaw(params); return SubscriptionListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public SubscriptionListResponse list() throws Exception { + public SubscriptionListResponse list() throws ChargebeeException { Response response = listRaw(); return SubscriptionListResponse.fromJson(response.getBodyAsString(), this, null, response); } /** create a subscription using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(SubscriptionCreateParams params) throws Exception { + Response createRaw(SubscriptionCreateParams params) throws ChargebeeException { return post("/subscriptions", params != null ? params.toFormData() : null); } /** create a subscription using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/subscriptions", jsonPayload); } - public SubscriptionCreateResponse create(SubscriptionCreateParams params) throws Exception { + public SubscriptionCreateResponse create(SubscriptionCreateParams params) + throws ChargebeeException { Response response = createRaw(params); return SubscriptionCreateResponse.fromJson(response.getBodyAsString(), response); } - /** moveForSubscription a subscription (executes immediately) - returns raw Response. */ - Response moveForSubscriptionRaw(String subscriptionId) throws Exception { + /** move a subscription (executes immediately) - returns raw Response. */ + Response moveRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/move", "subscription-id", subscriptionId); @@ -490,33 +477,26 @@ Response moveForSubscriptionRaw(String subscriptionId) throws Exception { return post(path, null); } - /** - * moveForSubscription a subscription using immutable params (executes immediately) - returns raw - * Response. - */ - Response moveForSubscriptionRaw(String subscriptionId, MoveForSubscriptionParams params) - throws Exception { + /** move a subscription using immutable params (executes immediately) - returns raw Response. */ + Response moveRaw(String subscriptionId, SubscriptionMoveParams params) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/move", "subscription-id", subscriptionId); return post(path, params.toFormData()); } - /** - * moveForSubscription a subscription using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response moveForSubscriptionRaw(String subscriptionId, String jsonPayload) throws Exception { + /** move a subscription using raw JSON payload (executes immediately) - returns raw Response. */ + Response moveRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/move", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public MoveForSubscriptionResponse moveForSubscription( - String subscriptionId, MoveForSubscriptionParams params) throws Exception { - Response response = moveForSubscriptionRaw(subscriptionId, params); - return MoveForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionMoveResponse move(String subscriptionId, SubscriptionMoveParams params) + throws ChargebeeException { + Response response = moveRaw(subscriptionId, params); + return SubscriptionMoveResponse.fromJson(response.getBodyAsString(), response); } /** @@ -524,7 +504,7 @@ public MoveForSubscriptionResponse moveForSubscription( * raw Response. */ Response subscriptionsForCustomerRaw(String customerId, SubscriptionsForCustomerParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); return get(path, params != null ? params.toQueryParams() : null); @@ -534,7 +514,7 @@ Response subscriptionsForCustomerRaw(String customerId, SubscriptionsForCustomer * subscriptionsForCustomer a subscription without params (executes immediately) - returns raw * Response. */ - Response subscriptionsForCustomerRaw(String customerId) throws Exception { + Response subscriptionsForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); return get(path, null); @@ -544,28 +524,29 @@ Response subscriptionsForCustomerRaw(String customerId) throws Exception { * subscriptionsForCustomer a subscription using raw JSON payload (executes immediately) - returns * raw Response. */ - Response subscriptionsForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response subscriptionsForCustomerRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public SubscriptionsForCustomerResponse subscriptionsForCustomer( - String customerId, SubscriptionsForCustomerParams params) throws Exception { + String customerId, SubscriptionsForCustomerParams params) throws ChargebeeException { Response response = subscriptionsForCustomerRaw(customerId, params); return SubscriptionsForCustomerResponse.fromJson( response.getBodyAsString(), this, params, customerId, response); } public SubscriptionsForCustomerResponse subscriptionsForCustomer(String customerId) - throws Exception { + throws ChargebeeException { Response response = subscriptionsForCustomerRaw(customerId); return SubscriptionsForCustomerResponse.fromJson( response.getBodyAsString(), this, null, customerId, response); } - /** addSubscriptionForCustomer a subscription (executes immediately) - returns raw Response. */ - Response addSubscriptionForCustomerRaw(String customerId) throws Exception { + /** createForCustomer a subscription (executes immediately) - returns raw Response. */ + Response createForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); @@ -573,34 +554,34 @@ Response addSubscriptionForCustomerRaw(String customerId) throws Exception { } /** - * addSubscriptionForCustomer a subscription using immutable params (executes immediately) - - * returns raw Response. + * createForCustomer a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response addSubscriptionForCustomerRaw(String customerId, AddSubscriptionForCustomerParams params) - throws Exception { + Response createForCustomerRaw(String customerId, SubscriptionCreateForCustomerParams params) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); return post(path, params.toFormData()); } /** - * addSubscriptionForCustomer a subscription using raw JSON payload (executes immediately) - - * returns raw Response. + * createForCustomer a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response addSubscriptionForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response createForCustomerRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); return postJson(path, jsonPayload); } - public AddSubscriptionForCustomerResponse addSubscriptionForCustomer( - String customerId, AddSubscriptionForCustomerParams params) throws Exception { - Response response = addSubscriptionForCustomerRaw(customerId, params); - return AddSubscriptionForCustomerResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionCreateForCustomerResponse createForCustomer( + String customerId, SubscriptionCreateForCustomerParams params) throws ChargebeeException { + Response response = createForCustomerRaw(customerId, params); + return SubscriptionCreateForCustomerResponse.fromJson(response.getBodyAsString(), response); } - /** importForItemsForCustomer a subscription (executes immediately) - returns raw Response. */ - Response importForItemsForCustomerRaw(String customerId) throws Exception { + /** importForItems a subscription (executes immediately) - returns raw Response. */ + Response importForItemsRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/import_for_items", "customer-id", customerId); @@ -608,39 +589,36 @@ Response importForItemsForCustomerRaw(String customerId) throws Exception { } /** - * importForItemsForCustomer a subscription using immutable params (executes immediately) - - * returns raw Response. + * importForItems a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response importForItemsForCustomerRaw( - String customerId, SubscriptionImportForItemsForCustomerParams params) throws Exception { + Response importForItemsRaw(String customerId, SubscriptionImportForItemsParams params) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/import_for_items", "customer-id", customerId); return post(path, params.toFormData()); } /** - * importForItemsForCustomer a subscription using raw JSON payload (executes immediately) - - * returns raw Response. + * importForItems a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response importForItemsForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response importForItemsRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/import_for_items", "customer-id", customerId); return postJson(path, jsonPayload); } - public SubscriptionImportForItemsForCustomerResponse importForItemsForCustomer( - String customerId, SubscriptionImportForItemsForCustomerParams params) throws Exception { - Response response = importForItemsForCustomerRaw(customerId, params); - return SubscriptionImportForItemsForCustomerResponse.fromJson( - response.getBodyAsString(), response); + public SubscriptionImportForItemsResponse importForItems( + String customerId, SubscriptionImportForItemsParams params) throws ChargebeeException { + Response response = importForItemsRaw(customerId, params); + return SubscriptionImportForItemsResponse.fromJson(response.getBodyAsString(), response); } /** - * retrieveAdvanceInvoiceScheduleForSubscription a subscription (executes immediately) - returns - * raw Response. + * retrieveAdvanceInvoiceSchedule a subscription (executes immediately) - returns raw Response. */ - Response retrieveAdvanceInvoiceScheduleForSubscriptionRaw(String subscriptionId) - throws Exception { + Response retrieveAdvanceInvoiceScheduleRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/retrieve_advance_invoice_schedule", @@ -650,18 +628,15 @@ Response retrieveAdvanceInvoiceScheduleForSubscriptionRaw(String subscriptionId) return get(path, null); } - public RetrieveAdvanceInvoiceScheduleForSubscriptionResponse - retrieveAdvanceInvoiceScheduleForSubscription(String subscriptionId) throws Exception { - Response response = retrieveAdvanceInvoiceScheduleForSubscriptionRaw(subscriptionId); - return RetrieveAdvanceInvoiceScheduleForSubscriptionResponse.fromJson( + public SubscriptionRetrieveAdvanceInvoiceScheduleResponse retrieveAdvanceInvoiceSchedule( + String subscriptionId) throws ChargebeeException { + Response response = retrieveAdvanceInvoiceScheduleRaw(subscriptionId); + return SubscriptionRetrieveAdvanceInvoiceScheduleResponse.fromJson( response.getBodyAsString(), response); } - /** - * removeScheduledCancellationForSubscription a subscription (executes immediately) - returns raw - * Response. - */ - Response removeScheduledCancellationForSubscriptionRaw(String subscriptionId) throws Exception { + /** removeScheduledCancellation a subscription (executes immediately) - returns raw Response. */ + Response removeScheduledCancellationRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_scheduled_cancellation", @@ -672,12 +647,12 @@ Response removeScheduledCancellationForSubscriptionRaw(String subscriptionId) th } /** - * removeScheduledCancellationForSubscription a subscription using immutable params (executes - * immediately) - returns raw Response. + * removeScheduledCancellation a subscription using immutable params (executes immediately) - + * returns raw Response. */ - Response removeScheduledCancellationForSubscriptionRaw( - String subscriptionId, RemoveScheduledCancellationForSubscriptionParams params) - throws Exception { + Response removeScheduledCancellationRaw( + String subscriptionId, SubscriptionRemoveScheduledCancellationParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_scheduled_cancellation", @@ -687,11 +662,11 @@ Response removeScheduledCancellationForSubscriptionRaw( } /** - * removeScheduledCancellationForSubscription a subscription using raw JSON payload (executes - * immediately) - returns raw Response. + * removeScheduledCancellation a subscription using raw JSON payload (executes immediately) - + * returns raw Response. */ - Response removeScheduledCancellationForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response removeScheduledCancellationRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_scheduled_cancellation", @@ -700,20 +675,16 @@ Response removeScheduledCancellationForSubscriptionRaw(String subscriptionId, St return postJson(path, jsonPayload); } - public RemoveScheduledCancellationForSubscriptionResponse - removeScheduledCancellationForSubscription( - String subscriptionId, RemoveScheduledCancellationForSubscriptionParams params) - throws Exception { - Response response = removeScheduledCancellationForSubscriptionRaw(subscriptionId, params); - return RemoveScheduledCancellationForSubscriptionResponse.fromJson( + public SubscriptionRemoveScheduledCancellationResponse removeScheduledCancellation( + String subscriptionId, SubscriptionRemoveScheduledCancellationParams params) + throws ChargebeeException { + Response response = removeScheduledCancellationRaw(subscriptionId, params); + return SubscriptionRemoveScheduledCancellationResponse.fromJson( response.getBodyAsString(), response); } - /** - * retrieveWithScheduledChangesForSubscription a subscription (executes immediately) - returns raw - * Response. - */ - Response retrieveWithScheduledChangesForSubscriptionRaw(String subscriptionId) throws Exception { + /** retrieveWithScheduledChanges a subscription (executes immediately) - returns raw Response. */ + Response retrieveWithScheduledChangesRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/retrieve_with_scheduled_changes", @@ -723,15 +694,15 @@ Response retrieveWithScheduledChangesForSubscriptionRaw(String subscriptionId) t return get(path, null); } - public RetrieveWithScheduledChangesForSubscriptionResponse - retrieveWithScheduledChangesForSubscription(String subscriptionId) throws Exception { - Response response = retrieveWithScheduledChangesForSubscriptionRaw(subscriptionId); - return RetrieveWithScheduledChangesForSubscriptionResponse.fromJson( + public SubscriptionRetrieveWithScheduledChangesResponse retrieveWithScheduledChanges( + String subscriptionId) throws ChargebeeException { + Response response = retrieveWithScheduledChangesRaw(subscriptionId); + return SubscriptionRetrieveWithScheduledChangesResponse.fromJson( response.getBodyAsString(), response); } - /** reactivateForSubscription a subscription (executes immediately) - returns raw Response. */ - Response reactivateForSubscriptionRaw(String subscriptionId) throws Exception { + /** reactivate a subscription (executes immediately) - returns raw Response. */ + Response reactivateRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/reactivate", "subscription-id", subscriptionId); @@ -740,11 +711,10 @@ Response reactivateForSubscriptionRaw(String subscriptionId) throws Exception { } /** - * reactivateForSubscription a subscription using immutable params (executes immediately) - - * returns raw Response. + * reactivate a subscription using immutable params (executes immediately) - returns raw Response. */ - Response reactivateForSubscriptionRaw( - String subscriptionId, ReactivateForSubscriptionParams params) throws Exception { + Response reactivateRaw(String subscriptionId, SubscriptionReactivateParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/reactivate", "subscription-id", subscriptionId); @@ -752,28 +722,23 @@ Response reactivateForSubscriptionRaw( } /** - * reactivateForSubscription a subscription using raw JSON payload (executes immediately) - - * returns raw Response. + * reactivate a subscription using raw JSON payload (executes immediately) - returns raw Response. */ - Response reactivateForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response reactivateRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/reactivate", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public ReactivateForSubscriptionResponse reactivateForSubscription( - String subscriptionId, ReactivateForSubscriptionParams params) throws Exception { - Response response = reactivateForSubscriptionRaw(subscriptionId, params); - return ReactivateForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionReactivateResponse reactivate( + String subscriptionId, SubscriptionReactivateParams params) throws ChargebeeException { + Response response = reactivateRaw(subscriptionId, params); + return SubscriptionReactivateResponse.fromJson(response.getBodyAsString(), response); } - /** - * chargeFutureRenewalsForSubscription a subscription (executes immediately) - returns raw - * Response. - */ - Response chargeFutureRenewalsForSubscriptionRaw(String subscriptionId) throws Exception { + /** chargeFutureRenewals a subscription (executes immediately) - returns raw Response. */ + Response chargeFutureRenewalsRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/charge_future_renewals", @@ -784,11 +749,12 @@ Response chargeFutureRenewalsForSubscriptionRaw(String subscriptionId) throws Ex } /** - * chargeFutureRenewalsForSubscription a subscription using immutable params (executes - * immediately) - returns raw Response. + * chargeFutureRenewals a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response chargeFutureRenewalsForSubscriptionRaw( - String subscriptionId, ChargeFutureRenewalsForSubscriptionParams params) throws Exception { + Response chargeFutureRenewalsRaw( + String subscriptionId, SubscriptionChargeFutureRenewalsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/charge_future_renewals", @@ -798,11 +764,11 @@ Response chargeFutureRenewalsForSubscriptionRaw( } /** - * chargeFutureRenewalsForSubscription a subscription using raw JSON payload (executes - * immediately) - returns raw Response. + * chargeFutureRenewals a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response chargeFutureRenewalsForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response chargeFutureRenewalsRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/charge_future_renewals", @@ -811,17 +777,15 @@ Response chargeFutureRenewalsForSubscriptionRaw(String subscriptionId, String js return postJson(path, jsonPayload); } - public ChargeFutureRenewalsForSubscriptionResponse chargeFutureRenewalsForSubscription( - String subscriptionId, ChargeFutureRenewalsForSubscriptionParams params) throws Exception { - Response response = chargeFutureRenewalsForSubscriptionRaw(subscriptionId, params); - return ChargeFutureRenewalsForSubscriptionResponse.fromJson( - response.getBodyAsString(), response); + public SubscriptionChargeFutureRenewalsResponse chargeFutureRenewals( + String subscriptionId, SubscriptionChargeFutureRenewalsParams params) + throws ChargebeeException { + Response response = chargeFutureRenewalsRaw(subscriptionId, params); + return SubscriptionChargeFutureRenewalsResponse.fromJson(response.getBodyAsString(), response); } - /** - * addChargeAtTermEndForSubscription a subscription (executes immediately) - returns raw Response. - */ - Response addChargeAtTermEndForSubscriptionRaw(String subscriptionId) throws Exception { + /** addChargeAtTermEnd a subscription (executes immediately) - returns raw Response. */ + Response addChargeAtTermEndRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/add_charge_at_term_end", @@ -832,11 +796,11 @@ Response addChargeAtTermEndForSubscriptionRaw(String subscriptionId) throws Exce } /** - * addChargeAtTermEndForSubscription a subscription using immutable params (executes immediately) - * - returns raw Response. + * addChargeAtTermEnd a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response addChargeAtTermEndForSubscriptionRaw( - String subscriptionId, AddChargeAtTermEndForSubscriptionParams params) throws Exception { + Response addChargeAtTermEndRaw(String subscriptionId, SubscriptionAddChargeAtTermEndParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/add_charge_at_term_end", @@ -846,11 +810,11 @@ Response addChargeAtTermEndForSubscriptionRaw( } /** - * addChargeAtTermEndForSubscription a subscription using raw JSON payload (executes immediately) - * - returns raw Response. + * addChargeAtTermEnd a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response addChargeAtTermEndForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response addChargeAtTermEndRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/add_charge_at_term_end", @@ -859,17 +823,15 @@ Response addChargeAtTermEndForSubscriptionRaw(String subscriptionId, String json return postJson(path, jsonPayload); } - public AddChargeAtTermEndForSubscriptionResponse addChargeAtTermEndForSubscription( - String subscriptionId, AddChargeAtTermEndForSubscriptionParams params) throws Exception { - Response response = addChargeAtTermEndForSubscriptionRaw(subscriptionId, params); - return AddChargeAtTermEndForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionAddChargeAtTermEndResponse addChargeAtTermEnd( + String subscriptionId, SubscriptionAddChargeAtTermEndParams params) + throws ChargebeeException { + Response response = addChargeAtTermEndRaw(subscriptionId, params); + return SubscriptionAddChargeAtTermEndResponse.fromJson(response.getBodyAsString(), response); } - /** - * removeScheduledChangesForSubscription a subscription (executes immediately) - returns raw - * Response. - */ - Response removeScheduledChangesForSubscriptionRaw(String subscriptionId) throws Exception { + /** removeScheduledChanges a subscription (executes immediately) - returns raw Response. */ + Response removeScheduledChangesRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_scheduled_changes", @@ -879,15 +841,15 @@ Response removeScheduledChangesForSubscriptionRaw(String subscriptionId) throws return post(path, null); } - public RemoveScheduledChangesForSubscriptionResponse removeScheduledChangesForSubscription( - String subscriptionId) throws Exception { - Response response = removeScheduledChangesForSubscriptionRaw(subscriptionId); - return RemoveScheduledChangesForSubscriptionResponse.fromJson( + public SubscriptionRemoveScheduledChangesResponse removeScheduledChanges(String subscriptionId) + throws ChargebeeException { + Response response = removeScheduledChangesRaw(subscriptionId); + return SubscriptionRemoveScheduledChangesResponse.fromJson( response.getBodyAsString(), response); } - /** changeTermEndForSubscription a subscription (executes immediately) - returns raw Response. */ - Response changeTermEndForSubscriptionRaw(String subscriptionId) throws Exception { + /** changeTermEnd a subscription (executes immediately) - returns raw Response. */ + Response changeTermEndRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/change_term_end", "subscription-id", subscriptionId); @@ -896,11 +858,11 @@ Response changeTermEndForSubscriptionRaw(String subscriptionId) throws Exception } /** - * changeTermEndForSubscription a subscription using immutable params (executes immediately) - - * returns raw Response. + * changeTermEnd a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response changeTermEndForSubscriptionRaw( - String subscriptionId, ChangeTermEndForSubscriptionParams params) throws Exception { + Response changeTermEndRaw(String subscriptionId, SubscriptionChangeTermEndParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/change_term_end", "subscription-id", subscriptionId); @@ -908,25 +870,24 @@ Response changeTermEndForSubscriptionRaw( } /** - * changeTermEndForSubscription a subscription using raw JSON payload (executes immediately) - - * returns raw Response. + * changeTermEnd a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response changeTermEndForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response changeTermEndRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/change_term_end", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public ChangeTermEndForSubscriptionResponse changeTermEndForSubscription( - String subscriptionId, ChangeTermEndForSubscriptionParams params) throws Exception { - Response response = changeTermEndForSubscriptionRaw(subscriptionId, params); - return ChangeTermEndForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionChangeTermEndResponse changeTermEnd( + String subscriptionId, SubscriptionChangeTermEndParams params) throws ChargebeeException { + Response response = changeTermEndRaw(subscriptionId, params); + return SubscriptionChangeTermEndResponse.fromJson(response.getBodyAsString(), response); } - /** deleteSubscription a subscription (executes immediately) - returns raw Response. */ - Response deleteSubscriptionRaw(String subscriptionId) throws Exception { + /** delete a subscription (executes immediately) - returns raw Response. */ + Response deleteRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/delete", "subscription-id", subscriptionId); @@ -934,15 +895,13 @@ Response deleteSubscriptionRaw(String subscriptionId) throws Exception { return post(path, null); } - public DeleteSubscriptionResponse deleteSubscription(String subscriptionId) throws Exception { - Response response = deleteSubscriptionRaw(subscriptionId); - return DeleteSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionDeleteResponse delete(String subscriptionId) throws ChargebeeException { + Response response = deleteRaw(subscriptionId); + return SubscriptionDeleteResponse.fromJson(response.getBodyAsString(), response); } - /** - * subscriptionForItemsForCustomer a subscription (executes immediately) - returns raw Response. - */ - Response subscriptionForItemsForCustomerRaw(String customerId) throws Exception { + /** createWithItems a subscription (executes immediately) - returns raw Response. */ + Response createWithItemsRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/subscription_for_items", "customer-id", customerId); @@ -951,11 +910,11 @@ Response subscriptionForItemsForCustomerRaw(String customerId) throws Exception } /** - * subscriptionForItemsForCustomer a subscription using immutable params (executes immediately) - - * returns raw Response. + * createWithItems a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response subscriptionForItemsForCustomerRaw( - String customerId, SubscriptionForItemsForCustomerParams params) throws Exception { + Response createWithItemsRaw(String customerId, SubscriptionCreateWithItemsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/subscription_for_items", "customer-id", customerId); @@ -963,28 +922,24 @@ Response subscriptionForItemsForCustomerRaw( } /** - * subscriptionForItemsForCustomer a subscription using raw JSON payload (executes immediately) - - * returns raw Response. + * createWithItems a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response subscriptionForItemsForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response createWithItemsRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/subscription_for_items", "customer-id", customerId); return postJson(path, jsonPayload); } - public SubscriptionForItemsForCustomerResponse subscriptionForItemsForCustomer( - String customerId, SubscriptionForItemsForCustomerParams params) throws Exception { - Response response = subscriptionForItemsForCustomerRaw(customerId, params); - return SubscriptionForItemsForCustomerResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionCreateWithItemsResponse createWithItems( + String customerId, SubscriptionCreateWithItemsParams params) throws ChargebeeException { + Response response = createWithItemsRaw(customerId, params); + return SubscriptionCreateWithItemsResponse.fromJson(response.getBodyAsString(), response); } - /** - * importUnbilledChargesForSubscription a subscription (executes immediately) - returns raw - * Response. - */ - Response importUnbilledChargesForSubscriptionRaw(String subscriptionId) throws Exception { + /** importUnbilledCharges a subscription (executes immediately) - returns raw Response. */ + Response importUnbilledChargesRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/import_unbilled_charges", @@ -995,11 +950,12 @@ Response importUnbilledChargesForSubscriptionRaw(String subscriptionId) throws E } /** - * importUnbilledChargesForSubscription a subscription using immutable params (executes - * immediately) - returns raw Response. + * importUnbilledCharges a subscription using immutable params (executes immediately) - returns + * raw Response. */ - Response importUnbilledChargesForSubscriptionRaw( - String subscriptionId, ImportUnbilledChargesForSubscriptionParams params) throws Exception { + Response importUnbilledChargesRaw( + String subscriptionId, SubscriptionImportUnbilledChargesParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/import_unbilled_charges", @@ -1009,11 +965,11 @@ Response importUnbilledChargesForSubscriptionRaw( } /** - * importUnbilledChargesForSubscription a subscription using raw JSON payload (executes - * immediately) - returns raw Response. + * importUnbilledCharges a subscription using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response importUnbilledChargesForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response importUnbilledChargesRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/import_unbilled_charges", @@ -1022,18 +978,15 @@ Response importUnbilledChargesForSubscriptionRaw(String subscriptionId, String j return postJson(path, jsonPayload); } - public ImportUnbilledChargesForSubscriptionResponse importUnbilledChargesForSubscription( - String subscriptionId, ImportUnbilledChargesForSubscriptionParams params) throws Exception { - Response response = importUnbilledChargesForSubscriptionRaw(subscriptionId, params); - return ImportUnbilledChargesForSubscriptionResponse.fromJson( - response.getBodyAsString(), response); + public SubscriptionImportUnbilledChargesResponse importUnbilledCharges( + String subscriptionId, SubscriptionImportUnbilledChargesParams params) + throws ChargebeeException { + Response response = importUnbilledChargesRaw(subscriptionId, params); + return SubscriptionImportUnbilledChargesResponse.fromJson(response.getBodyAsString(), response); } - /** - * removeScheduledResumptionForSubscription a subscription (executes immediately) - returns raw - * Response. - */ - Response removeScheduledResumptionForSubscriptionRaw(String subscriptionId) throws Exception { + /** removeScheduledResumption a subscription (executes immediately) - returns raw Response. */ + Response removeScheduledResumptionRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_scheduled_resumption", @@ -1043,28 +996,28 @@ Response removeScheduledResumptionForSubscriptionRaw(String subscriptionId) thro return post(path, null); } - public RemoveScheduledResumptionForSubscriptionResponse removeScheduledResumptionForSubscription( - String subscriptionId) throws Exception { - Response response = removeScheduledResumptionForSubscriptionRaw(subscriptionId); - return RemoveScheduledResumptionForSubscriptionResponse.fromJson( + public SubscriptionRemoveScheduledResumptionResponse removeScheduledResumption( + String subscriptionId) throws ChargebeeException { + Response response = removeScheduledResumptionRaw(subscriptionId); + return SubscriptionRemoveScheduledResumptionResponse.fromJson( response.getBodyAsString(), response); } /** retrieve a subscription (executes immediately) - returns raw Response. */ - Response retrieveRaw(String subscriptionId) throws Exception { + Response retrieveRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); return get(path, null); } - public SubscriptionRetrieveResponse retrieve(String subscriptionId) throws Exception { + public SubscriptionRetrieveResponse retrieve(String subscriptionId) throws ChargebeeException { Response response = retrieveRaw(subscriptionId); return SubscriptionRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a subscription (executes immediately) - returns raw Response. */ - Response updateRaw(String subscriptionId) throws Exception { + Response updateRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); @@ -1072,29 +1025,28 @@ Response updateRaw(String subscriptionId) throws Exception { } /** update a subscription using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String subscriptionId, SubscriptionUpdateParams params) throws Exception { + Response updateRaw(String subscriptionId, SubscriptionUpdateParams params) + throws ChargebeeException { String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); return post(path, params.toFormData()); } /** update a subscription using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String subscriptionId, String jsonPayload) throws Exception { + Response updateRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } public SubscriptionUpdateResponse update(String subscriptionId, SubscriptionUpdateParams params) - throws Exception { + throws ChargebeeException { Response response = updateRaw(subscriptionId, params); return SubscriptionUpdateResponse.fromJson(response.getBodyAsString(), response); } - /** - * importContractTermForSubscription a subscription (executes immediately) - returns raw Response. - */ - Response importContractTermForSubscriptionRaw(String subscriptionId) throws Exception { + /** importContractTerm a subscription (executes immediately) - returns raw Response. */ + Response importContractTermRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/import_contract_term", @@ -1105,11 +1057,11 @@ Response importContractTermForSubscriptionRaw(String subscriptionId) throws Exce } /** - * importContractTermForSubscription a subscription using immutable params (executes immediately) - * - returns raw Response. + * importContractTerm a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response importContractTermForSubscriptionRaw( - String subscriptionId, ImportContractTermForSubscriptionParams params) throws Exception { + Response importContractTermRaw(String subscriptionId, SubscriptionImportContractTermParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/import_contract_term", @@ -1119,11 +1071,11 @@ Response importContractTermForSubscriptionRaw( } /** - * importContractTermForSubscription a subscription using raw JSON payload (executes immediately) - * - returns raw Response. + * importContractTerm a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response importContractTermForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response importContractTermRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/import_contract_term", @@ -1132,17 +1084,15 @@ Response importContractTermForSubscriptionRaw(String subscriptionId, String json return postJson(path, jsonPayload); } - public ImportContractTermForSubscriptionResponse importContractTermForSubscription( - String subscriptionId, ImportContractTermForSubscriptionParams params) throws Exception { - Response response = importContractTermForSubscriptionRaw(subscriptionId, params); - return ImportContractTermForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionImportContractTermResponse importContractTerm( + String subscriptionId, SubscriptionImportContractTermParams params) + throws ChargebeeException { + Response response = importContractTermRaw(subscriptionId, params); + return SubscriptionImportContractTermResponse.fromJson(response.getBodyAsString(), response); } - /** - * overrideBillingProfileForSubscription a subscription (executes immediately) - returns raw - * Response. - */ - Response overrideBillingProfileForSubscriptionRaw(String subscriptionId) throws Exception { + /** overrideBillingProfile a subscription (executes immediately) - returns raw Response. */ + Response overrideBillingProfileRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/override_billing_profile", @@ -1153,11 +1103,12 @@ Response overrideBillingProfileForSubscriptionRaw(String subscriptionId) throws } /** - * overrideBillingProfileForSubscription a subscription using immutable params (executes - * immediately) - returns raw Response. + * overrideBillingProfile a subscription using immutable params (executes immediately) - returns + * raw Response. */ - Response overrideBillingProfileForSubscriptionRaw( - String subscriptionId, OverrideBillingProfileForSubscriptionParams params) throws Exception { + Response overrideBillingProfileRaw( + String subscriptionId, SubscriptionOverrideBillingProfileParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/override_billing_profile", @@ -1167,11 +1118,11 @@ Response overrideBillingProfileForSubscriptionRaw( } /** - * overrideBillingProfileForSubscription a subscription using raw JSON payload (executes - * immediately) - returns raw Response. + * overrideBillingProfile a subscription using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response overrideBillingProfileForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response overrideBillingProfileRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/override_billing_profile", @@ -1180,18 +1131,16 @@ Response overrideBillingProfileForSubscriptionRaw(String subscriptionId, String return postJson(path, jsonPayload); } - public OverrideBillingProfileForSubscriptionResponse overrideBillingProfileForSubscription( - String subscriptionId, OverrideBillingProfileForSubscriptionParams params) throws Exception { - Response response = overrideBillingProfileForSubscriptionRaw(subscriptionId, params); - return OverrideBillingProfileForSubscriptionResponse.fromJson( + public SubscriptionOverrideBillingProfileResponse overrideBillingProfile( + String subscriptionId, SubscriptionOverrideBillingProfileParams params) + throws ChargebeeException { + Response response = overrideBillingProfileRaw(subscriptionId, params); + return SubscriptionOverrideBillingProfileResponse.fromJson( response.getBodyAsString(), response); } - /** - * removeScheduledPauseForSubscription a subscription (executes immediately) - returns raw - * Response. - */ - Response removeScheduledPauseForSubscriptionRaw(String subscriptionId) throws Exception { + /** removeScheduledPause a subscription (executes immediately) - returns raw Response. */ + Response removeScheduledPauseRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_scheduled_pause", @@ -1201,18 +1150,14 @@ Response removeScheduledPauseForSubscriptionRaw(String subscriptionId) throws Ex return post(path, null); } - public RemoveScheduledPauseForSubscriptionResponse removeScheduledPauseForSubscription( - String subscriptionId) throws Exception { - Response response = removeScheduledPauseForSubscriptionRaw(subscriptionId); - return RemoveScheduledPauseForSubscriptionResponse.fromJson( - response.getBodyAsString(), response); + public SubscriptionRemoveScheduledPauseResponse removeScheduledPause(String subscriptionId) + throws ChargebeeException { + Response response = removeScheduledPauseRaw(subscriptionId); + return SubscriptionRemoveScheduledPauseResponse.fromJson(response.getBodyAsString(), response); } - /** - * editAdvanceInvoiceScheduleForSubscription a subscription (executes immediately) - returns raw - * Response. - */ - Response editAdvanceInvoiceScheduleForSubscriptionRaw(String subscriptionId) throws Exception { + /** editAdvanceInvoiceSchedule a subscription (executes immediately) - returns raw Response. */ + Response editAdvanceInvoiceScheduleRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/edit_advance_invoice_schedule", @@ -1223,12 +1168,12 @@ Response editAdvanceInvoiceScheduleForSubscriptionRaw(String subscriptionId) thr } /** - * editAdvanceInvoiceScheduleForSubscription a subscription using immutable params (executes - * immediately) - returns raw Response. + * editAdvanceInvoiceSchedule a subscription using immutable params (executes immediately) - + * returns raw Response. */ - Response editAdvanceInvoiceScheduleForSubscriptionRaw( - String subscriptionId, EditAdvanceInvoiceScheduleForSubscriptionParams params) - throws Exception { + Response editAdvanceInvoiceScheduleRaw( + String subscriptionId, SubscriptionEditAdvanceInvoiceScheduleParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/edit_advance_invoice_schedule", @@ -1238,11 +1183,11 @@ Response editAdvanceInvoiceScheduleForSubscriptionRaw( } /** - * editAdvanceInvoiceScheduleForSubscription a subscription using raw JSON payload (executes - * immediately) - returns raw Response. + * editAdvanceInvoiceSchedule a subscription using raw JSON payload (executes immediately) - + * returns raw Response. */ - Response editAdvanceInvoiceScheduleForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response editAdvanceInvoiceScheduleRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/edit_advance_invoice_schedule", @@ -1251,32 +1196,28 @@ Response editAdvanceInvoiceScheduleForSubscriptionRaw(String subscriptionId, Str return postJson(path, jsonPayload); } - public EditAdvanceInvoiceScheduleForSubscriptionResponse - editAdvanceInvoiceScheduleForSubscription( - String subscriptionId, EditAdvanceInvoiceScheduleForSubscriptionParams params) - throws Exception { - Response response = editAdvanceInvoiceScheduleForSubscriptionRaw(subscriptionId, params); - return EditAdvanceInvoiceScheduleForSubscriptionResponse.fromJson( + public SubscriptionEditAdvanceInvoiceScheduleResponse editAdvanceInvoiceSchedule( + String subscriptionId, SubscriptionEditAdvanceInvoiceScheduleParams params) + throws ChargebeeException { + Response response = editAdvanceInvoiceScheduleRaw(subscriptionId, params); + return SubscriptionEditAdvanceInvoiceScheduleResponse.fromJson( response.getBodyAsString(), response); } /** - * discountsForSubscription a subscription using immutable params (executes immediately) - returns - * raw Response. + * listDiscounts a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response discountsForSubscriptionRaw(String subscriptionId, DiscountsForSubscriptionParams params) - throws Exception { + Response listDiscountsRaw(String subscriptionId, SubscriptionListDiscountsParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/discounts", "subscription-id", subscriptionId); return get(path, params != null ? params.toQueryParams() : null); } - /** - * discountsForSubscription a subscription without params (executes immediately) - returns raw - * Response. - */ - Response discountsForSubscriptionRaw(String subscriptionId) throws Exception { + /** listDiscounts a subscription without params (executes immediately) - returns raw Response. */ + Response listDiscountsRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/discounts", "subscription-id", subscriptionId); @@ -1284,27 +1225,27 @@ Response discountsForSubscriptionRaw(String subscriptionId) throws Exception { } /** - * discountsForSubscription a subscription using raw JSON payload (executes immediately) - returns - * raw Response. + * listDiscounts a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response discountsForSubscriptionRaw(String subscriptionId, String jsonPayload) throws Exception { + Response listDiscountsRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/discounts", "subscription-id", subscriptionId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public DiscountsForSubscriptionResponse discountsForSubscription( - String subscriptionId, DiscountsForSubscriptionParams params) throws Exception { - Response response = discountsForSubscriptionRaw(subscriptionId, params); - return DiscountsForSubscriptionResponse.fromJson( + public SubscriptionListDiscountsResponse listDiscounts( + String subscriptionId, SubscriptionListDiscountsParams params) throws ChargebeeException { + Response response = listDiscountsRaw(subscriptionId, params); + return SubscriptionListDiscountsResponse.fromJson( response.getBodyAsString(), this, params, subscriptionId, response); } - public DiscountsForSubscriptionResponse discountsForSubscription(String subscriptionId) - throws Exception { - Response response = discountsForSubscriptionRaw(subscriptionId); - return DiscountsForSubscriptionResponse.fromJson( + public SubscriptionListDiscountsResponse listDiscounts(String subscriptionId) + throws ChargebeeException { + Response response = listDiscountsRaw(subscriptionId); + return SubscriptionListDiscountsResponse.fromJson( response.getBodyAsString(), this, null, subscriptionId, response); } @@ -1313,7 +1254,7 @@ public DiscountsForSubscriptionResponse discountsForSubscription(String subscrip * returns raw Response. */ Response contractTermsForSubscriptionRaw( - String subscriptionId, ContractTermsForSubscriptionParams params) throws Exception { + String subscriptionId, ContractTermsForSubscriptionParams params) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/contract_terms", "subscription-id", subscriptionId); @@ -1324,7 +1265,7 @@ Response contractTermsForSubscriptionRaw( * contractTermsForSubscription a subscription without params (executes immediately) - returns raw * Response. */ - Response contractTermsForSubscriptionRaw(String subscriptionId) throws Exception { + Response contractTermsForSubscriptionRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/contract_terms", "subscription-id", subscriptionId); @@ -1336,7 +1277,7 @@ Response contractTermsForSubscriptionRaw(String subscriptionId) throws Exception * returns raw Response. */ Response contractTermsForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/contract_terms", "subscription-id", subscriptionId); @@ -1344,21 +1285,21 @@ Response contractTermsForSubscriptionRaw(String subscriptionId, String jsonPaylo } public ContractTermsForSubscriptionResponse contractTermsForSubscription( - String subscriptionId, ContractTermsForSubscriptionParams params) throws Exception { + String subscriptionId, ContractTermsForSubscriptionParams params) throws ChargebeeException { Response response = contractTermsForSubscriptionRaw(subscriptionId, params); return ContractTermsForSubscriptionResponse.fromJson( response.getBodyAsString(), this, params, subscriptionId, response); } public ContractTermsForSubscriptionResponse contractTermsForSubscription(String subscriptionId) - throws Exception { + throws ChargebeeException { Response response = contractTermsForSubscriptionRaw(subscriptionId); return ContractTermsForSubscriptionResponse.fromJson( response.getBodyAsString(), this, null, subscriptionId, response); } - /** pauseForSubscription a subscription (executes immediately) - returns raw Response. */ - Response pauseForSubscriptionRaw(String subscriptionId) throws Exception { + /** pause a subscription (executes immediately) - returns raw Response. */ + Response pauseRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/pause", "subscription-id", subscriptionId); @@ -1366,37 +1307,31 @@ Response pauseForSubscriptionRaw(String subscriptionId) throws Exception { return post(path, null); } - /** - * pauseForSubscription a subscription using immutable params (executes immediately) - returns raw - * Response. - */ - Response pauseForSubscriptionRaw(String subscriptionId, PauseForSubscriptionParams params) - throws Exception { + /** pause a subscription using immutable params (executes immediately) - returns raw Response. */ + Response pauseRaw(String subscriptionId, SubscriptionPauseParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/pause", "subscription-id", subscriptionId); return post(path, params.toFormData()); } - /** - * pauseForSubscription a subscription using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response pauseForSubscriptionRaw(String subscriptionId, String jsonPayload) throws Exception { + /** pause a subscription using raw JSON payload (executes immediately) - returns raw Response. */ + Response pauseRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/pause", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public PauseForSubscriptionResponse pauseForSubscription( - String subscriptionId, PauseForSubscriptionParams params) throws Exception { - Response response = pauseForSubscriptionRaw(subscriptionId, params); - return PauseForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionPauseResponse pause(String subscriptionId, SubscriptionPauseParams params) + throws ChargebeeException { + Response response = pauseRaw(subscriptionId, params); + return SubscriptionPauseResponse.fromJson(response.getBodyAsString(), response); } - /** importSubscriptionForCustomer a subscription (executes immediately) - returns raw Response. */ - Response importSubscriptionForCustomerRaw(String customerId) throws Exception { + /** importForCustomer a subscription (executes immediately) - returns raw Response. */ + Response importForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/import_subscription", "customer-id", customerId); @@ -1405,11 +1340,11 @@ Response importSubscriptionForCustomerRaw(String customerId) throws Exception { } /** - * importSubscriptionForCustomer a subscription using immutable params (executes immediately) - - * returns raw Response. + * importForCustomer a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response importSubscriptionForCustomerRaw( - String customerId, ImportSubscriptionForCustomerParams params) throws Exception { + Response importForCustomerRaw(String customerId, SubscriptionImportForCustomerParams params) + throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/import_subscription", "customer-id", customerId); @@ -1417,28 +1352,27 @@ Response importSubscriptionForCustomerRaw( } /** - * importSubscriptionForCustomer a subscription using raw JSON payload (executes immediately) - - * returns raw Response. + * importForCustomer a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response importSubscriptionForCustomerRaw(String customerId, String jsonPayload) - throws Exception { + Response importForCustomerRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/customers/{customer-id}/import_subscription", "customer-id", customerId); return postJson(path, jsonPayload); } - public ImportSubscriptionForCustomerResponse importSubscriptionForCustomer( - String customerId, ImportSubscriptionForCustomerParams params) throws Exception { - Response response = importSubscriptionForCustomerRaw(customerId, params); - return ImportSubscriptionForCustomerResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionImportForCustomerResponse importForCustomer( + String customerId, SubscriptionImportForCustomerParams params) throws ChargebeeException { + Response response = importForCustomerRaw(customerId, params); + return SubscriptionImportForCustomerResponse.fromJson(response.getBodyAsString(), response); } /** * importSubscription a subscription using immutable params (executes immediately) - returns raw * Response. */ - Response importSubscriptionRaw(ImportSubscriptionParams params) throws Exception { + Response importSubscriptionRaw(ImportSubscriptionParams params) throws ChargebeeException { return post("/subscriptions/import_subscription", params != null ? params.toFormData() : null); } @@ -1447,20 +1381,20 @@ Response importSubscriptionRaw(ImportSubscriptionParams params) throws Exception * importSubscription a subscription using raw JSON payload (executes immediately) - returns raw * Response. */ - Response importSubscriptionRaw(String jsonPayload) throws Exception { + Response importSubscriptionRaw(String jsonPayload) throws ChargebeeException { return postJson("/subscriptions/import_subscription", jsonPayload); } public ImportSubscriptionResponse importSubscription(ImportSubscriptionParams params) - throws Exception { + throws ChargebeeException { Response response = importSubscriptionRaw(params); return ImportSubscriptionResponse.fromJson(response.getBodyAsString(), response); } - /** cancelForSubscription a subscription (executes immediately) - returns raw Response. */ - Response cancelForSubscriptionRaw(String subscriptionId) throws Exception { + /** cancel a subscription (executes immediately) - returns raw Response. */ + Response cancelRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel", "subscription-id", subscriptionId); @@ -1468,40 +1402,31 @@ Response cancelForSubscriptionRaw(String subscriptionId) throws Exception { return post(path, null); } - /** - * cancelForSubscription a subscription using immutable params (executes immediately) - returns - * raw Response. - */ - Response cancelForSubscriptionRaw(String subscriptionId, CancelForSubscriptionParams params) - throws Exception { + /** cancel a subscription using immutable params (executes immediately) - returns raw Response. */ + Response cancelRaw(String subscriptionId, SubscriptionCancelParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel", "subscription-id", subscriptionId); return post(path, params.toFormData()); } - /** - * cancelForSubscription a subscription using raw JSON payload (executes immediately) - returns - * raw Response. - */ - Response cancelForSubscriptionRaw(String subscriptionId, String jsonPayload) throws Exception { + /** cancel a subscription using raw JSON payload (executes immediately) - returns raw Response. */ + Response cancelRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public CancelForSubscriptionResponse cancelForSubscription( - String subscriptionId, CancelForSubscriptionParams params) throws Exception { - Response response = cancelForSubscriptionRaw(subscriptionId, params); - return CancelForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public SubscriptionCancelResponse cancel(String subscriptionId, SubscriptionCancelParams params) + throws ChargebeeException { + Response response = cancelRaw(subscriptionId, params); + return SubscriptionCancelResponse.fromJson(response.getBodyAsString(), response); } - /** - * chargeAddonAtTermEndForSubscription a subscription (executes immediately) - returns raw - * Response. - */ - Response chargeAddonAtTermEndForSubscriptionRaw(String subscriptionId) throws Exception { + /** chargeAddonAtTermEnd a subscription (executes immediately) - returns raw Response. */ + Response chargeAddonAtTermEndRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/charge_addon_at_term_end", @@ -1512,11 +1437,12 @@ Response chargeAddonAtTermEndForSubscriptionRaw(String subscriptionId) throws Ex } /** - * chargeAddonAtTermEndForSubscription a subscription using immutable params (executes - * immediately) - returns raw Response. + * chargeAddonAtTermEnd a subscription using immutable params (executes immediately) - returns raw + * Response. */ - Response chargeAddonAtTermEndForSubscriptionRaw( - String subscriptionId, ChargeAddonAtTermEndForSubscriptionParams params) throws Exception { + Response chargeAddonAtTermEndRaw( + String subscriptionId, SubscriptionChargeAddonAtTermEndParams params) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/charge_addon_at_term_end", @@ -1526,11 +1452,11 @@ Response chargeAddonAtTermEndForSubscriptionRaw( } /** - * chargeAddonAtTermEndForSubscription a subscription using raw JSON payload (executes - * immediately) - returns raw Response. + * chargeAddonAtTermEnd a subscription using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response chargeAddonAtTermEndForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + Response chargeAddonAtTermEndRaw(String subscriptionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/charge_addon_at_term_end", @@ -1539,10 +1465,10 @@ Response chargeAddonAtTermEndForSubscriptionRaw(String subscriptionId, String js return postJson(path, jsonPayload); } - public ChargeAddonAtTermEndForSubscriptionResponse chargeAddonAtTermEndForSubscription( - String subscriptionId, ChargeAddonAtTermEndForSubscriptionParams params) throws Exception { - Response response = chargeAddonAtTermEndForSubscriptionRaw(subscriptionId, params); - return ChargeAddonAtTermEndForSubscriptionResponse.fromJson( - response.getBodyAsString(), response); + public SubscriptionChargeAddonAtTermEndResponse chargeAddonAtTermEnd( + String subscriptionId, SubscriptionChargeAddonAtTermEndParams params) + throws ChargebeeException { + Response response = chargeAddonAtTermEndRaw(subscriptionId, params); + return SubscriptionChargeAddonAtTermEndResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java b/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java index 93287810..1a002285 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.subscriptionSetting.params.RetrieveSubscriptionSettingParams; +import com.chargebee.v4.models.subscriptionSetting.params.SubscriptionSettingRetrieveParams; -import com.chargebee.v4.models.subscriptionSetting.responses.RetrieveSubscriptionSettingResponse; +import com.chargebee.v4.models.subscriptionSetting.responses.SubscriptionSettingRetrieveResponse; public final class SubscriptionSettingService extends BaseService { @@ -51,28 +52,27 @@ public SubscriptionSettingService withOptions(RequestOptions options) { // === Operations === /** - * retrieveSubscriptionSetting a subscriptionSetting using immutable params (executes immediately) - * - returns raw Response. + * retrieve a subscriptionSetting using immutable params (executes immediately) - returns raw + * Response. */ - Response retrieveSubscriptionSettingRaw(RetrieveSubscriptionSettingParams params) - throws Exception { + Response retrieveRaw(SubscriptionSettingRetrieveParams params) throws ChargebeeException { return get("/subscription_settings/retrieve", params != null ? params.toQueryParams() : null); } /** - * retrieveSubscriptionSetting a subscriptionSetting using raw JSON payload (executes immediately) - * - returns raw Response. + * retrieve a subscriptionSetting using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response retrieveSubscriptionSettingRaw(String jsonPayload) throws Exception { + Response retrieveRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public RetrieveSubscriptionSettingResponse retrieveSubscriptionSetting( - RetrieveSubscriptionSettingParams params) throws Exception { - Response response = retrieveSubscriptionSettingRaw(params); + public SubscriptionSettingRetrieveResponse retrieve(SubscriptionSettingRetrieveParams params) + throws ChargebeeException { + Response response = retrieveRaw(params); - return RetrieveSubscriptionSettingResponse.fromJson(response.getBodyAsString(), response); + return SubscriptionSettingRetrieveResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java b/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java index 8bbb68d9..46882176 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java @@ -9,19 +9,20 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.thirdPartyConfiguration.params.ThirdPartyConfigurationConfigurationsParams; -import com.chargebee.v4.models.thirdPartyConfiguration.params.ThirdPartyConfigurationExecuteParams; +import com.chargebee.v4.models.thirdPartyConfiguration.params.ThirdPartyConfigurationRetrieveParams; -import com.chargebee.v4.models.thirdPartyConfiguration.params.ThirdPartyConfigurationCreateParams; +import com.chargebee.v4.models.thirdPartyConfiguration.params.ThirdPartyConfigurationUpdateParams; import com.chargebee.v4.models.thirdPartyConfiguration.responses.ThirdPartyConfigurationConfigurationsResponse; -import com.chargebee.v4.models.thirdPartyConfiguration.responses.ThirdPartyConfigurationExecuteResponse; +import com.chargebee.v4.models.thirdPartyConfiguration.responses.ThirdPartyConfigurationRetrieveResponse; -import com.chargebee.v4.models.thirdPartyConfiguration.responses.ThirdPartyConfigurationCreateResponse; +import com.chargebee.v4.models.thirdPartyConfiguration.responses.ThirdPartyConfigurationUpdateResponse; public final class ThirdPartyConfigurationService extends BaseService { @@ -63,7 +64,8 @@ public ThirdPartyConfigurationService withOptions(RequestOptions options) { * configurations a thirdPartyConfiguration using immutable params (executes immediately) - * returns raw Response. */ - Response configurationsRaw(ThirdPartyConfigurationConfigurationsParams params) throws Exception { + Response configurationsRaw(ThirdPartyConfigurationConfigurationsParams params) + throws ChargebeeException { return get( "/third_party_configurations/configurations", @@ -74,13 +76,13 @@ Response configurationsRaw(ThirdPartyConfigurationConfigurationsParams params) t * configurations a thirdPartyConfiguration using raw JSON payload (executes immediately) - * returns raw Response. */ - Response configurationsRaw(String jsonPayload) throws Exception { + Response configurationsRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public ThirdPartyConfigurationConfigurationsResponse configurations( - ThirdPartyConfigurationConfigurationsParams params) throws Exception { + ThirdPartyConfigurationConfigurationsParams params) throws ChargebeeException { Response response = configurationsRaw(params); return ThirdPartyConfigurationConfigurationsResponse.fromJson( @@ -88,52 +90,52 @@ public ThirdPartyConfigurationConfigurationsResponse configurations( } /** - * execute a thirdPartyConfiguration using immutable params (executes immediately) - returns raw + * retrieve a thirdPartyConfiguration using immutable params (executes immediately) - returns raw * Response. */ - Response executeRaw(ThirdPartyConfigurationExecuteParams params) throws Exception { + Response retrieveRaw(ThirdPartyConfigurationRetrieveParams params) throws ChargebeeException { return get("/third_party_configurations", params != null ? params.toQueryParams() : null); } /** - * execute a thirdPartyConfiguration using raw JSON payload (executes immediately) - returns raw + * retrieve a thirdPartyConfiguration using raw JSON payload (executes immediately) - returns raw * Response. */ - Response executeRaw(String jsonPayload) throws Exception { + Response retrieveRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public ThirdPartyConfigurationExecuteResponse execute(ThirdPartyConfigurationExecuteParams params) - throws Exception { - Response response = executeRaw(params); + public ThirdPartyConfigurationRetrieveResponse retrieve( + ThirdPartyConfigurationRetrieveParams params) throws ChargebeeException { + Response response = retrieveRaw(params); - return ThirdPartyConfigurationExecuteResponse.fromJson(response.getBodyAsString(), response); + return ThirdPartyConfigurationRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** - * create a thirdPartyConfiguration using immutable params (executes immediately) - returns raw + * update a thirdPartyConfiguration using immutable params (executes immediately) - returns raw * Response. */ - Response createRaw(ThirdPartyConfigurationCreateParams params) throws Exception { + Response updateRaw(ThirdPartyConfigurationUpdateParams params) throws ChargebeeException { return post("/third_party_configurations", params != null ? params.toFormData() : null); } /** - * create a thirdPartyConfiguration using raw JSON payload (executes immediately) - returns raw + * update a thirdPartyConfiguration using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response updateRaw(String jsonPayload) throws ChargebeeException { return postJson("/third_party_configurations", jsonPayload); } - public ThirdPartyConfigurationCreateResponse create(ThirdPartyConfigurationCreateParams params) - throws Exception { - Response response = createRaw(params); + public ThirdPartyConfigurationUpdateResponse update(ThirdPartyConfigurationUpdateParams params) + throws ChargebeeException { + Response response = updateRaw(params); - return ThirdPartyConfigurationCreateResponse.fromJson(response.getBodyAsString(), response); + return ThirdPartyConfigurationUpdateResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java b/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java index dbe0572a..00824544 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java @@ -9,9 +9,10 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.thirdPartyEntityMapping.params.RetrieveThirdPartyEntityMappingParams; +import com.chargebee.v4.models.thirdPartyEntityMapping.params.ThirdPartyEntityMappingRetrieveEntityParams; import com.chargebee.v4.models.thirdPartyEntityMapping.params.ThirdPartyEntityMappingListAllParams; @@ -19,7 +20,7 @@ import com.chargebee.v4.models.thirdPartyEntityMapping.params.ThirdPartyEntityMappingListParams; -import com.chargebee.v4.models.thirdPartyEntityMapping.responses.RetrieveThirdPartyEntityMappingResponse; +import com.chargebee.v4.models.thirdPartyEntityMapping.responses.ThirdPartyEntityMappingRetrieveEntityResponse; import com.chargebee.v4.models.thirdPartyEntityMapping.responses.ThirdPartyEntityMappingListAllResponse; @@ -64,37 +65,38 @@ public ThirdPartyEntityMappingService withOptions(RequestOptions options) { // === Operations === /** - * retrieveThirdPartyEntityMapping a thirdPartyEntityMapping using immutable params (executes - * immediately) - returns raw Response. + * retrieveEntity a thirdPartyEntityMapping using immutable params (executes immediately) - + * returns raw Response. */ - Response retrieveThirdPartyEntityMappingRaw(RetrieveThirdPartyEntityMappingParams params) - throws Exception { + Response retrieveEntityRaw(ThirdPartyEntityMappingRetrieveEntityParams params) + throws ChargebeeException { return get( "/third_party_entity_mappings/retrieve", params != null ? params.toQueryParams() : null); } /** - * retrieveThirdPartyEntityMapping a thirdPartyEntityMapping using raw JSON payload (executes - * immediately) - returns raw Response. + * retrieveEntity a thirdPartyEntityMapping using raw JSON payload (executes immediately) - + * returns raw Response. */ - Response retrieveThirdPartyEntityMappingRaw(String jsonPayload) throws Exception { + Response retrieveEntityRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public RetrieveThirdPartyEntityMappingResponse retrieveThirdPartyEntityMapping( - RetrieveThirdPartyEntityMappingParams params) throws Exception { - Response response = retrieveThirdPartyEntityMappingRaw(params); + public ThirdPartyEntityMappingRetrieveEntityResponse retrieveEntity( + ThirdPartyEntityMappingRetrieveEntityParams params) throws ChargebeeException { + Response response = retrieveEntityRaw(params); - return RetrieveThirdPartyEntityMappingResponse.fromJson(response.getBodyAsString(), response); + return ThirdPartyEntityMappingRetrieveEntityResponse.fromJson( + response.getBodyAsString(), response); } /** * listAll a thirdPartyEntityMapping using immutable params (executes immediately) - returns raw * Response. */ - Response listAllRaw(ThirdPartyEntityMappingListAllParams params) throws Exception { + Response listAllRaw(ThirdPartyEntityMappingListAllParams params) throws ChargebeeException { return get( "/third_party_entity_mappings/list_all", params != null ? params.toQueryParams() : null); @@ -104,13 +106,13 @@ Response listAllRaw(ThirdPartyEntityMappingListAllParams params) throws Exceptio * listAll a thirdPartyEntityMapping using raw JSON payload (executes immediately) - returns raw * Response. */ - Response listAllRaw(String jsonPayload) throws Exception { + Response listAllRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public ThirdPartyEntityMappingListAllResponse listAll(ThirdPartyEntityMappingListAllParams params) - throws Exception { + throws ChargebeeException { Response response = listAllRaw(params); return ThirdPartyEntityMappingListAllResponse.fromJson(response.getBodyAsString(), response); @@ -120,7 +122,8 @@ public ThirdPartyEntityMappingListAllResponse listAll(ThirdPartyEntityMappingLis * updateEntity a thirdPartyEntityMapping using immutable params (executes immediately) - returns * raw Response. */ - Response updateEntityRaw(ThirdPartyEntityMappingUpdateEntityParams params) throws Exception { + Response updateEntityRaw(ThirdPartyEntityMappingUpdateEntityParams params) + throws ChargebeeException { return post( "/third_party_entity_mappings/update_entity", params != null ? params.toFormData() : null); @@ -130,13 +133,13 @@ Response updateEntityRaw(ThirdPartyEntityMappingUpdateEntityParams params) throw * updateEntity a thirdPartyEntityMapping using raw JSON payload (executes immediately) - returns * raw Response. */ - Response updateEntityRaw(String jsonPayload) throws Exception { + Response updateEntityRaw(String jsonPayload) throws ChargebeeException { return postJson("/third_party_entity_mappings/update_entity", jsonPayload); } public ThirdPartyEntityMappingUpdateEntityResponse updateEntity( - ThirdPartyEntityMappingUpdateEntityParams params) throws Exception { + ThirdPartyEntityMappingUpdateEntityParams params) throws ChargebeeException { Response response = updateEntityRaw(params); return ThirdPartyEntityMappingUpdateEntityResponse.fromJson( @@ -147,7 +150,7 @@ public ThirdPartyEntityMappingUpdateEntityResponse updateEntity( * list a thirdPartyEntityMapping using immutable params (executes immediately) - returns raw * Response. */ - Response listRaw(ThirdPartyEntityMappingListParams params) throws Exception { + Response listRaw(ThirdPartyEntityMappingListParams params) throws ChargebeeException { return get("/third_party_entity_mappings", params != null ? params.toQueryParams() : null); } @@ -155,7 +158,7 @@ Response listRaw(ThirdPartyEntityMappingListParams params) throws Exception { /** * list a thirdPartyEntityMapping without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/third_party_entity_mappings", null); } @@ -164,20 +167,20 @@ Response listRaw() throws Exception { * list a thirdPartyEntityMapping using raw JSON payload (executes immediately) - returns raw * Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public ThirdPartyEntityMappingListResponse list(ThirdPartyEntityMappingListParams params) - throws Exception { + throws ChargebeeException { Response response = listRaw(params); return ThirdPartyEntityMappingListResponse.fromJson( response.getBodyAsString(), this, params, response); } - public ThirdPartyEntityMappingListResponse list() throws Exception { + public ThirdPartyEntityMappingListResponse list() throws ChargebeeException { Response response = listRaw(); return ThirdPartyEntityMappingListResponse.fromJson( response.getBodyAsString(), this, null, response); diff --git a/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java b/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java index ab6534d5..ace525cb 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.thirdPartySyncDetail.params.ThirdPartySyncDetailUpdateParams; @@ -61,7 +62,7 @@ public ThirdPartySyncDetailService withOptions(RequestOptions options) { // === Operations === /** retrieve a thirdPartySyncDetail (executes immediately) - returns raw Response. */ - Response retrieveRaw(String tpIntegSyncDetailId) throws Exception { + Response retrieveRaw(String tpIntegSyncDetailId) throws ChargebeeException { String path = buildPathWithParams( "/third_party_sync_details/{tp-integ-sync-detail-id}", @@ -72,13 +73,13 @@ Response retrieveRaw(String tpIntegSyncDetailId) throws Exception { } public ThirdPartySyncDetailRetrieveResponse retrieve(String tpIntegSyncDetailId) - throws Exception { + throws ChargebeeException { Response response = retrieveRaw(tpIntegSyncDetailId); return ThirdPartySyncDetailRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a thirdPartySyncDetail (executes immediately) - returns raw Response. */ - Response updateRaw(String tpIntegSyncDetailId) throws Exception { + Response updateRaw(String tpIntegSyncDetailId) throws ChargebeeException { String path = buildPathWithParams( "/third_party_sync_details/{tp-integ-sync-detail-id}", @@ -93,7 +94,7 @@ Response updateRaw(String tpIntegSyncDetailId) throws Exception { * Response. */ Response updateRaw(String tpIntegSyncDetailId, ThirdPartySyncDetailUpdateParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/third_party_sync_details/{tp-integ-sync-detail-id}", @@ -106,7 +107,7 @@ Response updateRaw(String tpIntegSyncDetailId, ThirdPartySyncDetailUpdateParams * update a thirdPartySyncDetail using raw JSON payload (executes immediately) - returns raw * Response. */ - Response updateRaw(String tpIntegSyncDetailId, String jsonPayload) throws Exception { + Response updateRaw(String tpIntegSyncDetailId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/third_party_sync_details/{tp-integ-sync-detail-id}", @@ -116,7 +117,8 @@ Response updateRaw(String tpIntegSyncDetailId, String jsonPayload) throws Except } public ThirdPartySyncDetailUpdateResponse update( - String tpIntegSyncDetailId, ThirdPartySyncDetailUpdateParams params) throws Exception { + String tpIntegSyncDetailId, ThirdPartySyncDetailUpdateParams params) + throws ChargebeeException { Response response = updateRaw(tpIntegSyncDetailId, params); return ThirdPartySyncDetailUpdateResponse.fromJson(response.getBodyAsString(), response); } @@ -125,7 +127,7 @@ public ThirdPartySyncDetailUpdateResponse update( * create a thirdPartySyncDetail using immutable params (executes immediately) - returns raw * Response. */ - Response createRaw(ThirdPartySyncDetailCreateParams params) throws Exception { + Response createRaw(ThirdPartySyncDetailCreateParams params) throws ChargebeeException { return post("/third_party_sync_details", params != null ? params.toFormData() : null); } @@ -134,13 +136,13 @@ Response createRaw(ThirdPartySyncDetailCreateParams params) throws Exception { * create a thirdPartySyncDetail using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/third_party_sync_details", jsonPayload); } public ThirdPartySyncDetailCreateResponse create(ThirdPartySyncDetailCreateParams params) - throws Exception { + throws ChargebeeException { Response response = createRaw(params); return ThirdPartySyncDetailCreateResponse.fromJson(response.getBodyAsString(), response); @@ -151,7 +153,7 @@ public ThirdPartySyncDetailCreateResponse create(ThirdPartySyncDetailCreateParam * returns raw Response. */ Response retrieveLatestSyncRaw(ThirdPartySyncDetailRetrieveLatestSyncParams params) - throws Exception { + throws ChargebeeException { return get( "/third_party_sync_details/retrieve_latest_sync", @@ -162,13 +164,13 @@ Response retrieveLatestSyncRaw(ThirdPartySyncDetailRetrieveLatestSyncParams para * retrieveLatestSync a thirdPartySyncDetail using raw JSON payload (executes immediately) - * returns raw Response. */ - Response retrieveLatestSyncRaw(String jsonPayload) throws Exception { + Response retrieveLatestSyncRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public ThirdPartySyncDetailRetrieveLatestSyncResponse retrieveLatestSync( - ThirdPartySyncDetailRetrieveLatestSyncParams params) throws Exception { + ThirdPartySyncDetailRetrieveLatestSyncParams params) throws ChargebeeException { Response response = retrieveLatestSyncRaw(params); return ThirdPartySyncDetailRetrieveLatestSyncResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/TimeMachineService.java b/src/main/java/com/chargebee/v4/services/TimeMachineService.java index 227387e3..1deabbe4 100644 --- a/src/main/java/com/chargebee/v4/services/TimeMachineService.java +++ b/src/main/java/com/chargebee/v4/services/TimeMachineService.java @@ -9,17 +9,18 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.timeMachine.params.TravelForwardForTimeMachineParams; +import com.chargebee.v4.models.timeMachine.params.TimeMachineTravelForwardParams; -import com.chargebee.v4.models.timeMachine.params.StartAfreshForTimeMachineParams; +import com.chargebee.v4.models.timeMachine.params.TimeMachineStartAfreshParams; import com.chargebee.v4.models.timeMachine.responses.TimeMachineRetrieveResponse; -import com.chargebee.v4.models.timeMachine.responses.TravelForwardForTimeMachineResponse; +import com.chargebee.v4.models.timeMachine.responses.TimeMachineTravelForwardResponse; -import com.chargebee.v4.models.timeMachine.responses.StartAfreshForTimeMachineResponse; +import com.chargebee.v4.models.timeMachine.responses.TimeMachineStartAfreshResponse; public final class TimeMachineService extends BaseService { @@ -56,7 +57,7 @@ public TimeMachineService withOptions(RequestOptions options) { // === Operations === /** retrieve a timeMachine (executes immediately) - returns raw Response. */ - Response retrieveRaw(String timeMachineName) throws Exception { + Response retrieveRaw(String timeMachineName) throws ChargebeeException { String path = buildPathWithParams( "/time_machines/{time-machine-name}", "time-machine-name", timeMachineName); @@ -64,13 +65,13 @@ Response retrieveRaw(String timeMachineName) throws Exception { return get(path, null); } - public TimeMachineRetrieveResponse retrieve(String timeMachineName) throws Exception { + public TimeMachineRetrieveResponse retrieve(String timeMachineName) throws ChargebeeException { Response response = retrieveRaw(timeMachineName); return TimeMachineRetrieveResponse.fromJson(response.getBodyAsString(), response); } - /** travelForwardForTimeMachine a timeMachine (executes immediately) - returns raw Response. */ - Response travelForwardForTimeMachineRaw(String timeMachineName) throws Exception { + /** travelForward a timeMachine (executes immediately) - returns raw Response. */ + Response travelForwardRaw(String timeMachineName) throws ChargebeeException { String path = buildPathWithParams( "/time_machines/{time-machine-name}/travel_forward", @@ -81,11 +82,11 @@ Response travelForwardForTimeMachineRaw(String timeMachineName) throws Exception } /** - * travelForwardForTimeMachine a timeMachine using immutable params (executes immediately) - - * returns raw Response. + * travelForward a timeMachine using immutable params (executes immediately) - returns raw + * Response. */ - Response travelForwardForTimeMachineRaw( - String timeMachineName, TravelForwardForTimeMachineParams params) throws Exception { + Response travelForwardRaw(String timeMachineName, TimeMachineTravelForwardParams params) + throws ChargebeeException { String path = buildPathWithParams( "/time_machines/{time-machine-name}/travel_forward", @@ -95,11 +96,10 @@ Response travelForwardForTimeMachineRaw( } /** - * travelForwardForTimeMachine a timeMachine using raw JSON payload (executes immediately) - - * returns raw Response. + * travelForward a timeMachine using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response travelForwardForTimeMachineRaw(String timeMachineName, String jsonPayload) - throws Exception { + Response travelForwardRaw(String timeMachineName, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/time_machines/{time-machine-name}/travel_forward", @@ -108,14 +108,14 @@ Response travelForwardForTimeMachineRaw(String timeMachineName, String jsonPaylo return postJson(path, jsonPayload); } - public TravelForwardForTimeMachineResponse travelForwardForTimeMachine( - String timeMachineName, TravelForwardForTimeMachineParams params) throws Exception { - Response response = travelForwardForTimeMachineRaw(timeMachineName, params); - return TravelForwardForTimeMachineResponse.fromJson(response.getBodyAsString(), response); + public TimeMachineTravelForwardResponse travelForward( + String timeMachineName, TimeMachineTravelForwardParams params) throws ChargebeeException { + Response response = travelForwardRaw(timeMachineName, params); + return TimeMachineTravelForwardResponse.fromJson(response.getBodyAsString(), response); } - /** startAfreshForTimeMachine a timeMachine (executes immediately) - returns raw Response. */ - Response startAfreshForTimeMachineRaw(String timeMachineName) throws Exception { + /** startAfresh a timeMachine (executes immediately) - returns raw Response. */ + Response startAfreshRaw(String timeMachineName) throws ChargebeeException { String path = buildPathWithParams( "/time_machines/{time-machine-name}/start_afresh", @@ -126,11 +126,10 @@ Response startAfreshForTimeMachineRaw(String timeMachineName) throws Exception { } /** - * startAfreshForTimeMachine a timeMachine using immutable params (executes immediately) - returns - * raw Response. + * startAfresh a timeMachine using immutable params (executes immediately) - returns raw Response. */ - Response startAfreshForTimeMachineRaw( - String timeMachineName, StartAfreshForTimeMachineParams params) throws Exception { + Response startAfreshRaw(String timeMachineName, TimeMachineStartAfreshParams params) + throws ChargebeeException { String path = buildPathWithParams( "/time_machines/{time-machine-name}/start_afresh", @@ -140,11 +139,9 @@ Response startAfreshForTimeMachineRaw( } /** - * startAfreshForTimeMachine a timeMachine using raw JSON payload (executes immediately) - returns - * raw Response. + * startAfresh a timeMachine using raw JSON payload (executes immediately) - returns raw Response. */ - Response startAfreshForTimeMachineRaw(String timeMachineName, String jsonPayload) - throws Exception { + Response startAfreshRaw(String timeMachineName, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/time_machines/{time-machine-name}/start_afresh", @@ -153,9 +150,9 @@ Response startAfreshForTimeMachineRaw(String timeMachineName, String jsonPayload return postJson(path, jsonPayload); } - public StartAfreshForTimeMachineResponse startAfreshForTimeMachine( - String timeMachineName, StartAfreshForTimeMachineParams params) throws Exception { - Response response = startAfreshForTimeMachineRaw(timeMachineName, params); - return StartAfreshForTimeMachineResponse.fromJson(response.getBodyAsString(), response); + public TimeMachineStartAfreshResponse startAfresh( + String timeMachineName, TimeMachineStartAfreshParams params) throws ChargebeeException { + Response response = startAfreshRaw(timeMachineName, params); + return TimeMachineStartAfreshResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/TpSiteUserService.java b/src/main/java/com/chargebee/v4/services/TpSiteUserService.java index 65aeaa32..03c77958 100644 --- a/src/main/java/com/chargebee/v4/services/TpSiteUserService.java +++ b/src/main/java/com/chargebee/v4/services/TpSiteUserService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.tpSiteUser.params.UsersForTpSiteUserParams; @@ -62,7 +63,7 @@ public TpSiteUserService withOptions(RequestOptions options) { * Response. */ Response usersForTpSiteUserRaw(String tpSiteUserDomain, UsersForTpSiteUserParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/users", "tp-site-user-domain", tpSiteUserDomain); @@ -72,7 +73,7 @@ Response usersForTpSiteUserRaw(String tpSiteUserDomain, UsersForTpSiteUserParams /** * usersForTpSiteUser a tpSiteUser without params (executes immediately) - returns raw Response. */ - Response usersForTpSiteUserRaw(String tpSiteUserDomain) throws Exception { + Response usersForTpSiteUserRaw(String tpSiteUserDomain) throws ChargebeeException { String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/users", "tp-site-user-domain", tpSiteUserDomain); @@ -83,7 +84,8 @@ Response usersForTpSiteUserRaw(String tpSiteUserDomain) throws Exception { * usersForTpSiteUser a tpSiteUser using raw JSON payload (executes immediately) - returns raw * Response. */ - Response usersForTpSiteUserRaw(String tpSiteUserDomain, String jsonPayload) throws Exception { + Response usersForTpSiteUserRaw(String tpSiteUserDomain, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/users", "tp-site-user-domain", tpSiteUserDomain); @@ -91,13 +93,14 @@ Response usersForTpSiteUserRaw(String tpSiteUserDomain, String jsonPayload) thro } public UsersForTpSiteUserResponse usersForTpSiteUser( - String tpSiteUserDomain, UsersForTpSiteUserParams params) throws Exception { + String tpSiteUserDomain, UsersForTpSiteUserParams params) throws ChargebeeException { Response response = usersForTpSiteUserRaw(tpSiteUserDomain, params); return UsersForTpSiteUserResponse.fromJson( response.getBodyAsString(), this, params, tpSiteUserDomain, response); } - public UsersForTpSiteUserResponse usersForTpSiteUser(String tpSiteUserDomain) throws Exception { + public UsersForTpSiteUserResponse usersForTpSiteUser(String tpSiteUserDomain) + throws ChargebeeException { Response response = usersForTpSiteUserRaw(tpSiteUserDomain); return UsersForTpSiteUserResponse.fromJson( response.getBodyAsString(), this, null, tpSiteUserDomain, response); @@ -107,7 +110,7 @@ public UsersForTpSiteUserResponse usersForTpSiteUser(String tpSiteUserDomain) th * payNowEnableLive a tpSiteUser using immutable params (executes immediately) - returns raw * Response. */ - Response payNowEnableLiveRaw(TpSiteUserPayNowEnableLiveParams params) throws Exception { + Response payNowEnableLiveRaw(TpSiteUserPayNowEnableLiveParams params) throws ChargebeeException { return post("/tp_site_users/pay_now_enable_live", params != null ? params.toFormData() : null); } @@ -116,13 +119,13 @@ Response payNowEnableLiveRaw(TpSiteUserPayNowEnableLiveParams params) throws Exc * payNowEnableLive a tpSiteUser using raw JSON payload (executes immediately) - returns raw * Response. */ - Response payNowEnableLiveRaw(String jsonPayload) throws Exception { + Response payNowEnableLiveRaw(String jsonPayload) throws ChargebeeException { return postJson("/tp_site_users/pay_now_enable_live", jsonPayload); } public TpSiteUserPayNowEnableLiveResponse payNowEnableLive( - TpSiteUserPayNowEnableLiveParams params) throws Exception { + TpSiteUserPayNowEnableLiveParams params) throws ChargebeeException { Response response = payNowEnableLiveRaw(params); return TpSiteUserPayNowEnableLiveResponse.fromJson(response.getBodyAsString(), response); @@ -133,7 +136,7 @@ public TpSiteUserPayNowEnableLiveResponse payNowEnableLive( * Response. */ Response guestsForTpSiteUserRaw(String tpSiteUserDomain, GuestsForTpSiteUserParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/guests", "tp-site-user-domain", tpSiteUserDomain); @@ -143,7 +146,7 @@ Response guestsForTpSiteUserRaw(String tpSiteUserDomain, GuestsForTpSiteUserPara /** * guestsForTpSiteUser a tpSiteUser without params (executes immediately) - returns raw Response. */ - Response guestsForTpSiteUserRaw(String tpSiteUserDomain) throws Exception { + Response guestsForTpSiteUserRaw(String tpSiteUserDomain) throws ChargebeeException { String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/guests", "tp-site-user-domain", tpSiteUserDomain); @@ -154,7 +157,8 @@ Response guestsForTpSiteUserRaw(String tpSiteUserDomain) throws Exception { * guestsForTpSiteUser a tpSiteUser using raw JSON payload (executes immediately) - returns raw * Response. */ - Response guestsForTpSiteUserRaw(String tpSiteUserDomain, String jsonPayload) throws Exception { + Response guestsForTpSiteUserRaw(String tpSiteUserDomain, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/guests", "tp-site-user-domain", tpSiteUserDomain); @@ -162,13 +166,14 @@ Response guestsForTpSiteUserRaw(String tpSiteUserDomain, String jsonPayload) thr } public GuestsForTpSiteUserResponse guestsForTpSiteUser( - String tpSiteUserDomain, GuestsForTpSiteUserParams params) throws Exception { + String tpSiteUserDomain, GuestsForTpSiteUserParams params) throws ChargebeeException { Response response = guestsForTpSiteUserRaw(tpSiteUserDomain, params); return GuestsForTpSiteUserResponse.fromJson( response.getBodyAsString(), this, params, tpSiteUserDomain, response); } - public GuestsForTpSiteUserResponse guestsForTpSiteUser(String tpSiteUserDomain) throws Exception { + public GuestsForTpSiteUserResponse guestsForTpSiteUser(String tpSiteUserDomain) + throws ChargebeeException { Response response = guestsForTpSiteUserRaw(tpSiteUserDomain); return GuestsForTpSiteUserResponse.fromJson( response.getBodyAsString(), this, null, tpSiteUserDomain, response); diff --git a/src/main/java/com/chargebee/v4/services/TransactionService.java b/src/main/java/com/chargebee/v4/services/TransactionService.java index 0d92ac30..575db5bf 100644 --- a/src/main/java/com/chargebee/v4/services/TransactionService.java +++ b/src/main/java/com/chargebee/v4/services/TransactionService.java @@ -9,17 +9,18 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.transaction.params.TransactionListParams; -import com.chargebee.v4.models.transaction.params.ReconcileForTransactionParams; +import com.chargebee.v4.models.transaction.params.TransactionReconcileParams; -import com.chargebee.v4.models.transaction.params.RefundForTransactionParams; +import com.chargebee.v4.models.transaction.params.TransactionRefundParams; import com.chargebee.v4.models.transaction.params.TransactionsForCustomerParams; -import com.chargebee.v4.models.transaction.params.RecordRefundForTransactionParams; +import com.chargebee.v4.models.transaction.params.TransactionRecordRefundParams; import com.chargebee.v4.models.transaction.params.TransactionsForSubscriptionParams; @@ -27,31 +28,31 @@ import com.chargebee.v4.models.transaction.params.TransactionPaymentsForInvoiceParams; -import com.chargebee.v4.models.transaction.params.DeleteOfflineTransactionForTransactionParams; +import com.chargebee.v4.models.transaction.params.DeleteOfflineTransactionParams; import com.chargebee.v4.models.transaction.responses.TransactionListResponse; -import com.chargebee.v4.models.transaction.responses.ReconcileForTransactionResponse; +import com.chargebee.v4.models.transaction.responses.TransactionReconcileResponse; import com.chargebee.v4.models.transaction.responses.TransactionRetrieveResponse; -import com.chargebee.v4.models.transaction.responses.RefundForTransactionResponse; +import com.chargebee.v4.models.transaction.responses.TransactionRefundResponse; import com.chargebee.v4.models.transaction.responses.TransactionsForCustomerResponse; -import com.chargebee.v4.models.transaction.responses.RecordRefundForTransactionResponse; +import com.chargebee.v4.models.transaction.responses.TransactionRecordRefundResponse; import com.chargebee.v4.models.transaction.responses.TransactionsForSubscriptionResponse; import com.chargebee.v4.models.transaction.responses.VoidTransactionResponse; -import com.chargebee.v4.models.transaction.responses.SyncForTransactionResponse; +import com.chargebee.v4.models.transaction.responses.SyncTransactionResponse; import com.chargebee.v4.models.transaction.responses.TransactionCreateAuthorizationResponse; import com.chargebee.v4.models.transaction.responses.TransactionPaymentsForInvoiceResponse; -import com.chargebee.v4.models.transaction.responses.DeleteOfflineTransactionForTransactionResponse; +import com.chargebee.v4.models.transaction.responses.DeleteOfflineTransactionResponse; public final class TransactionService extends BaseService { @@ -88,36 +89,36 @@ public TransactionService withOptions(RequestOptions options) { // === Operations === /** list a transaction using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(TransactionListParams params) throws Exception { + Response listRaw(TransactionListParams params) throws ChargebeeException { return get("/transactions", params != null ? params.toQueryParams() : null); } /** list a transaction without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/transactions", null); } /** list a transaction using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public TransactionListResponse list(TransactionListParams params) throws Exception { + public TransactionListResponse list(TransactionListParams params) throws ChargebeeException { Response response = listRaw(params); return TransactionListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public TransactionListResponse list() throws Exception { + public TransactionListResponse list() throws ChargebeeException { Response response = listRaw(); return TransactionListResponse.fromJson(response.getBodyAsString(), this, null, response); } - /** reconcileForTransaction a transaction (executes immediately) - returns raw Response. */ - Response reconcileForTransactionRaw(String transactionId) throws Exception { + /** reconcile a transaction (executes immediately) - returns raw Response. */ + Response reconcileRaw(String transactionId) throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/reconcile", "transaction-id", transactionId); @@ -126,11 +127,10 @@ Response reconcileForTransactionRaw(String transactionId) throws Exception { } /** - * reconcileForTransaction a transaction using immutable params (executes immediately) - returns - * raw Response. + * reconcile a transaction using immutable params (executes immediately) - returns raw Response. */ - Response reconcileForTransactionRaw(String transactionId, ReconcileForTransactionParams params) - throws Exception { + Response reconcileRaw(String transactionId, TransactionReconcileParams params) + throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/reconcile", "transaction-id", transactionId); @@ -138,37 +138,36 @@ Response reconcileForTransactionRaw(String transactionId, ReconcileForTransactio } /** - * reconcileForTransaction a transaction using raw JSON payload (executes immediately) - returns - * raw Response. + * reconcile a transaction using raw JSON payload (executes immediately) - returns raw Response. */ - Response reconcileForTransactionRaw(String transactionId, String jsonPayload) throws Exception { + Response reconcileRaw(String transactionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/reconcile", "transaction-id", transactionId); return postJson(path, jsonPayload); } - public ReconcileForTransactionResponse reconcileForTransaction( - String transactionId, ReconcileForTransactionParams params) throws Exception { - Response response = reconcileForTransactionRaw(transactionId, params); - return ReconcileForTransactionResponse.fromJson(response.getBodyAsString(), response); + public TransactionReconcileResponse reconcile( + String transactionId, TransactionReconcileParams params) throws ChargebeeException { + Response response = reconcileRaw(transactionId, params); + return TransactionReconcileResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a transaction (executes immediately) - returns raw Response. */ - Response retrieveRaw(String transactionId) throws Exception { + Response retrieveRaw(String transactionId) throws ChargebeeException { String path = buildPathWithParams("/transactions/{transaction-id}", "transaction-id", transactionId); return get(path, null); } - public TransactionRetrieveResponse retrieve(String transactionId) throws Exception { + public TransactionRetrieveResponse retrieve(String transactionId) throws ChargebeeException { Response response = retrieveRaw(transactionId); return TransactionRetrieveResponse.fromJson(response.getBodyAsString(), response); } - /** refundForTransaction a transaction (executes immediately) - returns raw Response. */ - Response refundForTransactionRaw(String transactionId) throws Exception { + /** refund a transaction (executes immediately) - returns raw Response. */ + Response refundRaw(String transactionId) throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/refund", "transaction-id", transactionId); @@ -176,33 +175,27 @@ Response refundForTransactionRaw(String transactionId) throws Exception { return post(path, null); } - /** - * refundForTransaction a transaction using immutable params (executes immediately) - returns raw - * Response. - */ - Response refundForTransactionRaw(String transactionId, RefundForTransactionParams params) - throws Exception { + /** refund a transaction using immutable params (executes immediately) - returns raw Response. */ + Response refundRaw(String transactionId, TransactionRefundParams params) + throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/refund", "transaction-id", transactionId); return post(path, params.toFormData()); } - /** - * refundForTransaction a transaction using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response refundForTransactionRaw(String transactionId, String jsonPayload) throws Exception { + /** refund a transaction using raw JSON payload (executes immediately) - returns raw Response. */ + Response refundRaw(String transactionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/refund", "transaction-id", transactionId); return postJson(path, jsonPayload); } - public RefundForTransactionResponse refundForTransaction( - String transactionId, RefundForTransactionParams params) throws Exception { - Response response = refundForTransactionRaw(transactionId, params); - return RefundForTransactionResponse.fromJson(response.getBodyAsString(), response); + public TransactionRefundResponse refund(String transactionId, TransactionRefundParams params) + throws ChargebeeException { + Response response = refundRaw(transactionId, params); + return TransactionRefundResponse.fromJson(response.getBodyAsString(), response); } /** @@ -210,7 +203,7 @@ public RefundForTransactionResponse refundForTransaction( * raw Response. */ Response transactionsForCustomerRaw(String customerId, TransactionsForCustomerParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/transactions", "customer-id", customerId); return get(path, params != null ? params.toQueryParams() : null); @@ -220,7 +213,7 @@ Response transactionsForCustomerRaw(String customerId, TransactionsForCustomerPa * transactionsForCustomer a transaction without params (executes immediately) - returns raw * Response. */ - Response transactionsForCustomerRaw(String customerId) throws Exception { + Response transactionsForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/transactions", "customer-id", customerId); return get(path, null); @@ -230,28 +223,29 @@ Response transactionsForCustomerRaw(String customerId) throws Exception { * transactionsForCustomer a transaction using raw JSON payload (executes immediately) - returns * raw Response. */ - Response transactionsForCustomerRaw(String customerId, String jsonPayload) throws Exception { + Response transactionsForCustomerRaw(String customerId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/transactions", "customer-id", customerId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public TransactionsForCustomerResponse transactionsForCustomer( - String customerId, TransactionsForCustomerParams params) throws Exception { + String customerId, TransactionsForCustomerParams params) throws ChargebeeException { Response response = transactionsForCustomerRaw(customerId, params); return TransactionsForCustomerResponse.fromJson( response.getBodyAsString(), this, params, customerId, response); } public TransactionsForCustomerResponse transactionsForCustomer(String customerId) - throws Exception { + throws ChargebeeException { Response response = transactionsForCustomerRaw(customerId); return TransactionsForCustomerResponse.fromJson( response.getBodyAsString(), this, null, customerId, response); } - /** recordRefundForTransaction a transaction (executes immediately) - returns raw Response. */ - Response recordRefundForTransactionRaw(String transactionId) throws Exception { + /** recordRefund a transaction (executes immediately) - returns raw Response. */ + Response recordRefundRaw(String transactionId) throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/record_refund", "transaction-id", transactionId); @@ -260,11 +254,11 @@ Response recordRefundForTransactionRaw(String transactionId) throws Exception { } /** - * recordRefundForTransaction a transaction using immutable params (executes immediately) - - * returns raw Response. + * recordRefund a transaction using immutable params (executes immediately) - returns raw + * Response. */ - Response recordRefundForTransactionRaw( - String transactionId, RecordRefundForTransactionParams params) throws Exception { + Response recordRefundRaw(String transactionId, TransactionRecordRefundParams params) + throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/record_refund", "transaction-id", transactionId); @@ -272,21 +266,20 @@ Response recordRefundForTransactionRaw( } /** - * recordRefundForTransaction a transaction using raw JSON payload (executes immediately) - - * returns raw Response. + * recordRefund a transaction using raw JSON payload (executes immediately) - returns raw + * Response. */ - Response recordRefundForTransactionRaw(String transactionId, String jsonPayload) - throws Exception { + Response recordRefundRaw(String transactionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/record_refund", "transaction-id", transactionId); return postJson(path, jsonPayload); } - public RecordRefundForTransactionResponse recordRefundForTransaction( - String transactionId, RecordRefundForTransactionParams params) throws Exception { - Response response = recordRefundForTransactionRaw(transactionId, params); - return RecordRefundForTransactionResponse.fromJson(response.getBodyAsString(), response); + public TransactionRecordRefundResponse recordRefund( + String transactionId, TransactionRecordRefundParams params) throws ChargebeeException { + Response response = recordRefundRaw(transactionId, params); + return TransactionRecordRefundResponse.fromJson(response.getBodyAsString(), response); } /** @@ -294,7 +287,7 @@ public RecordRefundForTransactionResponse recordRefundForTransaction( * returns raw Response. */ Response transactionsForSubscriptionRaw( - String subscriptionId, TransactionsForSubscriptionParams params) throws Exception { + String subscriptionId, TransactionsForSubscriptionParams params) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/transactions", "subscription-id", subscriptionId); @@ -305,7 +298,7 @@ Response transactionsForSubscriptionRaw( * transactionsForSubscription a transaction without params (executes immediately) - returns raw * Response. */ - Response transactionsForSubscriptionRaw(String subscriptionId) throws Exception { + Response transactionsForSubscriptionRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/transactions", "subscription-id", subscriptionId); @@ -317,7 +310,7 @@ Response transactionsForSubscriptionRaw(String subscriptionId) throws Exception * returns raw Response. */ Response transactionsForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/transactions", "subscription-id", subscriptionId); @@ -325,50 +318,51 @@ Response transactionsForSubscriptionRaw(String subscriptionId, String jsonPayloa } public TransactionsForSubscriptionResponse transactionsForSubscription( - String subscriptionId, TransactionsForSubscriptionParams params) throws Exception { + String subscriptionId, TransactionsForSubscriptionParams params) throws ChargebeeException { Response response = transactionsForSubscriptionRaw(subscriptionId, params); return TransactionsForSubscriptionResponse.fromJson( response.getBodyAsString(), this, params, subscriptionId, response); } public TransactionsForSubscriptionResponse transactionsForSubscription(String subscriptionId) - throws Exception { + throws ChargebeeException { Response response = transactionsForSubscriptionRaw(subscriptionId); return TransactionsForSubscriptionResponse.fromJson( response.getBodyAsString(), this, null, subscriptionId, response); } /** voidTransaction a transaction (executes immediately) - returns raw Response. */ - Response voidTransactionRaw(String transactionId) throws Exception { + Response voidTransactionRaw(String transactionId) throws ChargebeeException { String path = buildPathWithParams("/transactions/{transaction-id}/void", "transaction-id", transactionId); return post(path, null); } - public VoidTransactionResponse voidTransaction(String transactionId) throws Exception { + public VoidTransactionResponse voidTransaction(String transactionId) throws ChargebeeException { Response response = voidTransactionRaw(transactionId); return VoidTransactionResponse.fromJson(response.getBodyAsString(), response); } - /** syncForTransaction a transaction (executes immediately) - returns raw Response. */ - Response syncForTransactionRaw(String transactionId) throws Exception { + /** syncTransaction a transaction (executes immediately) - returns raw Response. */ + Response syncTransactionRaw(String transactionId) throws ChargebeeException { String path = buildPathWithParams("/transactions/{transaction-id}/sync", "transaction-id", transactionId); return post(path, null); } - public SyncForTransactionResponse syncForTransaction(String transactionId) throws Exception { - Response response = syncForTransactionRaw(transactionId); - return SyncForTransactionResponse.fromJson(response.getBodyAsString(), response); + public SyncTransactionResponse syncTransaction(String transactionId) throws ChargebeeException { + Response response = syncTransactionRaw(transactionId); + return SyncTransactionResponse.fromJson(response.getBodyAsString(), response); } /** * createAuthorization a transaction using immutable params (executes immediately) - returns raw * Response. */ - Response createAuthorizationRaw(TransactionCreateAuthorizationParams params) throws Exception { + Response createAuthorizationRaw(TransactionCreateAuthorizationParams params) + throws ChargebeeException { return post("/transactions/create_authorization", params != null ? params.toFormData() : null); } @@ -377,13 +371,13 @@ Response createAuthorizationRaw(TransactionCreateAuthorizationParams params) thr * createAuthorization a transaction using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createAuthorizationRaw(String jsonPayload) throws Exception { + Response createAuthorizationRaw(String jsonPayload) throws ChargebeeException { return postJson("/transactions/create_authorization", jsonPayload); } public TransactionCreateAuthorizationResponse createAuthorization( - TransactionCreateAuthorizationParams params) throws Exception { + TransactionCreateAuthorizationParams params) throws ChargebeeException { Response response = createAuthorizationRaw(params); return TransactionCreateAuthorizationResponse.fromJson(response.getBodyAsString(), response); @@ -394,7 +388,7 @@ public TransactionCreateAuthorizationResponse createAuthorization( * Response. */ Response paymentsForInvoiceRaw(String invoiceId, TransactionPaymentsForInvoiceParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payments", "invoice-id", invoiceId); return get(path, params != null ? params.toQueryParams() : null); } @@ -402,7 +396,7 @@ Response paymentsForInvoiceRaw(String invoiceId, TransactionPaymentsForInvoicePa /** * paymentsForInvoice a transaction without params (executes immediately) - returns raw Response. */ - Response paymentsForInvoiceRaw(String invoiceId) throws Exception { + Response paymentsForInvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payments", "invoice-id", invoiceId); return get(path, null); } @@ -411,30 +405,27 @@ Response paymentsForInvoiceRaw(String invoiceId) throws Exception { * paymentsForInvoice a transaction using raw JSON payload (executes immediately) - returns raw * Response. */ - Response paymentsForInvoiceRaw(String invoiceId, String jsonPayload) throws Exception { + Response paymentsForInvoiceRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payments", "invoice-id", invoiceId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } public TransactionPaymentsForInvoiceResponse paymentsForInvoice( - String invoiceId, TransactionPaymentsForInvoiceParams params) throws Exception { + String invoiceId, TransactionPaymentsForInvoiceParams params) throws ChargebeeException { Response response = paymentsForInvoiceRaw(invoiceId, params); return TransactionPaymentsForInvoiceResponse.fromJson( response.getBodyAsString(), this, params, invoiceId, response); } public TransactionPaymentsForInvoiceResponse paymentsForInvoice(String invoiceId) - throws Exception { + throws ChargebeeException { Response response = paymentsForInvoiceRaw(invoiceId); return TransactionPaymentsForInvoiceResponse.fromJson( response.getBodyAsString(), this, null, invoiceId, response); } - /** - * deleteOfflineTransactionForTransaction a transaction (executes immediately) - returns raw - * Response. - */ - Response deleteOfflineTransactionForTransactionRaw(String transactionId) throws Exception { + /** deleteOfflineTransaction a transaction (executes immediately) - returns raw Response. */ + Response deleteOfflineTransactionRaw(String transactionId) throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/delete_offline_transaction", @@ -445,11 +436,11 @@ Response deleteOfflineTransactionForTransactionRaw(String transactionId) throws } /** - * deleteOfflineTransactionForTransaction a transaction using immutable params (executes - * immediately) - returns raw Response. + * deleteOfflineTransaction a transaction using immutable params (executes immediately) - returns + * raw Response. */ - Response deleteOfflineTransactionForTransactionRaw( - String transactionId, DeleteOfflineTransactionForTransactionParams params) throws Exception { + Response deleteOfflineTransactionRaw(String transactionId, DeleteOfflineTransactionParams params) + throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/delete_offline_transaction", @@ -459,11 +450,11 @@ Response deleteOfflineTransactionForTransactionRaw( } /** - * deleteOfflineTransactionForTransaction a transaction using raw JSON payload (executes - * immediately) - returns raw Response. + * deleteOfflineTransaction a transaction using raw JSON payload (executes immediately) - returns + * raw Response. */ - Response deleteOfflineTransactionForTransactionRaw(String transactionId, String jsonPayload) - throws Exception { + Response deleteOfflineTransactionRaw(String transactionId, String jsonPayload) + throws ChargebeeException { String path = buildPathWithParams( "/transactions/{transaction-id}/delete_offline_transaction", @@ -472,10 +463,9 @@ Response deleteOfflineTransactionForTransactionRaw(String transactionId, String return postJson(path, jsonPayload); } - public DeleteOfflineTransactionForTransactionResponse deleteOfflineTransactionForTransaction( - String transactionId, DeleteOfflineTransactionForTransactionParams params) throws Exception { - Response response = deleteOfflineTransactionForTransactionRaw(transactionId, params); - return DeleteOfflineTransactionForTransactionResponse.fromJson( - response.getBodyAsString(), response); + public DeleteOfflineTransactionResponse deleteOfflineTransaction( + String transactionId, DeleteOfflineTransactionParams params) throws ChargebeeException { + Response response = deleteOfflineTransactionRaw(transactionId, params); + return DeleteOfflineTransactionResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java b/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java index 4dbe0f26..47058988 100644 --- a/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java +++ b/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.unbilledCharge.params.UnbilledChargeInvoiceNowEstimateParams; @@ -21,7 +22,7 @@ import com.chargebee.v4.models.unbilledCharge.params.CreateUnbilledChargeParams; -import com.chargebee.v4.models.unbilledCharge.responses.DeleteUnbilledChargeResponse; +import com.chargebee.v4.models.unbilledCharge.responses.UnbilledChargeDeleteResponse; import com.chargebee.v4.models.unbilledCharge.responses.UnbilledChargeInvoiceNowEstimateResponse; @@ -68,8 +69,8 @@ public UnbilledChargeService withOptions(RequestOptions options) { // === Operations === - /** deleteUnbilledCharge a unbilledCharge (executes immediately) - returns raw Response. */ - Response deleteUnbilledChargeRaw(String unbilledChargeId) throws Exception { + /** delete a unbilledCharge (executes immediately) - returns raw Response. */ + Response deleteRaw(String unbilledChargeId) throws ChargebeeException { String path = buildPathWithParams( "/unbilled_charges/{unbilled-charge-id}/delete", @@ -79,17 +80,17 @@ Response deleteUnbilledChargeRaw(String unbilledChargeId) throws Exception { return post(path, null); } - public DeleteUnbilledChargeResponse deleteUnbilledCharge(String unbilledChargeId) - throws Exception { - Response response = deleteUnbilledChargeRaw(unbilledChargeId); - return DeleteUnbilledChargeResponse.fromJson(response.getBodyAsString(), response); + public UnbilledChargeDeleteResponse delete(String unbilledChargeId) throws ChargebeeException { + Response response = deleteRaw(unbilledChargeId); + return UnbilledChargeDeleteResponse.fromJson(response.getBodyAsString(), response); } /** * invoiceNowEstimate a unbilledCharge using immutable params (executes immediately) - returns raw * Response. */ - Response invoiceNowEstimateRaw(UnbilledChargeInvoiceNowEstimateParams params) throws Exception { + Response invoiceNowEstimateRaw(UnbilledChargeInvoiceNowEstimateParams params) + throws ChargebeeException { return post( "/unbilled_charges/invoice_now_estimate", params != null ? params.toFormData() : null); @@ -99,13 +100,13 @@ Response invoiceNowEstimateRaw(UnbilledChargeInvoiceNowEstimateParams params) th * invoiceNowEstimate a unbilledCharge using raw JSON payload (executes immediately) - returns raw * Response. */ - Response invoiceNowEstimateRaw(String jsonPayload) throws Exception { + Response invoiceNowEstimateRaw(String jsonPayload) throws ChargebeeException { return postJson("/unbilled_charges/invoice_now_estimate", jsonPayload); } public UnbilledChargeInvoiceNowEstimateResponse invoiceNowEstimate( - UnbilledChargeInvoiceNowEstimateParams params) throws Exception { + UnbilledChargeInvoiceNowEstimateParams params) throws ChargebeeException { Response response = invoiceNowEstimateRaw(params); return UnbilledChargeInvoiceNowEstimateResponse.fromJson(response.getBodyAsString(), response); @@ -115,7 +116,8 @@ public UnbilledChargeInvoiceNowEstimateResponse invoiceNowEstimate( * invoiceUnbilledCharges a unbilledCharge using immutable params (executes immediately) - returns * raw Response. */ - Response invoiceUnbilledChargesRaw(InvoiceUnbilledChargesParams params) throws Exception { + Response invoiceUnbilledChargesRaw(InvoiceUnbilledChargesParams params) + throws ChargebeeException { return post( "/unbilled_charges/invoice_unbilled_charges", params != null ? params.toFormData() : null); @@ -125,43 +127,44 @@ Response invoiceUnbilledChargesRaw(InvoiceUnbilledChargesParams params) throws E * invoiceUnbilledCharges a unbilledCharge using raw JSON payload (executes immediately) - returns * raw Response. */ - Response invoiceUnbilledChargesRaw(String jsonPayload) throws Exception { + Response invoiceUnbilledChargesRaw(String jsonPayload) throws ChargebeeException { return postJson("/unbilled_charges/invoice_unbilled_charges", jsonPayload); } public InvoiceUnbilledChargesResponse invoiceUnbilledCharges(InvoiceUnbilledChargesParams params) - throws Exception { + throws ChargebeeException { Response response = invoiceUnbilledChargesRaw(params); return InvoiceUnbilledChargesResponse.fromJson(response.getBodyAsString(), response); } /** list a unbilledCharge using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(UnbilledChargeListParams params) throws Exception { + Response listRaw(UnbilledChargeListParams params) throws ChargebeeException { return get("/unbilled_charges", params != null ? params.toQueryParams() : null); } /** list a unbilledCharge without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/unbilled_charges", null); } /** list a unbilledCharge using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public UnbilledChargeListResponse list(UnbilledChargeListParams params) throws Exception { + public UnbilledChargeListResponse list(UnbilledChargeListParams params) + throws ChargebeeException { Response response = listRaw(params); return UnbilledChargeListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public UnbilledChargeListResponse list() throws Exception { + public UnbilledChargeListResponse list() throws ChargebeeException { Response response = listRaw(); return UnbilledChargeListResponse.fromJson(response.getBodyAsString(), this, null, response); } @@ -169,7 +172,7 @@ public UnbilledChargeListResponse list() throws Exception { /** * create a unbilledCharge using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(UnbilledChargeCreateParams params) throws Exception { + Response createRaw(UnbilledChargeCreateParams params) throws ChargebeeException { return post("/unbilled_charges", params != null ? params.toFormData() : null); } @@ -177,12 +180,13 @@ Response createRaw(UnbilledChargeCreateParams params) throws Exception { /** * create a unbilledCharge using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/unbilled_charges", jsonPayload); } - public UnbilledChargeCreateResponse create(UnbilledChargeCreateParams params) throws Exception { + public UnbilledChargeCreateResponse create(UnbilledChargeCreateParams params) + throws ChargebeeException { Response response = createRaw(params); return UnbilledChargeCreateResponse.fromJson(response.getBodyAsString(), response); @@ -192,7 +196,7 @@ public UnbilledChargeCreateResponse create(UnbilledChargeCreateParams params) th * createUnbilledCharge a unbilledCharge using immutable params (executes immediately) - returns * raw Response. */ - Response createUnbilledChargeRaw(CreateUnbilledChargeParams params) throws Exception { + Response createUnbilledChargeRaw(CreateUnbilledChargeParams params) throws ChargebeeException { return post("/unbilled_charges/create", params != null ? params.toFormData() : null); } @@ -201,13 +205,13 @@ Response createUnbilledChargeRaw(CreateUnbilledChargeParams params) throws Excep * createUnbilledCharge a unbilledCharge using raw JSON payload (executes immediately) - returns * raw Response. */ - Response createUnbilledChargeRaw(String jsonPayload) throws Exception { + Response createUnbilledChargeRaw(String jsonPayload) throws ChargebeeException { return postJson("/unbilled_charges/create", jsonPayload); } public CreateUnbilledChargeResponse createUnbilledCharge(CreateUnbilledChargeParams params) - throws Exception { + throws ChargebeeException { Response response = createUnbilledChargeRaw(params); return CreateUnbilledChargeResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java b/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java index 3be59961..03d3f467 100644 --- a/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java +++ b/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.unbilledChargesSetting.params.UnbilledChargesSettingExecuteParams; +import com.chargebee.v4.models.unbilledChargesSetting.params.UnbilledChargesSettingRetrieveParams; -import com.chargebee.v4.models.unbilledChargesSetting.responses.UnbilledChargesSettingExecuteResponse; +import com.chargebee.v4.models.unbilledChargesSetting.responses.UnbilledChargesSettingRetrieveResponse; public final class UnbilledChargesSettingService extends BaseService { @@ -52,27 +53,27 @@ public UnbilledChargesSettingService withOptions(RequestOptions options) { // === Operations === /** - * execute a unbilledChargesSetting using immutable params (executes immediately) - returns raw + * retrieve a unbilledChargesSetting using immutable params (executes immediately) - returns raw * Response. */ - Response executeRaw(UnbilledChargesSettingExecuteParams params) throws Exception { + Response retrieveRaw(UnbilledChargesSettingRetrieveParams params) throws ChargebeeException { return get("/unbilled_charges_settings", params != null ? params.toQueryParams() : null); } /** - * execute a unbilledChargesSetting using raw JSON payload (executes immediately) - returns raw + * retrieve a unbilledChargesSetting using raw JSON payload (executes immediately) - returns raw * Response. */ - Response executeRaw(String jsonPayload) throws Exception { + Response retrieveRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public UnbilledChargesSettingExecuteResponse execute(UnbilledChargesSettingExecuteParams params) - throws Exception { - Response response = executeRaw(params); + public UnbilledChargesSettingRetrieveResponse retrieve( + UnbilledChargesSettingRetrieveParams params) throws ChargebeeException { + Response response = retrieveRaw(params); - return UnbilledChargesSettingExecuteResponse.fromJson(response.getBodyAsString(), response); + return UnbilledChargesSettingRetrieveResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/UsageEventService.java b/src/main/java/com/chargebee/v4/services/UsageEventService.java index 0effaa58..7900dc11 100644 --- a/src/main/java/com/chargebee/v4/services/UsageEventService.java +++ b/src/main/java/com/chargebee/v4/services/UsageEventService.java @@ -9,15 +9,16 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.usageEvent.params.UsageEventCreateParams; -import com.chargebee.v4.models.usageEvent.params.UsageEventBatchCreateParams; +import com.chargebee.v4.models.usageEvent.params.UsageEventBatchIngestParams; import com.chargebee.v4.models.usageEvent.responses.UsageEventCreateResponse; -import com.chargebee.v4.models.usageEvent.responses.UsageEventBatchCreateResponse; +import com.chargebee.v4.models.usageEvent.responses.UsageEventBatchIngestResponse; public final class UsageEventService extends BaseService { @@ -54,43 +55,43 @@ public UsageEventService withOptions(RequestOptions options) { // === Operations === /** create a usageEvent using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(UsageEventCreateParams params) throws Exception { + Response createRaw(UsageEventCreateParams params) throws ChargebeeException { return post("/usage_events", params != null ? params.toFormData() : null); } /** create a usageEvent using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/usage_events", jsonPayload); } - public UsageEventCreateResponse create(UsageEventCreateParams params) throws Exception { + public UsageEventCreateResponse create(UsageEventCreateParams params) throws ChargebeeException { Response response = createRaw(params); return UsageEventCreateResponse.fromJson(response.getBodyAsString(), response); } /** - * batchCreate a usageEvent using immutable params (executes immediately) - returns raw Response. + * batchIngest a usageEvent using immutable params (executes immediately) - returns raw Response. */ - Response batchCreateRaw(UsageEventBatchCreateParams params) throws Exception { + Response batchIngestRaw(UsageEventBatchIngestParams params) throws ChargebeeException { return post("/batch/usage_events", params != null ? params.toFormData() : null); } /** - * batchCreate a usageEvent using raw JSON payload (executes immediately) - returns raw Response. + * batchIngest a usageEvent using raw JSON payload (executes immediately) - returns raw Response. */ - Response batchCreateRaw(String jsonPayload) throws Exception { + Response batchIngestRaw(String jsonPayload) throws ChargebeeException { return postJson("/batch/usage_events", jsonPayload); } - public UsageEventBatchCreateResponse batchCreate(UsageEventBatchCreateParams params) - throws Exception { - Response response = batchCreateRaw(params); + public UsageEventBatchIngestResponse batchIngest(UsageEventBatchIngestParams params) + throws ChargebeeException { + Response response = batchIngestRaw(params); - return UsageEventBatchCreateResponse.fromJson(response.getBodyAsString(), response); + return UsageEventBatchIngestResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/UsageFileService.java b/src/main/java/com/chargebee/v4/services/UsageFileService.java index 62a1c087..b133745f 100644 --- a/src/main/java/com/chargebee/v4/services/UsageFileService.java +++ b/src/main/java/com/chargebee/v4/services/UsageFileService.java @@ -9,11 +9,12 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.usageFile.params.UsageFileUploadUrlParams; -import com.chargebee.v4.models.usageFile.responses.ProcessingStatusForUsageFileResponse; +import com.chargebee.v4.models.usageFile.responses.UsageFileProcessingStatusResponse; import com.chargebee.v4.models.usageFile.responses.UsageFileUploadUrlResponse; @@ -51,8 +52,8 @@ public UsageFileService withOptions(RequestOptions options) { // === Operations === - /** processingStatusForUsageFile a usageFile (executes immediately) - returns raw Response. */ - Response processingStatusForUsageFileRaw(String usageFileId) throws Exception { + /** processingStatus a usageFile (executes immediately) - returns raw Response. */ + Response processingStatusRaw(String usageFileId) throws ChargebeeException { String path = buildPathWithParams( "/usage_files/{usage-file-id}/processing_status", "usage-file-id", usageFileId); @@ -60,25 +61,26 @@ Response processingStatusForUsageFileRaw(String usageFileId) throws Exception { return get(path, null); } - public ProcessingStatusForUsageFileResponse processingStatusForUsageFile(String usageFileId) - throws Exception { - Response response = processingStatusForUsageFileRaw(usageFileId); - return ProcessingStatusForUsageFileResponse.fromJson(response.getBodyAsString(), response); + public UsageFileProcessingStatusResponse processingStatus(String usageFileId) + throws ChargebeeException { + Response response = processingStatusRaw(usageFileId); + return UsageFileProcessingStatusResponse.fromJson(response.getBodyAsString(), response); } /** uploadUrl a usageFile using immutable params (executes immediately) - returns raw Response. */ - Response uploadUrlRaw(UsageFileUploadUrlParams params) throws Exception { + Response uploadUrlRaw(UsageFileUploadUrlParams params) throws ChargebeeException { return post("/usage_files/upload_url", params != null ? params.toFormData() : null); } /** uploadUrl a usageFile using raw JSON payload (executes immediately) - returns raw Response. */ - Response uploadUrlRaw(String jsonPayload) throws Exception { + Response uploadUrlRaw(String jsonPayload) throws ChargebeeException { return postJson("/usage_files/upload_url", jsonPayload); } - public UsageFileUploadUrlResponse uploadUrl(UsageFileUploadUrlParams params) throws Exception { + public UsageFileUploadUrlResponse uploadUrl(UsageFileUploadUrlParams params) + throws ChargebeeException { Response response = uploadUrlRaw(params); return UsageFileUploadUrlResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/services/UsageService.java b/src/main/java/com/chargebee/v4/services/UsageService.java index a1970452..036f7206 100644 --- a/src/main/java/com/chargebee/v4/services/UsageService.java +++ b/src/main/java/com/chargebee/v4/services/UsageService.java @@ -9,23 +9,26 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.usage.params.UsagePdfParams; -import com.chargebee.v4.models.usage.params.AddUsageForSubscriptionParams; +import com.chargebee.v4.models.usage.params.UsageRetrieveParams; -import com.chargebee.v4.models.usage.params.DeleteUsageForSubscriptionParams; +import com.chargebee.v4.models.usage.params.UsageCreateParams; + +import com.chargebee.v4.models.usage.params.UsageDeleteParams; import com.chargebee.v4.models.usage.params.UsageListParams; import com.chargebee.v4.models.usage.responses.UsagePdfResponse; -import com.chargebee.v4.models.usage.responses.UsagesForSubscriptionResponse; +import com.chargebee.v4.models.usage.responses.UsageRetrieveResponse; -import com.chargebee.v4.models.usage.responses.AddUsageForSubscriptionResponse; +import com.chargebee.v4.models.usage.responses.UsageCreateResponse; -import com.chargebee.v4.models.usage.responses.DeleteUsageForSubscriptionResponse; +import com.chargebee.v4.models.usage.responses.UsageDeleteResponse; import com.chargebee.v4.models.usage.responses.UsageListResponse; @@ -64,25 +67,25 @@ public UsageService withOptions(RequestOptions options) { // === Operations === /** pdf a usage using immutable params (executes immediately) - returns raw Response. */ - Response pdfRaw(UsagePdfParams params) throws Exception { + Response pdfRaw(UsagePdfParams params) throws ChargebeeException { return post("/usages/pdf", params != null ? params.toFormData() : null); } /** pdf a usage using raw JSON payload (executes immediately) - returns raw Response. */ - Response pdfRaw(String jsonPayload) throws Exception { + Response pdfRaw(String jsonPayload) throws ChargebeeException { return postJson("/usages/pdf", jsonPayload); } - public UsagePdfResponse pdf(UsagePdfParams params) throws Exception { + public UsagePdfResponse pdf(UsagePdfParams params) throws ChargebeeException { Response response = pdfRaw(params); return UsagePdfResponse.fromJson(response.getBodyAsString(), response); } - /** usagesForSubscription a usage (executes immediately) - returns raw Response. */ - Response usagesForSubscriptionRaw(String subscriptionId) throws Exception { + /** retrieve a usage (executes immediately) - returns raw Response. */ + Response retrieveRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); @@ -90,14 +93,28 @@ Response usagesForSubscriptionRaw(String subscriptionId) throws Exception { return get(path, null); } - public UsagesForSubscriptionResponse usagesForSubscription(String subscriptionId) - throws Exception { - Response response = usagesForSubscriptionRaw(subscriptionId); - return UsagesForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + /** retrieve a usage using immutable params (executes immediately) - returns raw Response. */ + Response retrieveRaw(String subscriptionId, UsageRetrieveParams params) + throws ChargebeeException { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); + return get(path, params != null ? params.toQueryParams() : null); + } + + public UsageRetrieveResponse retrieve(String subscriptionId, UsageRetrieveParams params) + throws ChargebeeException { + Response response = retrieveRaw(subscriptionId, params); + return UsageRetrieveResponse.fromJson(response.getBodyAsString(), response); + } + + public UsageRetrieveResponse retrieve(String subscriptionId) throws ChargebeeException { + Response response = retrieveRaw(subscriptionId); + return UsageRetrieveResponse.fromJson(response.getBodyAsString(), response); } - /** addUsageForSubscription a usage (executes immediately) - returns raw Response. */ - Response addUsageForSubscriptionRaw(String subscriptionId) throws Exception { + /** create a usage (executes immediately) - returns raw Response. */ + Response createRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); @@ -105,37 +122,30 @@ Response addUsageForSubscriptionRaw(String subscriptionId) throws Exception { return post(path, null); } - /** - * addUsageForSubscription a usage using immutable params (executes immediately) - returns raw - * Response. - */ - Response addUsageForSubscriptionRaw(String subscriptionId, AddUsageForSubscriptionParams params) - throws Exception { + /** create a usage using immutable params (executes immediately) - returns raw Response. */ + Response createRaw(String subscriptionId, UsageCreateParams params) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); return post(path, params.toFormData()); } - /** - * addUsageForSubscription a usage using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response addUsageForSubscriptionRaw(String subscriptionId, String jsonPayload) throws Exception { + /** create a usage using raw JSON payload (executes immediately) - returns raw Response. */ + Response createRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public AddUsageForSubscriptionResponse addUsageForSubscription( - String subscriptionId, AddUsageForSubscriptionParams params) throws Exception { - Response response = addUsageForSubscriptionRaw(subscriptionId, params); - return AddUsageForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public UsageCreateResponse create(String subscriptionId, UsageCreateParams params) + throws ChargebeeException { + Response response = createRaw(subscriptionId, params); + return UsageCreateResponse.fromJson(response.getBodyAsString(), response); } - /** deleteUsageForSubscription a usage (executes immediately) - returns raw Response. */ - Response deleteUsageForSubscriptionRaw(String subscriptionId) throws Exception { + /** delete a usage (executes immediately) - returns raw Response. */ + Response deleteRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/delete_usage", "subscription-id", subscriptionId); @@ -143,61 +153,53 @@ Response deleteUsageForSubscriptionRaw(String subscriptionId) throws Exception { return post(path, null); } - /** - * deleteUsageForSubscription a usage using immutable params (executes immediately) - returns raw - * Response. - */ - Response deleteUsageForSubscriptionRaw( - String subscriptionId, DeleteUsageForSubscriptionParams params) throws Exception { + /** delete a usage using immutable params (executes immediately) - returns raw Response. */ + Response deleteRaw(String subscriptionId, UsageDeleteParams params) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/delete_usage", "subscription-id", subscriptionId); return post(path, params.toFormData()); } - /** - * deleteUsageForSubscription a usage using raw JSON payload (executes immediately) - returns raw - * Response. - */ - Response deleteUsageForSubscriptionRaw(String subscriptionId, String jsonPayload) - throws Exception { + /** delete a usage using raw JSON payload (executes immediately) - returns raw Response. */ + Response deleteRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/delete_usage", "subscription-id", subscriptionId); return postJson(path, jsonPayload); } - public DeleteUsageForSubscriptionResponse deleteUsageForSubscription( - String subscriptionId, DeleteUsageForSubscriptionParams params) throws Exception { - Response response = deleteUsageForSubscriptionRaw(subscriptionId, params); - return DeleteUsageForSubscriptionResponse.fromJson(response.getBodyAsString(), response); + public UsageDeleteResponse delete(String subscriptionId, UsageDeleteParams params) + throws ChargebeeException { + Response response = deleteRaw(subscriptionId, params); + return UsageDeleteResponse.fromJson(response.getBodyAsString(), response); } /** list a usage using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(UsageListParams params) throws Exception { + Response listRaw(UsageListParams params) throws ChargebeeException { return get("/usages", params != null ? params.toQueryParams() : null); } /** list a usage without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/usages", null); } /** list a usage using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public UsageListResponse list(UsageListParams params) throws Exception { + public UsageListResponse list(UsageListParams params) throws ChargebeeException { Response response = listRaw(params); return UsageListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public UsageListResponse list() throws Exception { + public UsageListResponse list() throws ChargebeeException { Response response = listRaw(); return UsageListResponse.fromJson(response.getBodyAsString(), this, null, response); } diff --git a/src/main/java/com/chargebee/v4/services/VariantService.java b/src/main/java/com/chargebee/v4/services/VariantService.java index b80d9828..9c95f3ac 100644 --- a/src/main/java/com/chargebee/v4/services/VariantService.java +++ b/src/main/java/com/chargebee/v4/services/VariantService.java @@ -9,23 +9,24 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; -import com.chargebee.v4.models.variant.params.VariantsForProductParams; +import com.chargebee.v4.models.variant.params.ListProductVariantsParams; -import com.chargebee.v4.models.variant.params.AddVariantForProductParams; +import com.chargebee.v4.models.variant.params.CreateProductVariantParams; import com.chargebee.v4.models.variant.params.VariantUpdateParams; -import com.chargebee.v4.models.variant.responses.VariantsForProductResponse; +import com.chargebee.v4.models.variant.responses.ListProductVariantsResponse; -import com.chargebee.v4.models.variant.responses.AddVariantForProductResponse; +import com.chargebee.v4.models.variant.responses.CreateProductVariantResponse; import com.chargebee.v4.models.variant.responses.VariantRetrieveResponse; import com.chargebee.v4.models.variant.responses.VariantUpdateResponse; -import com.chargebee.v4.models.variant.responses.DeleteVariantResponse; +import com.chargebee.v4.models.variant.responses.VariantDeleteResponse; public final class VariantService extends BaseService { @@ -62,77 +63,78 @@ public VariantService withOptions(RequestOptions options) { // === Operations === /** - * variantsForProduct a variant using immutable params (executes immediately) - returns raw + * listProductVariants a variant using immutable params (executes immediately) - returns raw * Response. */ - Response variantsForProductRaw(String productId, VariantsForProductParams params) - throws Exception { + Response listProductVariantsRaw(String productId, ListProductVariantsParams params) + throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); return get(path, params != null ? params.toQueryParams() : null); } - /** variantsForProduct a variant without params (executes immediately) - returns raw Response. */ - Response variantsForProductRaw(String productId) throws Exception { + /** listProductVariants a variant without params (executes immediately) - returns raw Response. */ + Response listProductVariantsRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); return get(path, null); } /** - * variantsForProduct a variant using raw JSON payload (executes immediately) - returns raw + * listProductVariants a variant using raw JSON payload (executes immediately) - returns raw * Response. */ - Response variantsForProductRaw(String productId, String jsonPayload) throws Exception { + Response listProductVariantsRaw(String productId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public VariantsForProductResponse variantsForProduct( - String productId, VariantsForProductParams params) throws Exception { - Response response = variantsForProductRaw(productId, params); - return VariantsForProductResponse.fromJson( + public ListProductVariantsResponse listProductVariants( + String productId, ListProductVariantsParams params) throws ChargebeeException { + Response response = listProductVariantsRaw(productId, params); + return ListProductVariantsResponse.fromJson( response.getBodyAsString(), this, params, productId, response); } - public VariantsForProductResponse variantsForProduct(String productId) throws Exception { - Response response = variantsForProductRaw(productId); - return VariantsForProductResponse.fromJson( + public ListProductVariantsResponse listProductVariants(String productId) + throws ChargebeeException { + Response response = listProductVariantsRaw(productId); + return ListProductVariantsResponse.fromJson( response.getBodyAsString(), this, null, productId, response); } - /** addVariantForProduct a variant (executes immediately) - returns raw Response. */ - Response addVariantForProductRaw(String productId) throws Exception { + /** createProductVariant a variant (executes immediately) - returns raw Response. */ + Response createProductVariantRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); return post(path, null); } /** - * addVariantForProduct a variant using immutable params (executes immediately) - returns raw + * createProductVariant a variant using immutable params (executes immediately) - returns raw * Response. */ - Response addVariantForProductRaw(String productId, AddVariantForProductParams params) - throws Exception { + Response createProductVariantRaw(String productId, CreateProductVariantParams params) + throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); return post(path, params.toFormData()); } /** - * addVariantForProduct a variant using raw JSON payload (executes immediately) - returns raw + * createProductVariant a variant using raw JSON payload (executes immediately) - returns raw * Response. */ - Response addVariantForProductRaw(String productId, String jsonPayload) throws Exception { + Response createProductVariantRaw(String productId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); return postJson(path, jsonPayload); } - public AddVariantForProductResponse addVariantForProduct( - String productId, AddVariantForProductParams params) throws Exception { - Response response = addVariantForProductRaw(productId, params); - return AddVariantForProductResponse.fromJson(response.getBodyAsString(), response); + public CreateProductVariantResponse createProductVariant( + String productId, CreateProductVariantParams params) throws ChargebeeException { + Response response = createProductVariantRaw(productId, params); + return CreateProductVariantResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a variant (executes immediately) - returns raw Response. */ - Response retrieveRaw(String productVariantId) throws Exception { + Response retrieveRaw(String productVariantId) throws ChargebeeException { String path = buildPathWithParams( "/variants/{product-variant-id}", "product-variant-id", productVariantId); @@ -140,13 +142,13 @@ Response retrieveRaw(String productVariantId) throws Exception { return get(path, null); } - public VariantRetrieveResponse retrieve(String productVariantId) throws Exception { + public VariantRetrieveResponse retrieve(String productVariantId) throws ChargebeeException { Response response = retrieveRaw(productVariantId); return VariantRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a variant (executes immediately) - returns raw Response. */ - Response updateRaw(String productVariantId) throws Exception { + Response updateRaw(String productVariantId) throws ChargebeeException { String path = buildPathWithParams( "/variants/{product-variant-id}", "product-variant-id", productVariantId); @@ -155,7 +157,8 @@ Response updateRaw(String productVariantId) throws Exception { } /** update a variant using immutable params (executes immediately) - returns raw Response. */ - Response updateRaw(String productVariantId, VariantUpdateParams params) throws Exception { + Response updateRaw(String productVariantId, VariantUpdateParams params) + throws ChargebeeException { String path = buildPathWithParams( "/variants/{product-variant-id}", "product-variant-id", productVariantId); @@ -163,7 +166,7 @@ Response updateRaw(String productVariantId, VariantUpdateParams params) throws E } /** update a variant using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String productVariantId, String jsonPayload) throws Exception { + Response updateRaw(String productVariantId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/variants/{product-variant-id}", "product-variant-id", productVariantId); @@ -171,13 +174,13 @@ Response updateRaw(String productVariantId, String jsonPayload) throws Exception } public VariantUpdateResponse update(String productVariantId, VariantUpdateParams params) - throws Exception { + throws ChargebeeException { Response response = updateRaw(productVariantId, params); return VariantUpdateResponse.fromJson(response.getBodyAsString(), response); } - /** deleteVariant a variant (executes immediately) - returns raw Response. */ - Response deleteVariantRaw(String productVariantId) throws Exception { + /** delete a variant (executes immediately) - returns raw Response. */ + Response deleteRaw(String productVariantId) throws ChargebeeException { String path = buildPathWithParams( "/variants/{product-variant-id}/delete", "product-variant-id", productVariantId); @@ -185,8 +188,8 @@ Response deleteVariantRaw(String productVariantId) throws Exception { return post(path, null); } - public DeleteVariantResponse deleteVariant(String productVariantId) throws Exception { - Response response = deleteVariantRaw(productVariantId); - return DeleteVariantResponse.fromJson(response.getBodyAsString(), response); + public VariantDeleteResponse delete(String productVariantId) throws ChargebeeException { + Response response = deleteRaw(productVariantId); + return VariantDeleteResponse.fromJson(response.getBodyAsString(), response); } } diff --git a/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java b/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java index f4811202..24a952f6 100644 --- a/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java +++ b/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.virtualBankAccount.params.VirtualBankAccountListParams; @@ -17,15 +18,15 @@ import com.chargebee.v4.models.virtualBankAccount.params.VirtualBankAccountCreateUsingPermanentTokenParams; -import com.chargebee.v4.models.virtualBankAccount.responses.DeleteLocalForVirtualBankAccountResponse; +import com.chargebee.v4.models.virtualBankAccount.responses.VirtualBankAccountDeleteLocalResponse; -import com.chargebee.v4.models.virtualBankAccount.responses.DeleteVirtualBankAccountResponse; +import com.chargebee.v4.models.virtualBankAccount.responses.VirtualBankAccountDeleteResponse; import com.chargebee.v4.models.virtualBankAccount.responses.VirtualBankAccountListResponse; import com.chargebee.v4.models.virtualBankAccount.responses.VirtualBankAccountCreateResponse; -import com.chargebee.v4.models.virtualBankAccount.responses.SyncFundForVirtualBankAccountResponse; +import com.chargebee.v4.models.virtualBankAccount.responses.VirtualBankAccountSyncFundResponse; import com.chargebee.v4.models.virtualBankAccount.responses.VirtualBankAccountRetrieveResponse; @@ -66,11 +67,8 @@ public VirtualBankAccountService withOptions(RequestOptions options) { // === Operations === - /** - * deleteLocalForVirtualBankAccount a virtualBankAccount (executes immediately) - returns raw - * Response. - */ - Response deleteLocalForVirtualBankAccountRaw(String virtualBankAccountId) throws Exception { + /** deleteLocal a virtualBankAccount (executes immediately) - returns raw Response. */ + Response deleteLocalRaw(String virtualBankAccountId) throws ChargebeeException { String path = buildPathWithParams( "/virtual_bank_accounts/{virtual-bank-account-id}/delete_local", @@ -80,16 +78,14 @@ Response deleteLocalForVirtualBankAccountRaw(String virtualBankAccountId) throws return post(path, null); } - public DeleteLocalForVirtualBankAccountResponse deleteLocalForVirtualBankAccount( - String virtualBankAccountId) throws Exception { - Response response = deleteLocalForVirtualBankAccountRaw(virtualBankAccountId); - return DeleteLocalForVirtualBankAccountResponse.fromJson(response.getBodyAsString(), response); + public VirtualBankAccountDeleteLocalResponse deleteLocal(String virtualBankAccountId) + throws ChargebeeException { + Response response = deleteLocalRaw(virtualBankAccountId); + return VirtualBankAccountDeleteLocalResponse.fromJson(response.getBodyAsString(), response); } - /** - * deleteVirtualBankAccount a virtualBankAccount (executes immediately) - returns raw Response. - */ - Response deleteVirtualBankAccountRaw(String virtualBankAccountId) throws Exception { + /** delete a virtualBankAccount (executes immediately) - returns raw Response. */ + Response deleteRaw(String virtualBankAccountId) throws ChargebeeException { String path = buildPathWithParams( "/virtual_bank_accounts/{virtual-bank-account-id}/delete", @@ -99,22 +95,22 @@ Response deleteVirtualBankAccountRaw(String virtualBankAccountId) throws Excepti return post(path, null); } - public DeleteVirtualBankAccountResponse deleteVirtualBankAccount(String virtualBankAccountId) - throws Exception { - Response response = deleteVirtualBankAccountRaw(virtualBankAccountId); - return DeleteVirtualBankAccountResponse.fromJson(response.getBodyAsString(), response); + public VirtualBankAccountDeleteResponse delete(String virtualBankAccountId) + throws ChargebeeException { + Response response = deleteRaw(virtualBankAccountId); + return VirtualBankAccountDeleteResponse.fromJson(response.getBodyAsString(), response); } /** * list a virtualBankAccount using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(VirtualBankAccountListParams params) throws Exception { + Response listRaw(VirtualBankAccountListParams params) throws ChargebeeException { return get("/virtual_bank_accounts", params != null ? params.toQueryParams() : null); } /** list a virtualBankAccount without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/virtual_bank_accounts", null); } @@ -122,19 +118,20 @@ Response listRaw() throws Exception { /** * list a virtualBankAccount using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public VirtualBankAccountListResponse list(VirtualBankAccountListParams params) throws Exception { + public VirtualBankAccountListResponse list(VirtualBankAccountListParams params) + throws ChargebeeException { Response response = listRaw(params); return VirtualBankAccountListResponse.fromJson( response.getBodyAsString(), this, params, response); } - public VirtualBankAccountListResponse list() throws Exception { + public VirtualBankAccountListResponse list() throws ChargebeeException { Response response = listRaw(); return VirtualBankAccountListResponse.fromJson( response.getBodyAsString(), this, null, response); @@ -144,7 +141,7 @@ public VirtualBankAccountListResponse list() throws Exception { * create a virtualBankAccount using immutable params (executes immediately) - returns raw * Response. */ - Response createRaw(VirtualBankAccountCreateParams params) throws Exception { + Response createRaw(VirtualBankAccountCreateParams params) throws ChargebeeException { return post("/virtual_bank_accounts", params != null ? params.toFormData() : null); } @@ -153,23 +150,20 @@ Response createRaw(VirtualBankAccountCreateParams params) throws Exception { * create a virtualBankAccount using raw JSON payload (executes immediately) - returns raw * Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/virtual_bank_accounts", jsonPayload); } public VirtualBankAccountCreateResponse create(VirtualBankAccountCreateParams params) - throws Exception { + throws ChargebeeException { Response response = createRaw(params); return VirtualBankAccountCreateResponse.fromJson(response.getBodyAsString(), response); } - /** - * syncFundForVirtualBankAccount a virtualBankAccount (executes immediately) - returns raw - * Response. - */ - Response syncFundForVirtualBankAccountRaw(String virtualBankAccountId) throws Exception { + /** syncFund a virtualBankAccount (executes immediately) - returns raw Response. */ + Response syncFundRaw(String virtualBankAccountId) throws ChargebeeException { String path = buildPathWithParams( "/virtual_bank_accounts/{virtual-bank-account-id}/sync_fund", @@ -179,14 +173,14 @@ Response syncFundForVirtualBankAccountRaw(String virtualBankAccountId) throws Ex return post(path, null); } - public SyncFundForVirtualBankAccountResponse syncFundForVirtualBankAccount( - String virtualBankAccountId) throws Exception { - Response response = syncFundForVirtualBankAccountRaw(virtualBankAccountId); - return SyncFundForVirtualBankAccountResponse.fromJson(response.getBodyAsString(), response); + public VirtualBankAccountSyncFundResponse syncFund(String virtualBankAccountId) + throws ChargebeeException { + Response response = syncFundRaw(virtualBankAccountId); + return VirtualBankAccountSyncFundResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a virtualBankAccount (executes immediately) - returns raw Response. */ - Response retrieveRaw(String virtualBankAccountId) throws Exception { + Response retrieveRaw(String virtualBankAccountId) throws ChargebeeException { String path = buildPathWithParams( "/virtual_bank_accounts/{virtual-bank-account-id}", @@ -196,7 +190,8 @@ Response retrieveRaw(String virtualBankAccountId) throws Exception { return get(path, null); } - public VirtualBankAccountRetrieveResponse retrieve(String virtualBankAccountId) throws Exception { + public VirtualBankAccountRetrieveResponse retrieve(String virtualBankAccountId) + throws ChargebeeException { Response response = retrieveRaw(virtualBankAccountId); return VirtualBankAccountRetrieveResponse.fromJson(response.getBodyAsString(), response); } @@ -206,7 +201,7 @@ public VirtualBankAccountRetrieveResponse retrieve(String virtualBankAccountId) * returns raw Response. */ Response createUsingPermanentTokenRaw(VirtualBankAccountCreateUsingPermanentTokenParams params) - throws Exception { + throws ChargebeeException { return post( "/virtual_bank_accounts/create_using_permanent_token", @@ -217,13 +212,13 @@ Response createUsingPermanentTokenRaw(VirtualBankAccountCreateUsingPermanentToke * createUsingPermanentToken a virtualBankAccount using raw JSON payload (executes immediately) - * returns raw Response. */ - Response createUsingPermanentTokenRaw(String jsonPayload) throws Exception { + Response createUsingPermanentTokenRaw(String jsonPayload) throws ChargebeeException { return postJson("/virtual_bank_accounts/create_using_permanent_token", jsonPayload); } public VirtualBankAccountCreateUsingPermanentTokenResponse createUsingPermanentToken( - VirtualBankAccountCreateUsingPermanentTokenParams params) throws Exception { + VirtualBankAccountCreateUsingPermanentTokenParams params) throws ChargebeeException { Response response = createUsingPermanentTokenRaw(params); return VirtualBankAccountCreateUsingPermanentTokenResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java b/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java index cc45aedc..4d3589a9 100644 --- a/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java +++ b/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java @@ -9,6 +9,7 @@ import com.chargebee.v4.client.ChargebeeClient; import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; import com.chargebee.v4.models.webhookEndpoint.params.WebhookEndpointUpdateParams; @@ -17,7 +18,7 @@ import com.chargebee.v4.models.webhookEndpoint.params.WebhookEndpointCreateParams; -import com.chargebee.v4.models.webhookEndpoint.responses.DeleteWebhookEndpointResponse; +import com.chargebee.v4.models.webhookEndpoint.responses.WebhookEndpointDeleteResponse; import com.chargebee.v4.models.webhookEndpoint.responses.WebhookEndpointRetrieveResponse; @@ -62,8 +63,8 @@ public WebhookEndpointService withOptions(RequestOptions options) { // === Operations === - /** deleteWebhookEndpoint a webhookEndpoint (executes immediately) - returns raw Response. */ - Response deleteWebhookEndpointRaw(String webhookEndpointId) throws Exception { + /** delete a webhookEndpoint (executes immediately) - returns raw Response. */ + Response deleteRaw(String webhookEndpointId) throws ChargebeeException { String path = buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}/delete", @@ -73,14 +74,13 @@ Response deleteWebhookEndpointRaw(String webhookEndpointId) throws Exception { return post(path, null); } - public DeleteWebhookEndpointResponse deleteWebhookEndpoint(String webhookEndpointId) - throws Exception { - Response response = deleteWebhookEndpointRaw(webhookEndpointId); - return DeleteWebhookEndpointResponse.fromJson(response.getBodyAsString(), response); + public WebhookEndpointDeleteResponse delete(String webhookEndpointId) throws ChargebeeException { + Response response = deleteRaw(webhookEndpointId); + return WebhookEndpointDeleteResponse.fromJson(response.getBodyAsString(), response); } /** retrieve a webhookEndpoint (executes immediately) - returns raw Response. */ - Response retrieveRaw(String webhookEndpointId) throws Exception { + Response retrieveRaw(String webhookEndpointId) throws ChargebeeException { String path = buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); @@ -88,13 +88,14 @@ Response retrieveRaw(String webhookEndpointId) throws Exception { return get(path, null); } - public WebhookEndpointRetrieveResponse retrieve(String webhookEndpointId) throws Exception { + public WebhookEndpointRetrieveResponse retrieve(String webhookEndpointId) + throws ChargebeeException { Response response = retrieveRaw(webhookEndpointId); return WebhookEndpointRetrieveResponse.fromJson(response.getBodyAsString(), response); } /** update a webhookEndpoint (executes immediately) - returns raw Response. */ - Response updateRaw(String webhookEndpointId) throws Exception { + Response updateRaw(String webhookEndpointId) throws ChargebeeException { String path = buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); @@ -106,7 +107,7 @@ Response updateRaw(String webhookEndpointId) throws Exception { * update a webhookEndpoint using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String webhookEndpointId, WebhookEndpointUpdateParams params) - throws Exception { + throws ChargebeeException { String path = buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); @@ -116,7 +117,7 @@ Response updateRaw(String webhookEndpointId, WebhookEndpointUpdateParams params) /** * update a webhookEndpoint using raw JSON payload (executes immediately) - returns raw Response. */ - Response updateRaw(String webhookEndpointId, String jsonPayload) throws Exception { + Response updateRaw(String webhookEndpointId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); @@ -124,7 +125,7 @@ Response updateRaw(String webhookEndpointId, String jsonPayload) throws Exceptio } public WebhookEndpointUpdateResponse update( - String webhookEndpointId, WebhookEndpointUpdateParams params) throws Exception { + String webhookEndpointId, WebhookEndpointUpdateParams params) throws ChargebeeException { Response response = updateRaw(webhookEndpointId, params); return WebhookEndpointUpdateResponse.fromJson(response.getBodyAsString(), response); } @@ -132,13 +133,13 @@ public WebhookEndpointUpdateResponse update( /** * list a webhookEndpoint using immutable params (executes immediately) - returns raw Response. */ - Response listRaw(WebhookEndpointListParams params) throws Exception { + Response listRaw(WebhookEndpointListParams params) throws ChargebeeException { return get("/webhook_endpoints", params != null ? params.toQueryParams() : null); } /** list a webhookEndpoint without params (executes immediately) - returns raw Response. */ - Response listRaw() throws Exception { + Response listRaw() throws ChargebeeException { return get("/webhook_endpoints", null); } @@ -146,18 +147,19 @@ Response listRaw() throws Exception { /** * list a webhookEndpoint using raw JSON payload (executes immediately) - returns raw Response. */ - Response listRaw(String jsonPayload) throws Exception { + Response listRaw(String jsonPayload) throws ChargebeeException { throw new UnsupportedOperationException("JSON payload not supported for GET operations"); } - public WebhookEndpointListResponse list(WebhookEndpointListParams params) throws Exception { + public WebhookEndpointListResponse list(WebhookEndpointListParams params) + throws ChargebeeException { Response response = listRaw(params); return WebhookEndpointListResponse.fromJson(response.getBodyAsString(), this, params, response); } - public WebhookEndpointListResponse list() throws Exception { + public WebhookEndpointListResponse list() throws ChargebeeException { Response response = listRaw(); return WebhookEndpointListResponse.fromJson(response.getBodyAsString(), this, null, response); } @@ -165,7 +167,7 @@ public WebhookEndpointListResponse list() throws Exception { /** * create a webhookEndpoint using immutable params (executes immediately) - returns raw Response. */ - Response createRaw(WebhookEndpointCreateParams params) throws Exception { + Response createRaw(WebhookEndpointCreateParams params) throws ChargebeeException { return post("/webhook_endpoints", params != null ? params.toFormData() : null); } @@ -173,12 +175,13 @@ Response createRaw(WebhookEndpointCreateParams params) throws Exception { /** * create a webhookEndpoint using raw JSON payload (executes immediately) - returns raw Response. */ - Response createRaw(String jsonPayload) throws Exception { + Response createRaw(String jsonPayload) throws ChargebeeException { return postJson("/webhook_endpoints", jsonPayload); } - public WebhookEndpointCreateResponse create(WebhookEndpointCreateParams params) throws Exception { + public WebhookEndpointCreateResponse create(WebhookEndpointCreateParams params) + throws ChargebeeException { Response response = createRaw(params); return WebhookEndpointCreateResponse.fromJson(response.getBodyAsString(), response); diff --git a/src/main/java/com/chargebee/v4/transport/DefaultTransport.java b/src/main/java/com/chargebee/v4/transport/DefaultTransport.java index 3a3d7da3..7c43abd3 100644 --- a/src/main/java/com/chargebee/v4/transport/DefaultTransport.java +++ b/src/main/java/com/chargebee/v4/transport/DefaultTransport.java @@ -45,7 +45,7 @@ public DefaultTransport(TransportConfig config) { } @Override - public Response send(Request request) throws TransportException { + public Response send(Request request) { RequestLogger logger = config.getRequestLogger(); long startTime = System.currentTimeMillis(); @@ -126,7 +126,7 @@ public CompletableFuture sendAsync(Request request) { return future; } - private HttpURLConnection createConnection(Request request) throws IOException, TransportException { + private HttpURLConnection createConnection(Request request) throws IOException { String fullUrl = buildFullUrl(request); URL url; @@ -283,7 +283,7 @@ private void writeRequestBody(HttpURLConnection connection, Request request) thr } } - private Response readResponse(HttpURLConnection connection) throws IOException, TransportException { + private Response readResponse(HttpURLConnection connection) throws IOException { int statusCode = connection.getResponseCode(); Map> headers = connection.getHeaderFields(); diff --git a/src/main/java/com/chargebee/v4/transport/Transport.java b/src/main/java/com/chargebee/v4/transport/Transport.java index 4b1fa07a..1b6813ef 100644 --- a/src/main/java/com/chargebee/v4/transport/Transport.java +++ b/src/main/java/com/chargebee/v4/transport/Transport.java @@ -16,10 +16,8 @@ public interface Transport { * * @param request the HTTP request to send * @return the HTTP response - * @throws TransportException for network, timeout, or configuration failures - * @throws HttpException for HTTP error status codes (4xx, 5xx) */ - Response send(Request request) throws TransportException; + Response send(Request request); /** * Send an HTTP request asynchronously and return a CompletableFuture with the response. diff --git a/src/main/java/com/chargebee/v4/webhook/UnhandledEventCallback.java b/src/main/java/com/chargebee/v4/webhook/UnhandledEventCallback.java new file mode 100644 index 00000000..ef593a43 --- /dev/null +++ b/src/main/java/com/chargebee/v4/webhook/UnhandledEventCallback.java @@ -0,0 +1,36 @@ +/* + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.webhook; + +import com.chargebee.v4.models.event.Event; + +/** + * Functional interface for handling unregistered/unhandled Chargebee webhook events. + * + *

This interface is invoked when no specific handler is registered for an event type. + * This allows you to log, store, or process unknown/unhandled events.

+ * + *

Example usage:

+ *
+ * UnhandledEventCallback fallbackHandler = (event, eventType, rawPayload) -> {
+ *     log.warn("Unhandled event: type={}, id={}", eventType, event.getId());
+ *     return WebhookResult.unhandled(eventType, event.getId());
+ * };
+ * 
+ */ +@FunctionalInterface +public interface UnhandledEventCallback { + + /** + * Handles an unhandled/unregistered webhook event and returns the processing result. + * + * @param event The base Event object (with content as Map) + * @param eventType The event type string that was not handled + * @param rawPayload The raw JSON payload (for custom parsing if needed) + * @return WebhookResult indicating the outcome of processing + * @throws Exception if event processing fails + */ + WebhookResult handle(Event event, String eventType, String rawPayload) throws Exception; +} diff --git a/src/main/java/com/chargebee/v4/webhook/WebhookEventCallback.java b/src/main/java/com/chargebee/v4/webhook/WebhookEventCallback.java new file mode 100644 index 00000000..5d99ad4c --- /dev/null +++ b/src/main/java/com/chargebee/v4/webhook/WebhookEventCallback.java @@ -0,0 +1,35 @@ +/* + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.webhook; + +/** + * Functional interface for handling Chargebee webhook events. + * + *

Implement this interface to create handlers for specific event types. + * The callback receives the fully typed event object from the SDK.

+ * + *

Example usage:

+ *
+ * handler.on(Event.EventType.CUSTOMER_CREATED, CustomerCreatedEvent.class, (typedEvent) -> {
+ *     Customer customer = typedEvent.getContent().getCustomer();
+ *     System.out.println("New customer: " + customer.getId());
+ *     return WebhookResult.success(typedEvent.getEventType(), typedEvent.getId());
+ * });
+ * 
+ * + * @param The typed event class (e.g., CustomerCreatedEvent, SubscriptionCreatedEvent) + */ +@FunctionalInterface +public interface WebhookEventCallback { + + /** + * Handles a webhook event and returns the processing result. + * + * @param typedEvent The typed event object with strongly-typed content + * @return WebhookResult indicating the outcome of processing + * @throws Exception if event processing fails + */ + WebhookResult handle(T typedEvent) throws Exception; +} diff --git a/src/main/java/com/chargebee/v4/webhook/WebhookEventHandler.java b/src/main/java/com/chargebee/v4/webhook/WebhookEventHandler.java new file mode 100644 index 00000000..00517a2e --- /dev/null +++ b/src/main/java/com/chargebee/v4/webhook/WebhookEventHandler.java @@ -0,0 +1,340 @@ +/* + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.webhook; + +import com.chargebee.v4.models.event.Event; + +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + +/** + * Central handler for processing Chargebee webhook events. + * + *

This class provides a fluent API for registering event callbacks and processing + * incoming webhook notifications. It handles optional Basic Auth verification, event + * parsing, and routing to appropriate handlers.

+ * + *

Quick Start:

+ *
+ * // Create the handler
+ * WebhookEventHandler handler = WebhookEventHandler.create();
+ * 
+ * // Register callbacks for specific event types (class is auto-resolved via type witness)
+ * handler.<CustomerCreatedEvent>on(Event.EventType.CUSTOMER_CREATED, event -> {
+ *     Customer customer = event.getContent().getCustomer();
+ *     System.out.println("Customer created: " + customer.getEmail());
+ *     return WebhookResult.success(event.getEventType(), event.getId());
+ * });
+ * 
+ * handler.<SubscriptionCancelledEvent>on(Event.EventType.SUBSCRIPTION_CANCELLED, event -> {
+ *     Subscription sub = event.getContent().getSubscription();
+ *     System.out.println("Subscription cancelled: " + sub.getId());
+ *     return WebhookResult.success(event.getEventType(), event.getId());
+ * });
+ * 
+ * // Process incoming webhook (in your controller)
+ * WebhookResult result = handler.handleWebhook(requestBody);
+ * 
+ * + *

With Basic Auth (Optional):

+ *
+ * WebhookEventHandler handler = WebhookEventHandler.builder()
+ *     .basicAuth("username", "password")
+ *     .fallbackCallback((event, eventType, rawPayload) -> {
+ *         System.out.println("Unhandled event: " + eventType);
+ *         return WebhookResult.unhandled(eventType, event.getId());
+ *     })
+ *     .build();
+ * 
+ * // Process with auth verification
+ * WebhookResult result = handler.handleWebhook(requestBody, authorizationHeader);
+ * 
+ * + *

Common Event Types:

+ *
    + *
  • customer_created, customer_changed, customer_deleted
  • + *
  • subscription_created, subscription_activated, subscription_cancelled, subscription_renewed
  • + *
  • invoice_generated, invoice_updated, invoice_deleted
  • + *
  • payment_succeeded, payment_failed, payment_refunded
  • + *
  • card_added, card_updated, card_expired
  • + *
+ * + * @see WebhookEventCallback + * @see UnhandledEventCallback + * @see WebhookResult + */ +public class WebhookEventHandler { + + private final String webhookUsername; + private final String webhookPassword; + private final WebhookVerifier webhookVerifier; + private final UnhandledEventCallback fallbackCallback; + private final Map> callbacks; + + private WebhookEventHandler(Builder builder) { + this.webhookUsername = builder.webhookUsername; + this.webhookPassword = builder.webhookPassword; + this.webhookVerifier = builder.webhookVerifier; + this.fallbackCallback = builder.fallbackCallback; + this.callbacks = new ConcurrentHashMap<>(); + } + + /** + * Creates a simple WebhookEventHandler without authentication. + * + * @return A new WebhookEventHandler instance + */ + public static WebhookEventHandler create() { + return builder().build(); + } + + /** + * Creates a new builder for WebhookEventHandler. + * + * @return A new Builder instance + */ + public static Builder builder() { + return new Builder(); + } + + private static final String EVENT_CLASS_PACKAGE = "com.chargebee.v4.models.event"; + + /** + * Registers a callback for a specific event type. + * The event class is automatically derived from the event type. + * + *

Usage with type witness:

+ *
+     * handler.<CustomerCreatedEvent>on(Event.EventType.CUSTOMER_CREATED, event -> {
+     *     Customer customer = event.getContent().getCustomer();
+     *     return WebhookResult.success(event.getEventType(), event.getId());
+     * });
+     * 
+ * + * @param eventType The event type enum value (e.g., Event.EventType.CUSTOMER_CREATED) + * @param callback The callback to invoke when this event type is received + * @param The type of the event class + * @return This handler for method chaining + * @throws WebhookException if the event class cannot be found + */ + @SuppressWarnings("unchecked") + public WebhookEventHandler on(Event.EventType eventType, WebhookEventCallback callback) { + String eventTypeValue = eventType.getValue(); + if (eventTypeValue == null) { + throw new WebhookException("Event type value cannot be null"); + } + Class eventClass = (Class) resolveEventClass(eventTypeValue); + callbacks.put(eventTypeValue, new EventCallbackWrapper<>(eventClass, callback)); + return this; + } + + /** + * Resolves the event class from the event type string. + * Converts snake_case event type to PascalCase class name. + * e.g., "customer_moved_in" -> CustomerMovedInEvent + * + * @param eventType The event type string (e.g., "customer_moved_in") + * @return The resolved event class + * @throws WebhookException if the class cannot be found + */ + private Class resolveEventClass(String eventType) { + String className = Arrays.stream(eventType.split("_")) + .map(word -> word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase()) + .collect(Collectors.joining()) + "Event"; + + String fullClassName = EVENT_CLASS_PACKAGE + "." + className; + + try { + return Class.forName(fullClassName); + } catch (ClassNotFoundException e) { + throw new WebhookException("Event class not found: " + fullClassName + + ". Ensure the event type '" + eventType + "' is supported.", e); + } + } + + /** + * Processes an incoming webhook request without authentication. + * + * @param payload The raw request body (JSON) + * @return WebhookResult from the callback + * @throws WebhookException if processing fails + */ + public WebhookResult handleWebhook(String payload) { + return handleWebhook(payload, null); + } + + /** + * Processes an incoming webhook request with optional authentication. + * + *

This method:

+ *
    + *
  1. Verifies Basic Auth credentials (if configured)
  2. + *
  3. Parses the payload to determine event type
  4. + *
  5. Parses the payload to the typed event class
  6. + *
  7. Routes to the appropriate registered callback or fallback
  8. + *
  9. Returns the WebhookResult from the callback
  10. + *
+ * + * @param payload The raw request body (JSON) + * @param authorizationHeader The Authorization header value (can be null) + * @return WebhookResult from the callback + * @throws WebhookException if processing fails + */ + public WebhookResult handleWebhook(String payload, String authorizationHeader) { + // Verify Basic Auth if configured + if (webhookUsername != null && !webhookUsername.isEmpty() && + webhookPassword != null && !webhookPassword.isEmpty()) { + + if (webhookVerifier == null) { + throw new WebhookException("Basic Auth is configured but verifier is not set"); + } + + if (!webhookVerifier.verifyBasicAuth(authorizationHeader, webhookUsername, webhookPassword)) { + return WebhookResult.failure("Invalid webhook credentials"); + } + } + + // Parse the event to get event type + Event event; + try { + event = Event.fromJson(payload); + } catch (Exception e) { + throw new WebhookException("Failed to parse webhook payload", e); + } + + if (event.getEventType() == null) { + return WebhookResult.failure("Event type is missing"); + } + + String eventType = event.getEventType().getValue(); + + if (eventType == null) { + return WebhookResult.failure("Event type value is null"); + } + + // Route to appropriate callback + EventCallbackWrapper wrapper = callbacks.get(eventType); + + try { + if (wrapper != null) { + return invokeCallback(wrapper, payload); + } else if (fallbackCallback != null) { + return fallbackCallback.handle(event, eventType, payload); + } else { + return WebhookResult.unhandled(eventType, event.getId()); + } + } catch (Exception e) { + throw new WebhookException("Failed to process webhook event: " + eventType, e); + } + } + + /** + * Checks if a callback is registered for the given event type. + * + * @param eventType The event type to check + * @return true if a callback is registered + */ + public boolean hasCallback(String eventType) { + return callbacks.containsKey(eventType); + } + + /** + * Returns the number of registered callbacks. + * + * @return The number of registered callbacks + */ + public int getRegisteredCallbackCount() { + return callbacks.size(); + } + + @SuppressWarnings("unchecked") + private WebhookResult invokeCallback(EventCallbackWrapper wrapper, String payload) throws Exception { + // Parse to typed event using the event class's fromJson method + Method fromJsonMethod = wrapper.eventClass.getMethod("fromJson", String.class); + T typedEvent = (T) fromJsonMethod.invoke(null, payload); + return wrapper.callback.handle(typedEvent); + } + + private static class EventCallbackWrapper { + final Class eventClass; + final WebhookEventCallback callback; + + EventCallbackWrapper(Class eventClass, WebhookEventCallback callback) { + this.eventClass = eventClass; + this.callback = callback; + } + } + + /** + * Builder for WebhookEventHandler. + */ + public static class Builder { + private String webhookUsername; + private String webhookPassword; + private WebhookVerifier webhookVerifier; + private UnhandledEventCallback fallbackCallback; + + /** + * Configures Basic Auth credentials for webhook verification (optional). + * + * @param username The username configured in Chargebee webhook settings + * @param password The password configured in Chargebee webhook settings + * @return This builder + */ + public Builder basicAuth(String username, String password) { + this.webhookUsername = username; + this.webhookPassword = password; + this.webhookVerifier = new WebhookVerifier(); + return this; + } + + /** + * Sets a custom webhook verifier instance. + * + * @param webhookVerifier The WebhookVerifier to use + * @return This builder + */ + public Builder webhookVerifier(WebhookVerifier webhookVerifier) { + this.webhookVerifier = webhookVerifier; + return this; + } + + /** + * Sets the fallback callback for unhandled events. + * + * @param fallbackCallback The callback for unregistered event types + * @return This builder + */ + public Builder fallbackCallback(UnhandledEventCallback fallbackCallback) { + this.fallbackCallback = fallbackCallback; + return this; + } + + /** + * Builds the WebhookEventHandler. + * + * @return The configured WebhookEventHandler + */ + public WebhookEventHandler build() { + return new WebhookEventHandler(this); + } + } + + /** + * Exception thrown when webhook processing fails. + */ + public static class WebhookException extends RuntimeException { + public WebhookException(String message) { + super(message); + } + + public WebhookException(String message, Throwable cause) { + super(message, cause); + } + } +} diff --git a/src/main/java/com/chargebee/v4/webhook/WebhookResult.java b/src/main/java/com/chargebee/v4/webhook/WebhookResult.java new file mode 100644 index 00000000..1dd6fa92 --- /dev/null +++ b/src/main/java/com/chargebee/v4/webhook/WebhookResult.java @@ -0,0 +1,112 @@ +/* + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.webhook; + +/** + * Result of webhook processing. + * + *

This class represents the outcome of processing a Chargebee webhook event. + * Use the static factory methods to create appropriate results:

+ *
    + *
  • {@link #success(String, String)} - Event processed successfully
  • + *
  • {@link #unhandled(String, String)} - Event received but no handler registered
  • + *
  • {@link #failure(String)} - Event processing failed
  • + *
+ */ +public class WebhookResult { + + private final boolean success; + private final boolean handled; + private final String eventType; + private final String eventId; + private final String errorMessage; + + private WebhookResult(boolean success, boolean handled, String eventType, String eventId, String errorMessage) { + this.success = success; + this.handled = handled; + this.eventType = eventType; + this.eventId = eventId; + this.errorMessage = errorMessage; + } + + /** + * Creates a success result indicating the event was processed successfully. + * + * @param eventType The event type that was processed + * @param eventId The event ID + * @return A success WebhookResult + */ + public static WebhookResult success(String eventType, String eventId) { + return new WebhookResult(true, true, eventType, eventId, null); + } + + /** + * Creates an unhandled result indicating the event was received but no handler was registered. + * + * @param eventType The event type + * @param eventId The event ID + * @return An unhandled WebhookResult + */ + public static WebhookResult unhandled(String eventType, String eventId) { + return new WebhookResult(true, false, eventType, eventId, null); + } + + /** + * Creates a failure result indicating the event processing failed. + * + * @param errorMessage Description of the failure + * @return A failure WebhookResult + */ + public static WebhookResult failure(String errorMessage) { + return new WebhookResult(false, false, null, null, errorMessage); + } + + /** + * @return true if the webhook was processed without errors + */ + public boolean isSuccess() { + return success; + } + + /** + * @return true if a handler was found and executed for this event + */ + public boolean isHandled() { + return handled; + } + + /** + * @return The event type that was processed, or null on failure + */ + public String getEventType() { + return eventType; + } + + /** + * @return The event ID, or null on failure + */ + public String getEventId() { + return eventId; + } + + /** + * @return Error message if processing failed, null otherwise + */ + public String getErrorMessage() { + return errorMessage; + } + + @Override + public String toString() { + return "WebhookResult{" + + "success=" + success + + ", handled=" + handled + + ", eventType='" + eventType + '\'' + + ", eventId='" + eventId + '\'' + + ", errorMessage='" + errorMessage + '\'' + + '}'; + } +} + diff --git a/src/main/java/com/chargebee/v4/webhook/WebhookVerifier.java b/src/main/java/com/chargebee/v4/webhook/WebhookVerifier.java new file mode 100644 index 00000000..092ba7e8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/webhook/WebhookVerifier.java @@ -0,0 +1,141 @@ +/* + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.webhook; + +import java.nio.charset.StandardCharsets; +import java.util.Base64; + +/** + * Utility class for verifying Chargebee webhook requests using HTTP Basic Authentication. + * + *

Chargebee supports optional HTTP Basic Authentication for webhooks. When configured, + * Chargebee sends the username and password in the Authorization header as Base64-encoded + * credentials.

+ * + *

To enable webhook authentication in Chargebee:

+ *
    + *
  1. Go to Settings → Configure Chargebee → Webhooks
  2. + *
  3. Edit your webhook endpoint
  4. + *
  5. Enable "Basic Authentication" and set username/password
  6. + *
+ * + *

Usage example:

+ *
+ * WebhookVerifier verifier = new WebhookVerifier();
+ * boolean isValid = verifier.verifyBasicAuth(
+ *     authorizationHeader,
+ *     expectedUsername,
+ *     expectedPassword
+ * );
+ * 
+ * + * @see Chargebee Events API + */ +public class WebhookVerifier { + + private static final String BASIC_AUTH_PREFIX = "Basic "; + + /** + * Verifies the webhook request using HTTP Basic Authentication. + * + *

Chargebee sends credentials in the Authorization header as: + * "Basic base64(username:password)"

+ * + * @param authorizationHeader The Authorization header value from the request + * @param expectedUsername The expected username configured in Chargebee + * @param expectedPassword The expected password configured in Chargebee + * @return true if credentials match, false otherwise + */ + public boolean verifyBasicAuth(String authorizationHeader, String expectedUsername, String expectedPassword) { + if (authorizationHeader == null || !authorizationHeader.startsWith(BASIC_AUTH_PREFIX)) { + return false; + } + + if (expectedUsername == null || expectedPassword == null) { + return false; + } + + try { + // Extract Base64 encoded credentials + String base64Credentials = authorizationHeader.substring(BASIC_AUTH_PREFIX.length()).trim(); + + // Decode credentials + byte[] decodedBytes = Base64.getDecoder().decode(base64Credentials); + String decodedCredentials = new String(decodedBytes, StandardCharsets.UTF_8); + + // Split into username:password + int colonIndex = decodedCredentials.indexOf(':'); + if (colonIndex == -1) { + return false; + } + + String receivedUsername = decodedCredentials.substring(0, colonIndex); + String receivedPassword = decodedCredentials.substring(colonIndex + 1); + + // Use constant-time comparison to prevent timing attacks + boolean usernameMatch = secureCompare(receivedUsername, expectedUsername); + boolean passwordMatch = secureCompare(receivedPassword, expectedPassword); + + return usernameMatch && passwordMatch; + + } catch (IllegalArgumentException e) { + return false; + } + } + + /** + * Extracts username from the Authorization header. + * + * @param authorizationHeader The Authorization header value + * @return The username, or null if extraction fails + */ + public String extractUsername(String authorizationHeader) { + if (authorizationHeader == null || !authorizationHeader.startsWith(BASIC_AUTH_PREFIX)) { + return null; + } + + try { + String base64Credentials = authorizationHeader.substring(BASIC_AUTH_PREFIX.length()).trim(); + byte[] decodedBytes = Base64.getDecoder().decode(base64Credentials); + String decodedCredentials = new String(decodedBytes, StandardCharsets.UTF_8); + + int colonIndex = decodedCredentials.indexOf(':'); + if (colonIndex == -1) { + return null; + } + + return decodedCredentials.substring(0, colonIndex); + } catch (IllegalArgumentException e) { + return null; + } + } + + /** + * Performs a constant-time comparison of two strings to prevent timing attacks. + * + * @param a First string + * @param b Second string + * @return true if strings are equal, false otherwise + */ + private boolean secureCompare(String a, String b) { + if (a == null || b == null) { + return false; + } + + byte[] aBytes = a.getBytes(StandardCharsets.UTF_8); + byte[] bBytes = b.getBytes(StandardCharsets.UTF_8); + + if (aBytes.length != bBytes.length) { + return false; + } + + int result = 0; + for (int i = 0; i < aBytes.length; i++) { + result |= aBytes[i] ^ bBytes[i]; + } + return result == 0; + } +} + diff --git a/src/test/java/com/chargebee/transport/FakeTransport.java b/src/test/java/com/chargebee/transport/FakeTransport.java index 06a1caae..382f7407 100644 --- a/src/test/java/com/chargebee/transport/FakeTransport.java +++ b/src/test/java/com/chargebee/transport/FakeTransport.java @@ -23,7 +23,7 @@ public FakeTransport() { } @Override - public Response send(Request request) throws TransportException { + public Response send(Request request) { recordedRequests.add(request); Response response = queuedResponses.poll(); diff --git a/src/test/java/com/chargebee/v4/RequestParamsTest.java b/src/test/java/com/chargebee/v4/RequestParamsTest.java index 1ab1e87c..687725cb 100644 --- a/src/test/java/com/chargebee/v4/RequestParamsTest.java +++ b/src/test/java/com/chargebee/v4/RequestParamsTest.java @@ -1,6 +1,6 @@ package com.chargebee.v4; -import com.chargebee.v4.models.estimate.params.EstimateCreateSubscriptionForItemsParams; +import com.chargebee.v4.models.estimate.params.CreateSubscriptionItemEstimateParams; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.DisplayName; import java.util.Map; @@ -18,14 +18,14 @@ class RequestParamsTest { @Test - @DisplayName("EstimateCreateSubscriptionForItemsParams should build with strongly-typed fields") - void testEstimateCreateSubscriptionForItemsParamsBuilding() { + @DisplayName("CreateSubscriptionItemEstimateParams should build with strongly-typed fields") + void testCreateSubscriptionItemEstimateParamsBuilding() { // Build request using the strongly-typed builder - EstimateCreateSubscriptionForItemsParams params = EstimateCreateSubscriptionForItemsParams.builder() + CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder() .billingCycles(3) .mandatoryItemsToRemove(Arrays.asList("item1", "item2")) .termsToCharge(12) - .billingAlignmentMode(EstimateCreateSubscriptionForItemsParams.BillingAlignmentMode.IMMEDIATE) + .billingAlignmentMode(CreateSubscriptionItemEstimateParams.BillingAlignmentMode.IMMEDIATE) .couponIds(Arrays.asList("coupon1", "coupon2")) .invoiceImmediately(true) .invoiceDate(Timestamp.from(Instant.now())) @@ -36,7 +36,7 @@ void testEstimateCreateSubscriptionForItemsParamsBuilding() { assertEquals(3, params.getBillingCycles()); assertEquals(Arrays.asList("item1", "item2"), params.getMandatoryItemsToRemove()); assertEquals(12, params.getTermsToCharge()); - assertEquals(EstimateCreateSubscriptionForItemsParams.BillingAlignmentMode.IMMEDIATE, params.getBillingAlignmentMode()); + assertEquals(CreateSubscriptionItemEstimateParams.BillingAlignmentMode.IMMEDIATE, params.getBillingAlignmentMode()); assertEquals(Arrays.asList("coupon1", "coupon2"), params.getCouponIds()); assertTrue(params.getInvoiceImmediately()); assertNotNull(params.getInvoiceDate()); @@ -44,10 +44,10 @@ void testEstimateCreateSubscriptionForItemsParamsBuilding() { } @Test - @DisplayName("EstimateCreateSubscriptionForItemsParams should serialize to Map for HTTP transport") - void testEstimateCreateSubscriptionForItemsParamsToFormData() { + @DisplayName("CreateSubscriptionItemEstimateParams should serialize to Map for HTTP transport") + void testCreateSubscriptionItemEstimateParamsToFormData() { // Build request - EstimateCreateSubscriptionForItemsParams params = EstimateCreateSubscriptionForItemsParams.builder() + CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder() .billingCycles(6) .mandatoryItemsToRemove(Arrays.asList("remove1")) .termsToCharge(24) @@ -68,14 +68,14 @@ void testEstimateCreateSubscriptionForItemsParamsToFormData() { @DisplayName("Nested SubscriptionParams should work correctly") void testNestedSubscriptionParams() { // Build nested subscription params - EstimateCreateSubscriptionForItemsParams.SubscriptionParams subscription = - EstimateCreateSubscriptionForItemsParams.SubscriptionParams.builder() + CreateSubscriptionItemEstimateParams.SubscriptionParams subscription = + CreateSubscriptionItemEstimateParams.SubscriptionParams.builder() .id("sub123") .trialEnd(Timestamp.from(Instant.now().plusSeconds(86400))) .build(); // Build main params with nested subscription - EstimateCreateSubscriptionForItemsParams params = EstimateCreateSubscriptionForItemsParams.builder() + CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder() .subscription(subscription) .billingCycles(12) .build(); @@ -90,8 +90,8 @@ void testNestedSubscriptionParams() { @DisplayName("BillingAddressParams should work as nested object") void testNestedBillingAddressParams() { // Build nested billing address - EstimateCreateSubscriptionForItemsParams.BillingAddressParams billingAddress = - EstimateCreateSubscriptionForItemsParams.BillingAddressParams.builder() + CreateSubscriptionItemEstimateParams.BillingAddressParams billingAddress = + CreateSubscriptionItemEstimateParams.BillingAddressParams.builder() .line1("123 Main St") .city("San Francisco") .stateCode("CA") @@ -100,7 +100,7 @@ void testNestedBillingAddressParams() { .build(); // Build main params - EstimateCreateSubscriptionForItemsParams params = EstimateCreateSubscriptionForItemsParams.builder() + CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder() .billingAddress(billingAddress) .build(); @@ -115,7 +115,7 @@ void testNestedBillingAddressParams() { @Test @DisplayName("Null values should be handled correctly") void testNullValues() { - EstimateCreateSubscriptionForItemsParams params = EstimateCreateSubscriptionForItemsParams.builder() + CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder() .billingCycles(1) .build(); @@ -129,19 +129,19 @@ void testNullValues() { @DisplayName("List of SubscriptionItemsParams should work correctly") void testListOfSubscriptionItemsParams() { // Build list of subscription items - List items = Arrays.asList( - EstimateCreateSubscriptionForItemsParams.SubscriptionItemsParams.builder() + List items = Arrays.asList( + CreateSubscriptionItemEstimateParams.SubscriptionItemsParams.builder() .itemPriceId("price1") .quantity(5) .build(), - EstimateCreateSubscriptionForItemsParams.SubscriptionItemsParams.builder() + CreateSubscriptionItemEstimateParams.SubscriptionItemsParams.builder() .itemPriceId("price2") .quantity(10) .build() ); // Build main params - EstimateCreateSubscriptionForItemsParams params = EstimateCreateSubscriptionForItemsParams.builder() + CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder() .subscriptionItems(items) .build(); @@ -156,24 +156,24 @@ void testListOfSubscriptionItemsParams() { @Test @DisplayName("Enum values should work correctly") void testEnumValues() { - EstimateCreateSubscriptionForItemsParams params = EstimateCreateSubscriptionForItemsParams.builder() - .billingAlignmentMode(EstimateCreateSubscriptionForItemsParams.BillingAlignmentMode.DELAYED) + CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder() + .billingAlignmentMode(CreateSubscriptionItemEstimateParams.BillingAlignmentMode.DELAYED) .build(); - assertEquals(EstimateCreateSubscriptionForItemsParams.BillingAlignmentMode.DELAYED, + assertEquals(CreateSubscriptionItemEstimateParams.BillingAlignmentMode.DELAYED, params.getBillingAlignmentMode()); assertEquals("delayed", params.getBillingAlignmentMode().getValue()); // Test enum fromString - EstimateCreateSubscriptionForItemsParams.BillingAlignmentMode parsed = - EstimateCreateSubscriptionForItemsParams.BillingAlignmentMode.fromString("immediate"); - assertEquals(EstimateCreateSubscriptionForItemsParams.BillingAlignmentMode.IMMEDIATE, parsed); + CreateSubscriptionItemEstimateParams.BillingAlignmentMode parsed = + CreateSubscriptionItemEstimateParams.BillingAlignmentMode.fromString("immediate"); + assertEquals(CreateSubscriptionItemEstimateParams.BillingAlignmentMode.IMMEDIATE, parsed); } @Test @DisplayName("MapStruct compatibility - getters follow Java Bean convention") void testMapStructCompatibility() { - EstimateCreateSubscriptionForItemsParams params = EstimateCreateSubscriptionForItemsParams.builder() + CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder() .billingCycles(42) .clientProfileId("test-profile") .build(); diff --git a/src/test/java/com/chargebee/v4/client/CustomTransportHeaderTest.java b/src/test/java/com/chargebee/v4/client/CustomTransportHeaderTest.java index 027b1806..8c387414 100644 --- a/src/test/java/com/chargebee/v4/client/CustomTransportHeaderTest.java +++ b/src/test/java/com/chargebee/v4/client/CustomTransportHeaderTest.java @@ -15,7 +15,7 @@ void customTransportShouldReceiveDefaultHeaders() throws Exception { Transport customTransport = new Transport() { @Override - public Response send(Request request) throws TransportException { + public Response send(Request request) { capturedRequest.set(request); return new Response(200, java.util.Collections.emptyMap(), "{}".getBytes()); } diff --git a/src/test/java/com/chargebee/v4/internal/JsonUtilTest.java b/src/test/java/com/chargebee/v4/internal/JsonUtilTest.java new file mode 100644 index 00000000..5fc09d30 --- /dev/null +++ b/src/test/java/com/chargebee/v4/internal/JsonUtilTest.java @@ -0,0 +1,1037 @@ +package com.chargebee.v4.internal; + +import org.junit.jupiter.api.*; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Comprehensive test suite for JsonUtil. + * Inspired by Gson's testing strategies to battle-test our JSON parsing. + */ +@DisplayName("JsonUtil Tests") +class JsonUtilTest { + + // ========== getString Tests ========== + @Nested + @DisplayName("getString Tests") + class GetStringTests { + + @Test + @DisplayName("should extract simple string value") + void shouldExtractSimpleString() { + String json = "{\"name\": \"John\"}"; + assertEquals("John", JsonUtil.getString(json, "name")); + } + + @Test + @DisplayName("should extract string with spaces") + void shouldExtractStringWithSpaces() { + String json = "{\"message\": \"Hello World\"}"; + assertEquals("Hello World", JsonUtil.getString(json, "message")); + } + + @Test + @DisplayName("should handle escaped quotes in string") + void shouldHandleEscapedQuotes() { + String json = "{\"text\": \"He said \\\"Hello\\\"\"}"; + assertEquals("He said \"Hello\"", JsonUtil.getString(json, "text")); + } + + @Test + @DisplayName("should handle escaped backslashes") + void shouldHandleEscapedBackslashes() { + String json = "{\"path\": \"C:\\\\Users\\\\test\"}"; + assertEquals("C:\\Users\\test", JsonUtil.getString(json, "path")); + } + + @Test + @DisplayName("should handle newlines and tabs") + void shouldHandleNewlinesAndTabs() { + String json = "{\"text\": \"line1\\nline2\\ttab\"}"; + assertEquals("line1\nline2\ttab", JsonUtil.getString(json, "text")); + } + + @Test + @DisplayName("should return null for missing key") + void shouldReturnNullForMissingKey() { + String json = "{\"name\": \"John\"}"; + assertNull(JsonUtil.getString(json, "missing")); + } + + @Test + @DisplayName("should return null for null json") + void shouldReturnNullForNullJson() { + assertNull(JsonUtil.getString(null, "key")); + } + + @Test + @DisplayName("should return null for null key") + void shouldReturnNullForNullKey() { + assertNull(JsonUtil.getString("{\"name\": \"John\"}", null)); + } + + @Test + @DisplayName("should extract empty string") + void shouldExtractEmptyString() { + String json = "{\"empty\": \"\"}"; + assertEquals("", JsonUtil.getString(json, "empty")); + } + + @Test + @DisplayName("should extract string with unicode characters") + void shouldExtractUnicodeString() { + String json = "{\"text\": \"日本語 中文 한국어\"}"; + assertEquals("日本語 中文 한국어", JsonUtil.getString(json, "text")); + } + + @Test + @DisplayName("should extract string with special JSON characters") + void shouldExtractStringWithSpecialChars() { + String json = "{\"text\": \"test: \\\"value\\\", more\"}"; + assertEquals("test: \"value\", more", JsonUtil.getString(json, "text")); + } + } + + // ========== getLong Tests ========== + @Nested + @DisplayName("getLong Tests") + class GetLongTests { + + @Test + @DisplayName("should extract positive long") + void shouldExtractPositiveLong() { + String json = "{\"id\": 12345678901234}"; + assertEquals(12345678901234L, JsonUtil.getLong(json, "id")); + } + + @Test + @DisplayName("should extract negative long") + void shouldExtractNegativeLong() { + String json = "{\"value\": -9876543210}"; + assertEquals(-9876543210L, JsonUtil.getLong(json, "value")); + } + + @Test + @DisplayName("should extract zero") + void shouldExtractZero() { + String json = "{\"count\": 0}"; + assertEquals(0L, JsonUtil.getLong(json, "count")); + } + + @Test + @DisplayName("should return null for missing key") + void shouldReturnNullForMissingKey() { + String json = "{\"id\": 123}"; + assertNull(JsonUtil.getLong(json, "missing")); + } + + @Test + @DisplayName("should return null for null json") + void shouldReturnNullForNullJson() { + assertNull(JsonUtil.getLong(null, "key")); + } + + @Test + @DisplayName("should extract epoch timestamp") + void shouldExtractEpochTimestamp() { + String json = "{\"created_at\": 1605530769}"; + assertEquals(1605530769L, JsonUtil.getLong(json, "created_at")); + } + + @Test + @DisplayName("should extract resource_version (large long)") + void shouldExtractResourceVersion() { + String json = "{\"resource_version\": 1605530769000}"; + assertEquals(1605530769000L, JsonUtil.getLong(json, "resource_version")); + } + } + + // ========== getInteger Tests ========== + @Nested + @DisplayName("getInteger Tests") + class GetIntegerTests { + + @Test + @DisplayName("should extract positive integer") + void shouldExtractPositiveInteger() { + String json = "{\"count\": 42}"; + assertEquals(42, JsonUtil.getInteger(json, "count")); + } + + @Test + @DisplayName("should extract negative integer") + void shouldExtractNegativeInteger() { + String json = "{\"offset\": -10}"; + assertEquals(-10, JsonUtil.getInteger(json, "offset")); + } + + @Test + @DisplayName("should return null for missing key") + void shouldReturnNullForMissingKey() { + String json = "{\"count\": 42}"; + assertNull(JsonUtil.getInteger(json, "missing")); + } + } + + // ========== getBoolean Tests ========== + @Nested + @DisplayName("getBoolean Tests") + class GetBooleanTests { + + @Test + @DisplayName("should extract true") + void shouldExtractTrue() { + String json = "{\"active\": true}"; + assertTrue(JsonUtil.getBoolean(json, "active")); + } + + @Test + @DisplayName("should extract false") + void shouldExtractFalse() { + String json = "{\"deleted\": false}"; + assertFalse(JsonUtil.getBoolean(json, "deleted")); + } + + @Test + @DisplayName("should return null for missing key") + void shouldReturnNullForMissingKey() { + String json = "{\"active\": true}"; + assertNull(JsonUtil.getBoolean(json, "missing")); + } + + @Test + @DisplayName("should return null for null json") + void shouldReturnNullForNullJson() { + assertNull(JsonUtil.getBoolean(null, "key")); + } + } + + // ========== getDouble Tests ========== + @Nested + @DisplayName("getDouble Tests") + class GetDoubleTests { + + @Test + @DisplayName("should extract positive double") + void shouldExtractPositiveDouble() { + String json = "{\"price\": 99.99}"; + assertEquals(99.99, JsonUtil.getDouble(json, "price"), 0.001); + } + + @Test + @DisplayName("should extract negative double") + void shouldExtractNegativeDouble() { + String json = "{\"balance\": -123.45}"; + assertEquals(-123.45, JsonUtil.getDouble(json, "balance"), 0.001); + } + + @Test + @DisplayName("should extract exchange rate") + void shouldExtractExchangeRate() { + String json = "{\"exchange_rate\": 1.0}"; + assertEquals(1.0, JsonUtil.getDouble(json, "exchange_rate"), 0.001); + } + + @Test + @DisplayName("should extract integer as double") + void shouldExtractIntegerAsDouble() { + String json = "{\"amount\": 10000}"; + assertEquals(10000.0, JsonUtil.getDouble(json, "amount"), 0.001); + } + } + + // ========== getBigDecimal Tests ========== + @Nested + @DisplayName("getBigDecimal Tests") + class GetBigDecimalTests { + + @Test + @DisplayName("should extract decimal value") + void shouldExtractDecimalValue() { + String json = "{\"amount\": 1234.56}"; + assertEquals(new BigDecimal("1234.56"), JsonUtil.getBigDecimal(json, "amount")); + } + + @Test + @DisplayName("should extract integer as BigDecimal") + void shouldExtractIntegerAsBigDecimal() { + String json = "{\"amount\": 10000}"; + assertEquals(new BigDecimal("10000"), JsonUtil.getBigDecimal(json, "amount")); + } + } + + // ========== getObject Tests ========== + @Nested + @DisplayName("getObject Tests") + class GetObjectTests { + + @Test + @DisplayName("should extract simple nested object") + void shouldExtractSimpleNestedObject() { + String json = "{\"customer\": {\"id\": \"cust_123\", \"name\": \"John\"}}"; + String result = JsonUtil.getObject(json, "customer"); + assertNotNull(result); + assertTrue(result.contains("\"id\": \"cust_123\"")); + assertTrue(result.contains("\"name\": \"John\"")); + } + + @Test + @DisplayName("should extract deeply nested object") + void shouldExtractDeeplyNestedObject() { + String json = "{\"data\": {\"customer\": {\"address\": {\"city\": \"NYC\"}}}}"; + String dataObj = JsonUtil.getObject(json, "data"); + assertNotNull(dataObj); + String customerObj = JsonUtil.getObject(dataObj, "customer"); + assertNotNull(customerObj); + String addressObj = JsonUtil.getObject(customerObj, "address"); + assertNotNull(addressObj); + assertEquals("NYC", JsonUtil.getString(addressObj, "city")); + } + + @Test + @DisplayName("should handle object with nested arrays") + void shouldHandleObjectWithNestedArrays() { + String json = "{\"transaction\": {\"id\": \"txn_123\", \"linked_invoices\": [{\"id\": \"inv_1\"}]}}"; + String result = JsonUtil.getObject(json, "transaction"); + assertNotNull(result); + assertTrue(result.contains("linked_invoices")); + assertTrue(result.contains("inv_1")); + } + + @Test + @DisplayName("should handle object with escaped strings") + void shouldHandleObjectWithEscapedStrings() { + String json = "{\"data\": {\"text\": \"Hello \\\"World\\\"\"}}"; + String result = JsonUtil.getObject(json, "data"); + assertNotNull(result); + assertTrue(result.contains("Hello \\\"World\\\"")); + } + + @Test + @DisplayName("should return null for missing key") + void shouldReturnNullForMissingKey() { + String json = "{\"customer\": {\"id\": \"123\"}}"; + assertNull(JsonUtil.getObject(json, "missing")); + } + + @Test + @DisplayName("should return null when value is not object") + void shouldReturnNullWhenNotObject() { + String json = "{\"name\": \"John\"}"; + assertNull(JsonUtil.getObject(json, "name")); + } + + @Test + @DisplayName("should extract empty object") + void shouldExtractEmptyObject() { + String json = "{\"metadata\": {}}"; + assertEquals("{}", JsonUtil.getObject(json, "metadata")); + } + } + + // ========== getArray Tests - THE CRITICAL FIX ========== + @Nested + @DisplayName("getArray Tests") + class GetArrayTests { + + @Test + @DisplayName("should extract simple array of strings") + void shouldExtractSimpleArrayOfStrings() { + String json = "{\"tags\": [\"a\", \"b\", \"c\"]}"; + String result = JsonUtil.getArray(json, "tags"); + assertNotNull(result); + assertEquals("[\"a\", \"b\", \"c\"]", result); + } + + @Test + @DisplayName("should extract empty array") + void shouldExtractEmptyArray() { + String json = "{\"items\": []}"; + assertEquals("[]", JsonUtil.getArray(json, "items")); + } + + @Test + @DisplayName("should extract array of objects") + void shouldExtractArrayOfObjects() { + String json = "{\"list\": [{\"id\": 1}, {\"id\": 2}]}"; + String result = JsonUtil.getArray(json, "list"); + assertNotNull(result); + assertTrue(result.startsWith("[")); + assertTrue(result.endsWith("]")); + assertTrue(result.contains("{\"id\": 1}")); + assertTrue(result.contains("{\"id\": 2}")); + } + + @Test + @DisplayName("should handle array with nested arrays - THE BUG FIX TEST") + void shouldHandleArrayWithNestedArrays() { + // This is the exact case that was failing before the fix! + String json = "{\"list\": [{\"transaction\": {\"linked_invoices\": [{\"id\": \"inv_1\"}], \"linked_refunds\": []}}]}"; + String result = JsonUtil.getArray(json, "list"); + assertNotNull(result); + assertTrue(result.startsWith("[")); + assertTrue(result.endsWith("]")); + // Verify the entire array is extracted, not truncated at first ] + assertTrue(result.contains("linked_invoices")); + assertTrue(result.contains("linked_refunds")); + assertTrue(result.contains("inv_1")); + } + + @Test + @DisplayName("should handle complex nested structure from transaction API") + void shouldHandleComplexNestedStructure() { + // Real-world example from the bug report + String json = "{\"list\": [{\"transaction\": {" + + "\"id\": \"txn_AzZhUGSPAkLskJQo\"," + + "\"customer_id\": \"cbdemo_dave\"," + + "\"amount\": 10000," + + "\"linked_invoices\": [{" + + "\"invoice_id\": \"DemoInv_103\"," + + "\"applied_amount\": 10000," + + "\"applied_at\": 1605530769" + + "}]," + + "\"linked_refunds\": []," + + "\"payment_method_details\": \"{\\\"card\\\":{\\\"iin\\\":\\\"555555\\\"}}\"" + + "}}]}"; + + String result = JsonUtil.getArray(json, "list"); + assertNotNull(result); + assertTrue(result.startsWith("[")); + assertTrue(result.endsWith("]")); + + // Critical: verify we got the complete array, not truncated + assertTrue(result.contains("txn_AzZhUGSPAkLskJQo")); + assertTrue(result.contains("linked_invoices")); + assertTrue(result.contains("DemoInv_103")); + assertTrue(result.contains("linked_refunds")); + } + + @Test + @DisplayName("should handle array with deeply nested objects") + void shouldHandleArrayWithDeeplyNestedObjects() { + String json = "{\"data\": [{\"level1\": {\"level2\": {\"level3\": [{\"value\": 1}]}}}]}"; + String result = JsonUtil.getArray(json, "data"); + assertNotNull(result); + assertTrue(result.contains("level1")); + assertTrue(result.contains("level2")); + assertTrue(result.contains("level3")); + assertTrue(result.contains("value")); + } + + @Test + @DisplayName("should handle array with escaped strings containing brackets") + void shouldHandleArrayWithEscapedBrackets() { + String json = "{\"messages\": [\"text with [brackets]\", \"another [one]\"]}"; + String result = JsonUtil.getArray(json, "messages"); + assertNotNull(result); + assertTrue(result.contains("[brackets]")); + assertTrue(result.contains("[one]")); + } + + @Test + @DisplayName("should handle array with JSON string field containing brackets") + void shouldHandleArrayWithJsonStringField() { + // payment_method_details contains a JSON string with brackets + String json = "{\"list\": [{\"details\": \"{\\\"array\\\":[1,2,3]}\"}]}"; + String result = JsonUtil.getArray(json, "list"); + assertNotNull(result); + assertTrue(result.contains("details")); + } + + @Test + @DisplayName("should return null for missing array key") + void shouldReturnNullForMissingKey() { + String json = "{\"data\": [1, 2, 3]}"; + assertNull(JsonUtil.getArray(json, "missing")); + } + + @Test + @DisplayName("should return null when value is not array") + void shouldReturnNullWhenNotArray() { + String json = "{\"name\": \"John\"}"; + assertNull(JsonUtil.getArray(json, "name")); + } + + @Test + @DisplayName("should handle multiple arrays in same object") + void shouldHandleMultipleArrays() { + String json = "{\"first\": [1, 2], \"second\": [3, 4], \"third\": [5, 6]}"; + assertEquals("[1, 2]", JsonUtil.getArray(json, "first")); + assertEquals("[3, 4]", JsonUtil.getArray(json, "second")); + assertEquals("[5, 6]", JsonUtil.getArray(json, "third")); + } + + @Test + @DisplayName("should handle array with null values") + void shouldHandleArrayWithNulls() { + String json = "{\"values\": [null, \"a\", null, \"b\"]}"; + String result = JsonUtil.getArray(json, "values"); + assertNotNull(result); + assertTrue(result.contains("null")); + } + } + + // ========== parseObjectArray Tests ========== + @Nested + @DisplayName("parseObjectArray Tests") + class ParseObjectArrayTests { + + @Test + @DisplayName("should parse array of simple objects") + void shouldParseArrayOfSimpleObjects() { + String arrayJson = "[{\"id\": 1}, {\"id\": 2}, {\"id\": 3}]"; + List objects = JsonUtil.parseObjectArray(arrayJson); + assertEquals(3, objects.size()); + assertTrue(objects.get(0).contains("\"id\": 1")); + assertTrue(objects.get(1).contains("\"id\": 2")); + assertTrue(objects.get(2).contains("\"id\": 3")); + } + + @Test + @DisplayName("should parse array of complex objects") + void shouldParseArrayOfComplexObjects() { + String arrayJson = "[{\"transaction\": {\"id\": \"txn_1\", \"items\": [1, 2]}}, {\"transaction\": {\"id\": \"txn_2\"}}]"; + List objects = JsonUtil.parseObjectArray(arrayJson); + assertEquals(2, objects.size()); + assertTrue(objects.get(0).contains("txn_1")); + assertTrue(objects.get(1).contains("txn_2")); + } + + @Test + @DisplayName("should return empty list for null input") + void shouldReturnEmptyListForNull() { + List objects = JsonUtil.parseObjectArray(null); + assertTrue(objects.isEmpty()); + } + + @Test + @DisplayName("should return empty list for empty array") + void shouldReturnEmptyListForEmptyArray() { + List objects = JsonUtil.parseObjectArray("[]"); + assertTrue(objects.isEmpty()); + } + + @Test + @DisplayName("should return empty list for non-array input") + void shouldReturnEmptyListForNonArray() { + List objects = JsonUtil.parseObjectArray("{\"id\": 1}"); + assertTrue(objects.isEmpty()); + } + + @Test + @DisplayName("should handle objects with escaped strings") + void shouldHandleObjectsWithEscapedStrings() { + String arrayJson = "[{\"text\": \"Hello \\\"World\\\"\"}]"; + List objects = JsonUtil.parseObjectArray(arrayJson); + assertEquals(1, objects.size()); + assertTrue(objects.get(0).contains("Hello \\\"World\\\"")); + } + } + + // ========== parseArrayOf* Tests ========== + @Nested + @DisplayName("parseArrayOf* Tests") + class ParseArrayOfTests { + + @Test + @DisplayName("should parse array of strings") + void shouldParseArrayOfStrings() { + String arrayJson = "[\"a\", \"b\", \"c\"]"; + List result = JsonUtil.parseArrayOfString(arrayJson); + assertEquals(3, result.size()); + assertEquals("a", result.get(0)); + assertEquals("b", result.get(1)); + assertEquals("c", result.get(2)); + } + + @Test + @DisplayName("should parse array of integers") + void shouldParseArrayOfIntegers() { + String arrayJson = "[1, 2, 3, -4, 0]"; + List result = JsonUtil.parseArrayOfInteger(arrayJson); + assertEquals(5, result.size()); + assertEquals(1, result.get(0)); + assertEquals(-4, result.get(3)); + assertEquals(0, result.get(4)); + } + + @Test + @DisplayName("should parse array of longs") + void shouldParseArrayOfLongs() { + String arrayJson = "[1605530769000, 1605530770000]"; + List result = JsonUtil.parseArrayOfLong(arrayJson); + assertEquals(2, result.size()); + assertEquals(1605530769000L, result.get(0)); + } + + @Test + @DisplayName("should parse array of booleans") + void shouldParseArrayOfBooleans() { + String arrayJson = "[true, false, true]"; + List result = JsonUtil.parseArrayOfBoolean(arrayJson); + assertEquals(3, result.size()); + assertTrue(result.get(0)); + assertFalse(result.get(1)); + assertTrue(result.get(2)); + } + + @Test + @DisplayName("should parse array of doubles") + void shouldParseArrayOfDoubles() { + String arrayJson = "[1.5, 2.7, 3.14]"; + List result = JsonUtil.parseArrayOfDouble(arrayJson); + assertEquals(3, result.size()); + assertEquals(1.5, result.get(0), 0.001); + } + + @Test + @DisplayName("should parse array of BigDecimal") + void shouldParseArrayOfBigDecimal() { + String arrayJson = "[123.45, 678.90]"; + List result = JsonUtil.parseArrayOfBigDecimal(arrayJson); + assertEquals(2, result.size()); + } + + @Test + @DisplayName("should return empty list for empty arrays") + void shouldReturnEmptyListForEmptyArrays() { + assertTrue(JsonUtil.parseArrayOfString("[]").isEmpty()); + assertTrue(JsonUtil.parseArrayOfInteger("[]").isEmpty()); + assertTrue(JsonUtil.parseArrayOfLong("[]").isEmpty()); + assertTrue(JsonUtil.parseArrayOfBoolean("[]").isEmpty()); + assertTrue(JsonUtil.parseArrayOfDouble("[]").isEmpty()); + } + + @Test + @DisplayName("should return empty list for null input") + void shouldReturnEmptyListForNull() { + assertTrue(JsonUtil.parseArrayOfString(null).isEmpty()); + assertTrue(JsonUtil.parseArrayOfInteger(null).isEmpty()); + } + } + + // ========== getTimestamp Tests ========== + @Nested + @DisplayName("getTimestamp Tests") + class GetTimestampTests { + + @Test + @DisplayName("should parse epoch seconds to timestamp") + void shouldParseEpochSecondsToTimestamp() { + String json = "{\"created_at\": 1605530769}"; + Timestamp result = JsonUtil.getTimestamp(json, "created_at"); + assertNotNull(result); + assertEquals(1605530769000L, result.getTime()); + } + + @Test + @DisplayName("should return null for missing key") + void shouldReturnNullForMissingKey() { + String json = "{\"updated_at\": 1605530769}"; + assertNull(JsonUtil.getTimestamp(json, "created_at")); + } + } + + // ========== hasValue Tests ========== + @Nested + @DisplayName("hasValue Tests") + class HasValueTests { + + @Test + @DisplayName("should return true for existing non-null value") + void shouldReturnTrueForExistingValue() { + String json = "{\"name\": \"John\", \"age\": 30}"; + assertTrue(JsonUtil.hasValue(json, "name")); + assertTrue(JsonUtil.hasValue(json, "age")); + } + + @Test + @DisplayName("should return false for null value") + void shouldReturnFalseForNullValue() { + String json = "{\"name\": null}"; + assertFalse(JsonUtil.hasValue(json, "name")); + } + + @Test + @DisplayName("should return false for missing key") + void shouldReturnFalseForMissingKey() { + String json = "{\"name\": \"John\"}"; + assertFalse(JsonUtil.hasValue(json, "missing")); + } + } + + // ========== parseJsonObjectToMap Tests ========== + @Nested + @DisplayName("parseJsonObjectToMap Tests") + class ParseJsonObjectToMapTests { + + @Test + @DisplayName("should parse simple object to map") + void shouldParseSimpleObjectToMap() { + String json = "{\"name\": \"John\", \"age\": 30, \"active\": true}"; + Map map = JsonUtil.parseJsonObjectToMap(json); + assertEquals("John", map.get("name")); + assertEquals(30L, map.get("age")); + assertEquals(true, map.get("active")); + } + + @Test + @DisplayName("should handle nested objects") + void shouldHandleNestedObjects() { + String json = "{\"user\": {\"name\": \"John\"}}"; + Map map = JsonUtil.parseJsonObjectToMap(json); + assertTrue(map.get("user") instanceof String); + assertTrue(((String) map.get("user")).contains("name")); + } + + @Test + @DisplayName("should handle arrays in map") + void shouldHandleArraysInMap() { + String json = "{\"tags\": [\"a\", \"b\"]}"; + Map map = JsonUtil.parseJsonObjectToMap(json); + assertTrue(map.get("tags") instanceof String); + assertTrue(((String) map.get("tags")).contains("\"a\"")); + } + + @Test + @DisplayName("should return empty map for empty object") + void shouldReturnEmptyMapForEmptyObject() { + Map map = JsonUtil.parseJsonObjectToMap("{}"); + assertTrue(map.isEmpty()); + } + + @Test + @DisplayName("should return empty map for null") + void shouldReturnEmptyMapForNull() { + Map map = JsonUtil.parseJsonObjectToMap(null); + assertTrue(map.isEmpty()); + } + + @Test + @DisplayName("should handle null values") + void shouldHandleNullValues() { + String json = "{\"value\": null}"; + Map map = JsonUtil.parseJsonObjectToMap(json); + assertTrue(map.containsKey("value")); + assertNull(map.get("value")); + } + + @Test + @DisplayName("should handle double values") + void shouldHandleDoubleValues() { + String json = "{\"price\": 99.99}"; + Map map = JsonUtil.parseJsonObjectToMap(json); + assertEquals(99.99, (Double) map.get("price"), 0.001); + } + } + + // ========== toJson Tests ========== + @Nested + @DisplayName("toJson Tests") + class ToJsonTests { + + @Test + @DisplayName("should serialize map to JSON") + void shouldSerializeMapToJson() { + Map map = new java.util.LinkedHashMap<>(); + map.put("name", "John"); + map.put("age", 30); + + String json = JsonUtil.toJson(map); + assertTrue(json.contains("\"name\":\"John\"")); + assertTrue(json.contains("\"age\":30")); + } + + @Test + @DisplayName("should serialize list to JSON") + void shouldSerializeListToJson() { + List list = java.util.Arrays.asList("a", "b", "c"); + String json = JsonUtil.toJson(list); + assertEquals("[\"a\",\"b\",\"c\"]", json); + } + + @Test + @DisplayName("should serialize empty map") + void shouldSerializeEmptyMap() { + assertEquals("{}", JsonUtil.toJson(new java.util.HashMap<>())); + } + + @Test + @DisplayName("should serialize empty list") + void shouldSerializeEmptyList() { + assertEquals("[]", JsonUtil.toJson(new java.util.ArrayList<>())); + } + + @Test + @DisplayName("should escape special characters") + void shouldEscapeSpecialCharacters() { + Map map = new java.util.HashMap<>(); + map.put("text", "Hello \"World\"\nNew line"); + + String json = JsonUtil.toJson(map); + assertTrue(json.contains("\\\"World\\\"")); + assertTrue(json.contains("\\n")); + } + + @Test + @DisplayName("should serialize null values") + void shouldSerializeNullValues() { + Map map = new java.util.HashMap<>(); + map.put("value", null); + + String json = JsonUtil.toJson(map); + assertTrue(json.contains("\"value\":null")); + } + + @Test + @DisplayName("should serialize nested structures") + void shouldSerializeNestedStructures() { + Map inner = new java.util.HashMap<>(); + inner.put("id", 123); + + Map outer = new java.util.HashMap<>(); + outer.put("data", inner); + + String json = JsonUtil.toJson(outer); + assertTrue(json.contains("\"data\":{")); + assertTrue(json.contains("\"id\":123")); + } + } + + // ========== Edge Cases and Real-World Scenarios ========== + @Nested + @DisplayName("Real-World Scenarios") + class RealWorldScenarios { + + @Test + @DisplayName("should parse transaction list response correctly") + void shouldParseTransactionListResponse() { + String json = "{" + + "\"list\": [{\"transaction\": {" + + "\"id\": \"txn_AzZhUGSPAkLskJQo\"," + + "\"customer_id\": \"cbdemo_dave\"," + + "\"subscription_id\": \"cbdemo_dave-sub1\"," + + "\"gateway_account_id\": \"gw_AzZhUGSPAkLeQJPg\"," + + "\"payment_method\": \"card\"," + + "\"gateway\": \"chargebee\"," + + "\"type\": \"payment\"," + + "\"date\": 1605530769," + + "\"exchange_rate\": 1.0," + + "\"amount\": 10000," + + "\"id_at_gateway\": \"cb___dev__KyVnqiSIrqRVUEN\"," + + "\"status\": \"success\"," + + "\"updated_at\": 1605530769," + + "\"resource_version\": 1605530769000," + + "\"deleted\": false," + + "\"object\": \"transaction\"," + + "\"masked_card_number\": \"************4444\"," + + "\"currency_code\": \"USD\"," + + "\"base_currency_code\": \"USD\"," + + "\"amount_unused\": 0," + + "\"linked_invoices\": [{" + + "\"invoice_id\": \"DemoInv_103\"," + + "\"applied_amount\": 10000," + + "\"applied_at\": 1605530769," + + "\"invoice_date\": 1605530769," + + "\"invoice_total\": 10000," + + "\"invoice_status\": \"paid\"" + + "}]," + + "\"linked_refunds\": []," + + "\"payment_method_details\": \"{\\\"card\\\":{\\\"iin\\\":\\\"555555\\\",\\\"last4\\\":\\\"4444\\\"}}\"" + + "}}]," + + "\"next_offset\": null" + + "}"; + + // Test getArray with nested structures + String listArray = JsonUtil.getArray(json, "list"); + assertNotNull(listArray, "list array should not be null"); + assertTrue(listArray.startsWith("["), "Should start with ["); + assertTrue(listArray.endsWith("]"), "Should end with ]"); + + // Verify it contains the complete transaction data + assertTrue(listArray.contains("txn_AzZhUGSPAkLskJQo")); + assertTrue(listArray.contains("linked_invoices")); + assertTrue(listArray.contains("DemoInv_103")); + assertTrue(listArray.contains("linked_refunds")); + assertTrue(listArray.contains("payment_method_details")); + + // Test parseObjectArray + List objects = JsonUtil.parseObjectArray(listArray); + assertEquals(1, objects.size()); + + // Test nested object extraction + String transactionWrapper = objects.get(0); + String transaction = JsonUtil.getObject(transactionWrapper, "transaction"); + assertNotNull(transaction); + + assertEquals("txn_AzZhUGSPAkLskJQo", JsonUtil.getString(transaction, "id")); + assertEquals("cbdemo_dave", JsonUtil.getString(transaction, "customer_id")); + assertEquals(10000, JsonUtil.getInteger(transaction, "amount")); + assertEquals(1.0, JsonUtil.getDouble(transaction, "exchange_rate"), 0.001); + assertFalse(JsonUtil.getBoolean(transaction, "deleted")); + assertEquals(1605530769000L, JsonUtil.getLong(transaction, "resource_version")); + + // Test nested array extraction + String linkedInvoices = JsonUtil.getArray(transaction, "linked_invoices"); + assertNotNull(linkedInvoices); + assertTrue(linkedInvoices.contains("DemoInv_103")); + + String linkedRefunds = JsonUtil.getArray(transaction, "linked_refunds"); + assertNotNull(linkedRefunds); + assertEquals("[]", linkedRefunds); + } + + @Test + @DisplayName("should handle customer list response") + void shouldHandleCustomerListResponse() { + String json = "{" + + "\"list\": [" + + "{\"customer\": {\"id\": \"cust_123\", \"email\": \"test@example.com\"}}," + + "{\"customer\": {\"id\": \"cust_456\", \"email\": \"user@example.com\"}}" + + "]," + + "\"next_offset\": \"offset_abc123\"" + + "}"; + + String listArray = JsonUtil.getArray(json, "list"); + assertNotNull(listArray); + + List items = JsonUtil.parseObjectArray(listArray); + assertEquals(2, items.size()); + + String customer1 = JsonUtil.getObject(items.get(0), "customer"); + assertEquals("cust_123", JsonUtil.getString(customer1, "id")); + + String nextOffset = JsonUtil.getString(json, "next_offset"); + assertEquals("offset_abc123", nextOffset); + } + + @Test + @DisplayName("should handle subscription with multiple nested arrays") + void shouldHandleSubscriptionWithMultipleNestedArrays() { + String json = "{" + + "\"subscription\": {" + + "\"id\": \"sub_123\"," + + "\"subscription_items\": [" + + "{\"item_price_id\": \"price_1\", \"quantity\": 1}," + + "{\"item_price_id\": \"price_2\", \"quantity\": 2}" + + "]," + + "\"addons\": [{\"id\": \"addon_1\"}]," + + "\"coupons\": []," + + "\"discounts\": [{\"id\": \"disc_1\", \"apply_till\": [1, 2, 3]}]" + + "}" + + "}"; + + String subscription = JsonUtil.getObject(json, "subscription"); + assertNotNull(subscription); + + String items = JsonUtil.getArray(subscription, "subscription_items"); + assertNotNull(items); + List itemsList = JsonUtil.parseObjectArray(items); + assertEquals(2, itemsList.size()); + + String addons = JsonUtil.getArray(subscription, "addons"); + assertNotNull(addons); + + String coupons = JsonUtil.getArray(subscription, "coupons"); + assertEquals("[]", coupons); + + String discounts = JsonUtil.getArray(subscription, "discounts"); + assertNotNull(discounts); + // Verify nested array within object within array is handled + assertTrue(discounts.contains("apply_till")); + assertTrue(discounts.contains("[1, 2, 3]") || discounts.contains("[1,2,3]")); + } + } + + // ========== Edge Cases ========== + @Nested + @DisplayName("Edge Cases") + class EdgeCases { + + @Test + @DisplayName("should handle whitespace variations") + void shouldHandleWhitespaceVariations() { + String json1 = "{\"key\":\"value\"}"; + String json2 = "{ \"key\" : \"value\" }"; + String json3 = "{\n \"key\"\t:\n \"value\"\n}"; + + assertEquals("value", JsonUtil.getString(json1, "key")); + assertEquals("value", JsonUtil.getString(json2, "key")); + assertEquals("value", JsonUtil.getString(json3, "key")); + } + + @Test + @DisplayName("should handle keys with special characters") + void shouldHandleKeysWithSpecialCharacters() { + String json = "{\"my-key\": \"value1\", \"my_key\": \"value2\", \"my.key\": \"value3\"}"; + assertEquals("value1", JsonUtil.getString(json, "my-key")); + assertEquals("value2", JsonUtil.getString(json, "my_key")); + assertEquals("value3", JsonUtil.getString(json, "my.key")); + } + + @Test + @DisplayName("should handle very long strings") + void shouldHandleVeryLongStrings() { + StringBuilder longValue = new StringBuilder(); + for (int i = 0; i < 10000; i++) { + longValue.append("x"); + } + String json = "{\"long\": \"" + longValue + "\"}"; + assertEquals(longValue.toString(), JsonUtil.getString(json, "long")); + } + + @Test + @DisplayName("should handle deeply nested structures") + void shouldHandleDeeplyNestedStructures() { + // Create 10 levels of nesting + StringBuilder json = new StringBuilder(); + for (int i = 0; i < 10; i++) { + json.append("{\"level").append(i).append("\": "); + } + json.append("\"deep_value\""); + for (int i = 0; i < 10; i++) { + json.append("}"); + } + + String result = json.toString(); + String level0 = JsonUtil.getObject(result, "level0"); + assertNotNull(level0); + assertTrue(level0.contains("deep_value")); + } + + @Test + @DisplayName("should handle array with mixed types") + void shouldHandleArrayWithMixedTypes() { + String json = "{\"mixed\": [1, \"two\", true, null, {\"key\": \"value\"}, [1, 2]]}"; + String array = JsonUtil.getArray(json, "mixed"); + assertNotNull(array); + assertTrue(array.contains("1")); + assertTrue(array.contains("\"two\"")); + assertTrue(array.contains("true")); + assertTrue(array.contains("null")); + } + + @Test + @DisplayName("should handle colons in string values") + void shouldHandleColonsInStringValues() { + String json = "{\"url\": \"https://example.com:8080/path\"}"; + assertEquals("https://example.com:8080/path", JsonUtil.getString(json, "url")); + } + + @Test + @DisplayName("should handle quotes in key names") + void shouldHandleFirstMatchForDuplicateKeys() { + // JSON spec says duplicate keys have undefined behavior, but we should handle gracefully + String json = "{\"key\": \"first\", \"key\": \"second\"}"; + String result = JsonUtil.getString(json, "key"); + // Should return one of the values (typically first) + assertNotNull(result); + } + } +} +